[mythtv-commits] Ticket #11777: Frontend stops receiving Events from backend
MythTV
noreply at mythtv.org
Wed Sep 18 13:39:43 UTC 2013
#11777: Frontend stops receiving Events from backend
----------------------------------+-----------------------------
Reporter: stuartm | Owner: stuartm
Type: Bug Report - General | Status: new
Priority: blocker | Milestone: 0.27
Component: MythTV - General | Version: Master Head
Severity: high | Resolution:
Keywords: | Ticket locked: 0
----------------------------------+-----------------------------
Comment (by stuartm):
The underlying cause here seems to be a race condition.
{{{
Sep 17 18:19:46 mythfrontend[2409]: D MythSocketThread(-1)
mythsocket.cpp:286 (CallReadyReadHandler) MythSocket(ffffffffabe25b10:60):
calling m_callback->readyRead()
Sep 17 18:19:46 mythfrontend[2409]: I MythSocketThread(-1)
mythsocket.cpp:908 (ReadStringListReal) MythSocket(ffffffffabe25b10:60):
read <- 60 2 OK
Sep 17 18:20:16 mythfrontend[2409]: E MythSocketThread(-1)
mythsocket.cpp:776 (ReadStringListReal) MythSocket(ffffffffabe25b10:60):
ReadStringList: Error, timed out after 30000 ms.
Sep 17 18:20:16 mythfrontend[2409]: D MythSocketThread(-1)
mythsocket.cpp:265 (AboutToCloseHandler)
MythSocket(fffffmythfrontend[2409]: D MythSocketThread(-1)
mythsocket.cpp:258 (DisconnectHandler) MythSocket(ffffffffabe25b10:-1):
calling m_callback->connectionClosed()
Sep 17 18:20:16 mythfrontend[2409]: N MythSocketThread(-1)
mythcorecontext.cpp:1179 (connectionClosed) Event socket closed. No
connection to the backend.
Sep 17 18:20:16 mythfrontend[2409]: I MythSocketThread(-1)
mythcorecontext.cpp:1240 (dispatch) MythEvent: BACKEND_SOCKETS_CLOSED
}}}
MythSocket::CallReadyReadHandler() alludes to this possibility but in
reverse:
{{{
// Because the connection to this is a queued connection the
// data may have already been read by the time this is called
// so we check that there is still data to read before calling
// the callback.
}}}
So what happens is this: SendReceiveStringList() is called with
ALLOW_SHUTDOWN, before it can read the reply the readRead() callback is
triggered by the QTCPSocket readyRead() signal, the callback then reads
the result, leaving zero bytes available for SendReceiveStringList() which
waits 30 seconds for data which isn't coming before it times out and
closes the socket.
The problem is that an Event socket, which uses the callbacks, shouldn't
be used by SendRecieveStringList() and the specific instance in this log
has now been fixed. A control socket does NOT use the callbacks and
wouldn't be affected. There still needs to be a guard against this
happening in the code, what I'm currently thinking about doing is checking
whether the callbacks are set in SendReceiveStringList() and throwing
errors ("Programmer error") before returning without handling the request.
However this may break something else so I'm uncertain of it's suitability
for inclusion in 0.27.
--
Ticket URL: <http://code.mythtv.org/trac/ticket/11777#comment:8>
MythTV <http://www.mythtv.org>
MythTV Media Center
More information about the mythtv-commits
mailing list