Opened 7 years ago

Closed 7 years ago

#9780 closed Bug Report - Hang/Deadlock (Fixed)

Network Remote Control Interface breaks DVD playback

Reported by: dave@… Owned by: markk
Priority: major Milestone: 0.24.1
Component: MythTV - DVD Playback Version: 0.24-fixes
Severity: medium Keywords:
Cc: Ticket locked: no

Description

We use our Android phones as remote controls using the mythmote app that uses the Network Remote Control Interface. DVD's with still frames hang mythfrontend when using this method. If you attempt to play the same DVD using a keyboard with mythmote disconnected the DVD plays fine.

Attachments (2)

mythfrontend.log (6.9 KB) - added by dave@… 7 years ago.
mythfrontend log of attempted DVD playback with mythmote
mythfrontend_full.txt (28.4 KB) - added by dave@… 7 years ago.
mythfrontend log of attempted DVD playback with mythmote with -v playback

Download all attachments as: .zip

Change History (9)

Changed 7 years ago by dave@…

Attachment: mythfrontend.log added

mythfrontend log of attempted DVD playback with mythmote

comment:1 Changed 7 years ago by markk

Status: newinfoneeded_new

I can't reproduce this with master. I'll need the full output of mythfrontend -v playback and a backtrace from the deadlocked frontend.

Changed 7 years ago by dave@…

Attachment: mythfrontend_full.txt added

mythfrontend log of attempted DVD playback with mythmote with -v playback

comment:2 Changed 7 years ago by dave@…

Can you tell me how to get a backtrace please. The instructions at (http://www.mythtv.org/wiki/Debugging#Basic_Backtrace) look to only be for crashes, not hangs.

comment:3 Changed 7 years ago by dave@…

I had an email from the mythmote developer over night and it appears that turning off the 'Status Update Interval' in mythmote prevents the MythTV hang. I assume that a 'Status Update' shouldn't cause Mythtv to hang so I'll leave this issue open but it's probably more a bug with the remote control interface rather than DVD playback.

comment:4 Changed 7 years ago by tom8oe@…

The status update Dave is referring to is a "query location" command sent from mythmote. By default mythmote sends the query location command every 5 seconds to keep track of the connection state. Any recommendations from the mythtv team on a better solution less prone to hanging the frontend? Maybe "query time" or "query version"?

comment:5 Changed 7 years ago by Github

DVDRingBuffer: Unlock the ring buffer when waiting on state changes.

The DVD ringbuffer does not use the read ahead thread and hence holding the writelock during safe_read is not strictly necessary (see RingBuffer::ReadPriv?). DVDRingBuffer::safe_read can also hold that lock for tens of seconds when, for example, displaying a still frame (the dvd device simply returns specific events, but not data, until it is told to skip the still frame).

Under normal operation this is not a problem but events received from external sources (such as network control) can trigger code that tries to lock the ringbuffer from the main UI thread (e.g. RingBuffer::GetFilename?). The lock is not obtained, event processing in the main thread is blocked and the wait state in the ringbuffer thread is not cleared - and the frontend deadlocks as a result.

The solution is to release the lock while sleeping within DVDRingBuffer::safe_read to allow other threads to obtain the lock temporarily. I've also added a warning message should the read ahead thread be running in the DVD ringbuffer.

Refs #9780

Branch: master Changeset: fd5e33a69b630aa9c0b94a8c2dd7693f02726316

comment:6 in reply to:  4 Changed 7 years ago by markk

Replying to tom8oe@…:

Any recommendations from the mythtv team on a better solution less prone to hanging the frontend? Maybe "query time" or "query version"?

This should be fixed in master - it would be helpful if someone else could test - and I'll backport in a few days if it proves to be a stable fix.

comment:7 Changed 7 years ago by markk

Milestone: unknown0.24.1
Resolution: Fixed
Status: infoneeded_newclosed

Fixed in 4dec7cf2c709b3a17c99

Note: See TracTickets for help on using tickets.