[mythtv] All SVN MythWeb requests 2sec slower than v0.21 [PATCH]

David Kubicek foceni at gmail.com
Sun Feb 28 20:35:30 UTC 2010


I've been using MythWeb for a really long time, always trunk, but I 
began noticing serious delays associated with each request for the past 
couple of weeks (months?).

A moment ago I tried using my old 0.21 version (just changing the 
protocol version) and everything was blazing fast again. Trace of the 
Apache process showed me two timed out 1 sec poll()'s and I pinned the 
issue down to sendCommand() function in MythBackend.php.

There's an "input flushing" receiveData(1) right after connect(), which 
causes these delays. In my case, these artificial delays are triggered 
when the connection isn't open and connect() has to be called. In other 
words - a situation where socket I/O buffer is empty. In such case, this 
"insurance" call to receiveData(1) blocks unnecessarily for 1 sec every 

I'm attaching a simple patch which introduces an optional millisecond 
timeout argument to receiveData(). SendCommand() uses it to wait just 1 
msec. It's compatible with the rest of the code, but feel free to fix 
this any way you like.

I'm going to create a ticket.

David Kubicek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mythweb-slow.patch
Type: text/x-patch
Size: 1071 bytes
Desc: not available
URL: <http://mythtv.org/pipermail/mythtv-dev/attachments/20100228/28ed9ed6/attachment.bin>

More information about the mythtv-dev mailing list