Opened 13 years ago

Closed 13 years ago

#1967 closed defect (fixed)

mythbackend crash during start up (upnp)

Reported by: jwestfall@… Owned by: dblain
Priority: minor Milestone: unknown
Component: mythtv Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Hi

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 ))
  {
   ...
  }
  else
  {
            // ------------------------------------------------------
            // It's taking longer than 5 seconds to initialize this thread....
            // 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;
                                            m_wait.wakeAll();
                                          }
  return( m_wait.wait( time ) );
}

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

Attachments (2)

gdb.txt (1.2 KB) - added by jwestfall@… 13 years ago.
backend.txt (874 bytes) - added by jwestfall@… 13 years ago.

Download all attachments as: .zip

Change History (4)

Changed 13 years ago by jwestfall@…

Attachment: gdb.txt added

Changed 13 years ago by jwestfall@…

Attachment: backend.txt added

comment:1 Changed 13 years ago by dblain

Owner: changed from Isaac Richards to dblain

comment:2 Changed 13 years ago by dblain

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.