[Live-devel] BasicTaskScheduler crashed by clients leaving

avbalen at wxs.nl avbalen at wxs.nl
Thu Mar 24 18:29:21 PST 2005


Hi Everyone,

I found a problem that the BasicTaskScheduler sometimes crashes 
(access violation) when a client closes a RTSP session, i.e. when the 
destructor of RTSP session is called. See this stacktrace, where I 
have set a breakpoint in HandlerSet::removeHandler

MyApp.exe!HandlerSet::removeHandler(int socketNum=272)  Line 129
MyApp.exe!BasicTaskScheduler::turnOffBackgroundReadHandling(int 
socketNum=272)  Line 126
MyApp.exe!RTSPServer::RTSPClientSession::~RTSPClientSession()  Line 
242 + 0x26
MyApp.exe!RTSPServer::RTSPClientSession::`scalar deleting 
destructor'()  + 0x16
MyApp.exe!RTSPServer::RTSPClientSession::incomingRequestHandler1()  
Line 361 + 0x40
MyApp.exe!RTSPServer::RTSPClientSession::incomingRequestHandler(void * 
instance=0x00cb24d8, int __formal=2)  Line 272
MyApp.exe!BasicTaskScheduler::SingleStep(unsigned int maxDelayTime=0)  
Line 104 + 0x17
MyApp.exe!BasicTaskScheduler0::doEventLoop(char * 
watchVariable=0x006826d8)  Line 74 + 0xf
MyApp.exe!CMediaServer::Run()  Line 274 + 0x28
MyApp.exe!CMyApp::Run(int n=0)  Line 60
MyApp.exe!ATL::CAtlServiceModuleT<CMyApp,101>::ServiceMain(unsigned 
long dwArgc=1, char * * lpszArgv=0x0015cb00)  Line 3561 + 0xa
MyApp.exe!ATL::CAtlServiceModuleT<CMyApp,101>::_ServiceMain(unsigned 
long dwArgc=1, char * * lpszArgv=0x0015cb00)  Line 3874
advapi32.dll!77deb48b() 	
kernel32.dll!7c80b50b() 	
kernel32.dll!7c8399f3() 	
advapi32.dll!77deb479() 	

removeHandler uses a locally declared HandlerIterator to remove the 
handler for the socket the client is using from the scheduler's list.
After this has been done, the scheduler resumes iterating over the 
remaining handlers. Fine except that the (again locally) declared 
HandlerIterator can point to the just-removed item... The result is an 
access violation in the HandlerIterator::next code, see this stack 
trace:

MyApp.exe!HandlerIterator::next()  Line 157 + 0x8
MyApp.exe!BasicTaskScheduler::SingleStep(unsigned int maxDelayTime=0)  
Line 100 + 0xb
MyApp.exe!BasicTaskScheduler0::doEventLoop(char * 
watchVariable=0x006826d8)  Line 74 + 0xf
MyApp.exe!CMediaServer::Run()  Line 274 + 0x28
MyApp.exe!CMyApp::Run(int n=0)  Line 60
MyApp.exe!ATL::CAtlServiceModuleT<CMyApp,101>::ServiceMain(unsigned 
long dwArgc=1, char * * lpszArgv=0x0015cb00)  Line 3561 + 0xa
MyApp.exe!ATL::CAtlServiceModuleT<CMyApp,101>::_ServiceMain(unsigned 
long dwArgc=1, char * * lpszArgv=0x0015cb00)  Line 3874	
advapi32.dll!77deb48b() 	
kernel32.dll!7c80b50b() 	
kernel32.dll!7c8399f3() 	
advapi32.dll!77deb479() 	


This on Live.2004.12.23.
Question to the list therefore: has someone else seen this behaviour?
Second question: what would be an elegant way to fix this?

Best regards,
Auke




More information about the live-devel mailing list