<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi Guys,<br>
<br>
I have some questions on
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<span class="Apple-style-span" style="border-collapse: separate;
color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;
font-style: normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal; orphans: 2;
text-align: auto; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
-webkit-text-decorations-in-effect: none;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span
class="Apple-style-span" style="text-align: left; ">ringbuffer.cpp.
Please realize that I am fully aware that there is a complex
logic behind all this that I do not understand yet. This is
where I hope somebody can help out.<br>
<br>
I run a single back-end (Ubuntu) with multiple frond-ends
(ZBOXes, also Ubuntu)<br>
<br>
It started out by me being tortured with the never ending <br>
<br>
=========================================================================<br>
Decoder ringbuffer.cpp:1086 (WaitForAvail)
RingBuf(/second_drive/recordings/3130_20120103210000.mpg):
Waited 2.0 seconds for data #012#011#011#011t<br>
=========================================================================<br>
<br>
in the backend log file. I was on 0.25 then. I tried running the
backend in a virtual machine, in a stand-alone machine, with a
new hard drive, difference file systems (ext3, ext4). Nothing
helped. I then saw the bug 10428, which was for 0.26. I
backported that one but the error message did not go away. I
only had real freezes on the front-end between shows and they
would last around 4-5 seconds. Finally I took the leap and
upgraded to 0.27, but the error persisted. Now it is</span></span><br>
<br>
<span class="Apple-style-span" style="border-collapse: separate;
color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;
font-style: normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal; orphans: 2;
text-align: auto; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
-webkit-text-decorations-in-effect: none;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span
class="Apple-style-span" style="text-align: left; ">=========================================================================<br>
</span></span>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
Feb 13 11:27:53 myth1204 mythbackend: mythbackend[5567]: I
ProcessRequest ringbuffer.cpp:1098 (WaitForAvail) RingBuf(/Reco<br>
rdings/7730_20140213171157.mpg): Waited 0.2 seconds for data
#012#011#011#011to become available... 214228 < 425984<br>
<span class="Apple-style-span" style="border-collapse: separate;
color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;
font-style: normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal; orphans: 2;
text-align: auto; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
-webkit-text-decorations-in-effect: none;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span
class="Apple-style-span" style="text-align: left; ">=========================================================================</span></span><br>
<br>
This is when I started to look at ringbuffer.cpp, and specifically
the function RingBuffer::WaitForAvail(int count), where the error
comes from. I have many questions here and I hope this is the place
to ask it.<br>
<br>
Prior to starting the big while loop, that seem to wait for the
buffer to fill up, there is a timer t (MythTimer) instantiated and
started<br>
<br>
MythTimer t;<br>
t.start();<br>
<br>
This seems straight forward. Then the big while loop is started,
which seems to be waiting for avail to be at least as big as count
(which seems to be the amount of data we want). It test other things
as well but they all seem external to the WaitForAvial function.<br>
<br>
In the while loop we call the QWaitCondition wait
(generalWait.wait(&rwlock, 250), with a timeout of max 250
milliseconds. Once we are out of that (worst case 250 ms later) we
go onto checking if avail now is at least count big. If not we do
something I don't understand this and this is where I have
questions. First out, here is the if statement<br>
<br>
==================================================<br>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
if (avail < count)<br>
{<br>
int elapsed = t.elapsed();<br>
if (elapsed > 500 && low_buffers &&
avail >= fill_min)<br>
count = avail;<br>
else if (((elapsed > 250) && (elapsed <
500)) ||<br>
((elapsed > 500) && (elapsed <
750)) ||<br>
((elapsed > 1000) && (elapsed <
1250)) ||<br>
((elapsed > 2000) && (elapsed <
2250)) ||<br>
((elapsed > 4000) && (elapsed <
4250)) ||<br>
((elapsed > 8000) && (elapsed <
8250)) ||<br>
((elapsed > 9000)))<br>
{<br>
LOG(VB_GENERAL, LOG_INFO, LOC + "Waited " +<br>
QString("%1").arg((elapsed / 250) * 0.25f, 3,
'f', 1) +<br>
" seconds for data \n\t\t\tto become
available..." +<br>
QString(" %2 < %3") .arg(avail).arg(count));<br>
}<br>
<br>
if (elapsed > 16000)<br>
{<br>
LOG(VB_GENERAL, LOG_ERR, LOC + "Waited " +<br>
QString("%1").arg(elapsed/1000) +<br>
" seconds for data, aborting.");<br>
return false;<br>
}<br>
}<br>
==================================================<br>
<br>
So why do we expect elapsed to be over 500 ms here? In worst case it
should be only 250 ms, right? At least the first time we are in the
while loop. We would therefore automatically enter the "else if"
statement the first time we are in the while loop, and therefore
risk outputting the Error.<br>
<br>
Then looking at the "if else" statement, what is going on there?<br>
<br>
else if (((elapsed > 250) && (elapsed < 500)) ||<br>
((elapsed > 500) && (elapsed <
750)) ||<br>
((elapsed > 1000) && (elapsed <
1250)) ||<br>
((elapsed > 2000) && (elapsed <
2250)) ||<br>
((elapsed > 4000) && (elapsed <
4250)) ||<br>
((elapsed > 8000) && (elapsed <
8250)) ||<br>
((elapsed > 9000)))<br>
{<br>
Log ugly message<br>
}<br>
<br>
So what is the logic?<br>
if elapsed below 500 ms => OK (can't happen the first lapse in
the while loop)<br>
if elapsed between 750 and 1000 => OK<br>
if elapsed between 1250 and 2000 => OK<br>
and so on....<br>
<br>
It is obvious that I am missing part of the logic here and for that
I apologize. Perhaps if somebody can point me to where I can read
up?<br>
<br>
To me it seems that one test for a max value would be enough. That
max value would be something that would actually cause a problem for
the client. Now it seems we are just polluting the log file with
messages for something that seems to be perfectly okay with the
client. I also notice that the log level is LOG_INFO so I am
wondering why it is visible in the LOG. I run Ubuntu's package and
it seems that thing comes with this log level enabled.<br>
<br>
Just for the heck of it I made some changes (and clearly I don't
know what I am doing here). <br>
I changed the <br>
<br>
generalWait.wait(&rwlock, 250) to generalWait.wait(&rwlock,
500)<br>
This change was made mostly as I felt there might be another thread
that needed some more time (perhaps something that is writing to the
buffer?)<br>
<br>
I then removed everything in the else-if statement and just tested
if it was over 1000. <br>
With these changes I very rarely get anything in the log. I still
get the 4-5 seconds freeze between shows though (even though that
doesn't always happen).<br>
<br>
Any clarifications here would be awesome. I have also seen multiple
other folks having these error messages (searching the Internet).<br>
<br>
Thanks,<br>
<br>
// Jonas<br>
</body>
</html>