[mythtv] Ticket #9885: Deadlock on slave backend disconnect

Ian Dall ian at beware.dropbear.id.au
Tue Jul 12 08:46:21 UTC 2011

On Sat, 2011-07-09 at 13:10 +0000, MythTV wrote:
> #9885: Deadlock on slave backend disconnect
> -------------------------------------------------+-------------------------
>  Reporter:  Ian Dall <ian@…>                     |          Owner:
>      Type:  Bug Report - General                 |         Status:  new
>  Priority:  major                                |      Milestone:  unknown
> Component:  MythTV - General                     |        Version:  Trunk
>  Severity:  medium                               |  Head
>  Keywords:                                       |     Resolution:
>                                                  |  Ticket locked:  0
> -------------------------------------------------+-------------------------
> Comment (by danielk):
>  Ian, Janathan's patch is more of a debugging patch, it just disables a bit
>  of code. And can't be applied as is.

Really? Its not how I understand the patch, 'though I admit my
understanding might be faulty ;-(

The problem seems to be that a slave disconnect happens, asynchronously,
when Scheduler::run() is already holding schedlock. Slave disconnect
handling needs schedlock to run but schedlock can't be released until
the slave disconnect handling is finished.

The patch apparently employs a strategy of deferring handling the slave
disconnect and instead inserting an event to trigger handling the slave
disconnect synchronously (when Scheduler::run() releases the

As far as I can see code is /moved/ from MainServer::connectionClosed to
a new function MainServer::HandleSlaveDisconnectedEvent rather than

I'm not claiming the patch is bug free necessarily. I don't understand
the offlineEncoderIDs.push_back() bit for one and I doubt I fully
understand the semantics of the event handling, But it doesn't seem to
me that "just disables a bit of code" is an accurate characterisation!


More information about the mythtv-dev mailing list