Opened 13 years ago

Closed 13 years ago

#8117 closed defect (fixed)

Artificial 2 sec delays in all MythWeb requests

Reported by: foceni@… Owned by: Rob Smith
Priority: major Milestone: 0.23
Component: Plugin - MythWeb Version: head
Severity: medium Keywords: mythweb, slow, slower, delay, timeout
Cc: foceni@… Ticket locked: no


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 time.

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.

Attachments (1)

mythweb-slow.patch (1.0 KB) - added by David Kubicek <foceni@…> 13 years ago.
Fix patch for MythBackend?.php

Download all attachments as: .zip

Change History (3)

Changed 13 years ago by David Kubicek <foceni@…>

Attachment: mythweb-slow.patch added

Fix patch for MythBackend?.php

comment:1 Changed 13 years ago by beirdo

Milestone: unknown0.23

See also #8084

comment:2 Changed 13 years ago by cpinkham

Resolution: fixed
Status: newclosed

(In [23637]) Modify MythWeb to use a new value for the ANNounce string wantsevents of '2' to indicate that MythWeb does not want to receive system events from the backend. This allows us to eliminate the 1-second delay that was recently inserted after MythWeb's connect which was setup to catch the new "client connected" system event. This does not fix cases where MythWeb might receive another backend message while it is connecting, that can only be fixed by a larger more invasive patch. This only fixes the recent issues reported after the system events patch whent into trunk.

References #8084 and Fixes #8117.

Note: See TracTickets for help on using tickets.