Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#7988 closed defect (fixed)

Deadlock in DVBChannel

Reported by: Mark Spieth Owned by: Janne Grunau
Priority: minor Milestone: 0.23
Component: MythTV - DVB Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

there is a suspected deadlock in dvbchannel.

backtrace attached using gcore proposed solution patch attached.

Attachments (2)

gcore.log.1264390476.gz (10.6 KB) - added by Mark Spieth 10 years ago.
backtrace
mythtv-deadlock-fix.patch (742 bytes) - added by Mark Spieth 10 years ago.
proposed solution

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by Mark Spieth

Attachment: gcore.log.1264390476.gz added

backtrace

Changed 10 years ago by Mark Spieth

Attachment: mythtv-deadlock-fix.patch added

proposed solution

comment:1 Changed 10 years ago by danielk

Component: MythTV - GeneralMythTV - DVB
Owner: changed from Isaac Richards to Janne Grunau

comment:2 Changed 10 years ago by Mark Spieth

symptom is that the backend stops responding.

search for "this=0xa7ba90|mtx = 0xa7bb5[89]"

4 threads want this lock. the one that has it is the TVRec::RunTV TVRec::StartRecording? thread which should be ok Expirer thread and HttpStatus? request handling thread.

it appears as though the RunTV thread is wating for hwlock but cant get it which means one of the other threads may be holding it.

I suspect DVBChannel hwlock should be inited as QMutex::Recursive that should fix this. will test but it doesn't happen often so feedback will take a while.

comment:3 Changed 10 years ago by Janne Grunau

Milestone: unknown0.23
Status: newaccepted
Version: unknownhead

Yes, a recursive look would fix it. The locking in DVBChannel is incorrect. Open() calls Close() when InitializeInputs?() fails and both try hold hw_lock.

I'll commit the patch. The recursive Mutex is imho less ugly than the code duplication.

comment:4 Changed 10 years ago by Janne Grunau

Resolution: fixed
Status: acceptedclosed

(In [23838]) DVBChannel: make hw_lock recursive, Fixes #7988

Open() calls Close() in error paths and both try to lock hw_lock Patch by: Mark Spieth

comment:5 Changed 10 years ago by Janne Grunau

(In [23839]) Backports [23838] from trunk

DVBChannel: make hw_lock recursive, Fixes #7988 Open() calls Close() in error paths and both try to lock hw_lock Patch by: Mark Spieth

Note: See TracTickets for help on using tickets.