Opened 8 years ago

Closed 8 years ago

#10264 closed Bug Report - Hang/Deadlock (fixed)

deadlock in backend

Reported by: brian@… Owned by: danielk
Priority: major Milestone: 0.25
Component: MythTV - General Version: Master Head
Severity: high Keywords:
Cc: Ticket locked: no

Description

I seem to have discovered a new deadlock in master (v0.25pre-3930-g074d3e2). I will attach two stack traces of the backend while deadlocked. The symptoms are that clients cannot seem to get information from the backend. A mythtv client spins for a while and then shows no recordings at all. A mythweb client reports:

Warning at /usr/share/mythtv/mythweb/modules/tv/upcoming.php, line 91:
!!NoTrans: Invalid argument supplied for foreach()!!

Attachments (3)

ThreadStacktrace.txt.old (120.0 KB) - added by brian@… 8 years ago.
stack trace of deadlocked threads
ThreadStacktrace.txt (114.4 KB) - added by brian@… 8 years ago.
stack trace of deadlocked threads
10264-v1.patch (1.0 KB) - added by danielk 8 years ago.
Possible fix.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by brian@…

Attachment: ThreadStacktrace.txt.old added

stack trace of deadlocked threads

Changed 8 years ago by brian@…

Attachment: ThreadStacktrace.txt added

stack trace of deadlocked threads

comment:1 Changed 8 years ago by danielk

Milestone: unknown0.25
Owner: set to danielk
Priority: minormajor
Severity: mediumhigh
Status: newassigned

Looking at ThreadStacktrace?.txt I see:

Threads 13,12,11,10,9,8,7,6 are all waiting for the schedLock in Scheduler::GetAllPending?() Threads 5,3 are both waiting for the schedLock in Scheduler::GetRecording?() Thread 26 is holding the schedLock and blocking on TVRec::StartRecording?()

I suspect what is holding up the TVRec::StartRecording?() is the RecorderBase::GetRecordingQuality?() call in Thread 39.

Changed 8 years ago by danielk

Attachment: 10264-v1.patch added

Possible fix.

comment:2 Changed 8 years ago by danielk

I've attached a patch. It looks like I made a copy-n-paste error, but if someone could do a quick code review I'd appreciate it.

comment:3 Changed 8 years ago by Github

Resolution: fixed
Status: assignedclosed

Fixes #10264. Removes infinite loop.

There were two copy-n-paste errors, one on the bounds check and we were also deleting elements from the wrong end of the deque. The bounds check caused the infinite loop under certain starting conditions.

Branch: master Changeset: 6b227f42bbd03e351a757d2077bcc3f40116b5c6

Note: See TracTickets for help on using tickets.