﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	mlocked
10870	Race condition between StreamHandler::RemoveListener and StreamHandler::AddListener	roger@…	danielk	"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 return.


"	Bug Report - Hang/Deadlock	closed	critical	0.26	MythTV - General	0.25-fixes	medium	fixed	AddListener RemoveListener		0
