[mythtv] [PATCH] Possible fix for mutex destroy failure problem
jgillis at acm.org
Sat Apr 9 03:22:05 UTC 2005
I've worked up a possible fix for the "Mutex destroy failure" problem on the
master backend that comes up when a slave backend disconnects at the wrong
What is happening is that MainServer::endConnection() is destroying the
PlaybackSock instance before the PlaybackSock::SendReceiveStringList()
function is able to return. Once control goes back to
PlaybackSock::SendReceiveStringList(), all the resources have been deleted
with the object instance, so a seg fault occurs.
This patch attempts the following:
o Adds a isBusy() method to PlaybackSock
o Adds a markForDestruction() method to PlaybackSock
o Adds a signal to PlaybackSock (destroyConnect) to allow it to notify
MainServer that it is ready to be deleted
o Teaches MainServer::endConnection() about the possibility that a
PlaybackSock could be busy. In that case, call (*it)->markForDestruction()
to let the PlaybackSock know that it should emit it's signal next time it
has a chance.
o Teaches PlaybackSock::SendReceiveStringList() to
emit(destroyConnect(sock)) when it sees that it's marked for destruction
The only problem that I've seen in testing is the following mythbackend
output from Qt:
ASSERT: "i <= nodes" in /usr/qt/3/include/qvaluelist.h (373)
Obviously, someone is getting removed somewhere and not telling the right
people, but I'm not able to track it down.
In any case, the patch does resolve the seg fault problem for the specific
case I tested (slave disconnects before responding to QUERY_FREESPACE), so
maybe it's a good place to start.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 6005 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20050408/92a9e29d/mutexdestroy.obj
More information about the mythtv-dev