﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	mlocked
12045	Live TV after a short while always make the frontend hang	JYA	Jean-Yves Avenard <jyavenard@…>	"I'm very puzzled with this one.

It only started since I've been back from a month away. I had never experienced it in the past.

At first, I thought the issue with with my RAID array where the recordings are stored, as smart status of one of the disk started to be very verbose.
Following that, I instead used as recording storage a NFS share to a very fast machine over gigabit (easily saturate the gigabit link and having local write speed in excess of 400MB/s on the NFS server)
that didn't solve the problem.

So I created a brand new backend, new disks, database on fast SSD (580MB/s read/write) the lot...
still issue is just as bad, no matter the frontend.

When starting live TV after a short while (ranging from 10-15s to 3-4 minutes)
the frontend will hang.

In the backend log, you can see usually:
{{{
Feb  4 00:16:33 mediaserver-surrey1 mythbackend: mythbackend[27099]: E ProcessRequest ringbuffer.cpp:1105 (WaitForAvail) RingBuf(/external/recordings/1009_20140203131345.mpg): Waited 16 seconds for data, aborting.
}}}

I attempted to increase the various wait time, to know available.

In fact, from the logs, it appears that once we enter a particular condition, we just never exit the waiting loop; it will always time out.

in the logs usually there are plenty of:
{{{
Feb  4 00:15:41 mediaserver-surrey1 mythbackend: mythbackend[27099]: I ProcessRequest ringbuffer.cpp:1098 (WaitForAvail) RingBuf(/external/recordings/1009_20140203131345.mpg): Waited 0.5 seconds for data #012#011#011#011to become available... 182840 < 229376
}}}

which is fine, playback is just normal

If suddenly the writer thread takes a little longer than usual for whatever reason, WaitForAvailable will start waiting forever:

{{{
Feb  4 00:15:53 mediaserver-surrey1 mythbackend: mythbackend[27099]: W TFWWrite threadedfilewriter.cpp:539 (DiskLoop) TFW(/external/recordings/1009_20140203131345.mpg:71): write(65424) cnt 22 total 1362060 -- took a long time, 1425 ms
Feb  4 00:15:53 mediaserver-surrey1 mythbackend: mythbackend[27099]: I ProcessRequest ringbuffer.cpp:1098 (WaitForAvail) RingBuf(/external/recordings/1009_20140203131345.mpg): Waited 8.0 seconds for data #012#011#011#011to become available... 137524 < 229376
}}}

To accentuate the issue and cause it to occur even more often, I run a side process, writing to the NFS share (not fast 10MB/s)

There seems to be a racing condition somewhere, once the writer thread takes longer than usual once, then the reader thread will never recover.

Attach is a log with the wait changed to 48s (WaitForAvail) and 20s (WaitForReadsAllowed).
"	Bug Report - General	closed	blocker	0.27.1	MythTV - Recording	0.27-fixes	medium	fixed			1
