Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#7132 closed defect (fixed)

Deadlock in MpegRecorder::StopRecording() with HD-PVR

Reported by: jst-myth@… Owned by: danielk
Priority: major Milestone: 0.22
Component: MythTV - Recording Version: head
Severity: high Keywords:
Cc: Ticket locked: no


I've been seeing an occasional deadlock (anywhere from several times per day to every few days) in MpegRecorder::StopRecording?() that leaves the backend unable to record any more shows, or unable to serve content, answer to mythweb, etc. I've tracked it down to a deadlock that happens when StartEncoding?() fails, when called from MpegRecorder::StartRecording?(). In my particular case I'm using an HD-PVR and it seems to occasionally fail to start recording (why is still unclear, beyond that an ioctl() call failing), and when that happens, MpegRecorder::StopRecording?() gets stuck waiting on a conditional variable that's never notified on. The problem seems to be that the recording has already ended, but the "encoding" member was never unset, so MpegRecorder::StopRecording?() waits for a notification that's supposed to be sent when we're done recording etc. While I was looking through this code I also found a memory leak (and another instance of this same deadlock AFAICT) in MpegRecorder::StartRecording?(), which I also fixed.

Please see attached patch.

Attachments (1)

hdpvr-deadlock-fix (1.3 KB) - added by jst-myth@… 12 years ago.
Deadlock fix.

Download all attachments as: .zip

Change History (4)

Changed 12 years ago by jst-myth@…

Attachment: hdpvr-deadlock-fix added

Deadlock fix.

comment:1 Changed 12 years ago by danielk

Milestone: unknown0.22
Status: newaccepted
Version: unknownhead

comment:2 Changed 12 years ago by danielk

Resolution: fixed
Status: acceptedclosed

(In [22044]) Fixes #7132. Fixes deadlock following improper handling of two error conditions in StartRecording?(). Also fixes a race condition on same variables.

comment:3 Changed 12 years ago by jst-myth@…

Thanks for landing this (and fixing it up)!

Note: See TracTickets for help on using tickets.