[mythtv-commits] Ticket #1967: mythbackend crash during start up (upnp)

MythTV mythtv at cvs.mythtv.org
Sun Jun 18 18:18:02 UTC 2006

#1967: mythbackend crash during start up (upnp)
 Reporter:  jwestfall at surrealistic.net  |       Owner:  ijr 
     Type:  defect                      |      Status:  new 
 Priority:  minor                       |   Milestone:      
Component:  mythtv                      |     Version:  head
 Severity:  medium                      |  

 I am seeing a crash on start up on one of my backends.  I will attach
 gdb/backend.  The issue is related to upnp starting up worker threads.

 In ThreadPool::AddWorkerThread() the following is timing out

   if (pThread->WaitForInitialized( 5000 ))
             // ------------------------------------------------------
             // It's taking longer than 5 seconds to initialize this
             // give up on it.
             // (This should never happen)
             // ------------------------------------------------------

             delete pThread;
             pThread = NULL;

 Deleting the pThread object while the thread exists causes the crash when
 the thread goes to access it.

 I think I got the timeout tracked down to CEvent::WaitForEvent(timeout)
 missing events/signals.

 I believe the following is happening.

       Thread 1 (main thread)                Thread 2 (new worker thread)
 bool CEvent::WaitForEvent(time) {
   if (IsSignaled())
     return( true );
                                           bool CEvent::SetEvent() {
                                             m_bSignaled = true;
   return( m_wait.wait( time ) );


 The wakeAll() can happen before WaitForEvent() gets to its wait(), causing
 the timeout and thus missing the event/signal.

Ticket URL: <http://cvs.mythtv.org/trac/ticket/1967>
MythTV <http://www.mythtv.org/>

More information about the mythtv-commits mailing list