[mythtv-commits] Ticket #10870: Race condition between StreamHandler::RemoveListener and StreamHandler::AddListener

MythTV noreply at mythtv.org
Fri Jun 29 10:58:48 UTC 2012

#10870: Race condition between StreamHandler::RemoveListener and
 Reporter:  roger@…                  |           Type:  Bug Report -
   Status:  new                      |  Hang/Deadlock
Milestone:  unknown                  |       Priority:  minor
  Version:  0.25-fixes               |      Component:  MythTV - General
 Keywords:  AddListener              |       Severity:  medium
  RemoveListener                     |  Ticket locked:  0
 There is a race condition when a thread calls StreamHandler::AddListener
 when a parallel executing thread has already called
 AddListener::RemoveListener. This results in both threads being deadlocked
 and never returning from these calls. The error message "Programmer Error:
 Start called before Stop finished" is also logged. The symptoms of this
 problem are recordings appearing in the completed recordings list which
 either have no file associated with them or a file with only a few bytes
 (usually 326 I think) in it.

 I have attached a log showing this problem. This log is from mythbackend
 running on a quad core machine.

 The backend is attempting to record two programs with the same start time
 on the same DTV multiplex. The capture cards are configured to allow
 multiple simultaneous recordings. The salient log lines are at

 2012-06-26 21:00:02.354383 I [2501/2511] TVRecEvent streamhandler.cpp:97
 (RemoveListener) - SH(/dev/dvb/adapter201/frontend0):
 RemoveListener(0xffffffffa1031e80) -- begin

 The thread 2511 will end up blocked in StreamHandler::Stop and never
 return, and

 2012-06-26 21:00:02.369020 I [2501/2706] RecThread streamhandler.cpp:45
 (AddListener) - SH(/dev/dvb/adapter201/frontend0): AddListener(0x972e448)
 -- begin

 The thread 2706 will end up blocked in StreamHandler:Start and never

Ticket URL: <http://code.mythtv.org/trac/ticket/10870>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center

More information about the mythtv-commits mailing list