Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#9275 closed Patch - Bug Fix (Fixed)

[PATCH][HANG] Backend deadlock when frontend playing video disappears from network

Reported by: doug@… Owned by: cpinkham
Priority: trivial Milestone: 0.25
Component: MythTV - General Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

I have encountered the following deadlock when a frontend is streaming video from the backend over a wifi link that suddenly goes down:

Thread 5 (Thread 0xabfd7b70 (LWP 9047)):
#0  0xb786d424 in __kernel_vsyscall ()
#1  0xb418ef95 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0xb42fc61b in QWaitCondition::wait(QMutex*, unsigned long) ()
   from /usr/lib/qt4/libQtCore.so.4
#3  0xb42f662b in QReadWriteLock::lockForWrite() ()
   from /usr/lib/qt4/libQtCore.so.4
#4  0x080d510a in MainServer::connectionClosed (this=0x8d0af28, 
    socket=0xa8e04ef0) at mainserver.cpp:5436
#5  0xb613f6a7 in MythSocket::close (this=0xa8e04ef0) at mythsocket.cpp:200
#6  0xb61f8906 in MSocketDevice::writeData (this=0xa8e04ef0, 
    data=0x909d4c0 "39      ERROR: Unknown file transfer socket: 50", len=47)
    at msocketdevice_unix.cpp:906
#7  0xb4391f11 in QIODevice::write(char const*, long long) ()
   from /usr/lib/qt4/libQtCore.so.4
#8  0xb62a5974 in MSocketDevice::writeBlock (this=0xa8e04ef0, 
    data=0x909d4c0 "39      ERROR: Unknown file transfer socket: 50", len=47)
    at ../libmythdb/msocketdevice.h:111
#9  0xb614088c in MythSocket::writeBlock (this=0xa8e04ef0, 
    data=0x909d4c0 "39      ERROR: Unknown file transfer socket: 50", len=47)
    at mythsocket.cpp:259
#10 0xb614224d in MythSocket::writeStringList (this=0xa8e04ef0, list=...)
    at mythsocket.cpp:332
#11 0x080ab5cb in MainServer::SendResponse (this=0x8d0af28, socket=0xa8e04ef0, 
    commands=...) at mainserver.cpp:1509
#12 0x080ce358 in MainServer::HandleFileTransferQuery (this=0x8d0af28, 
    slist=..., commands=..., pbs=0x915be40) at mainserver.cpp:4830
#13 0x0809e3db in MainServer::ProcessRequestWork (this=0x8d0af28, 
    sock=0xa8e04ef0) at mainserver.cpp:554
#14 0x0809be54 in MainServer::ProcessRequest (this=0x8d0af28, sock=0xa8e04ef0)
    at mainserver.cpp:309
#15 0x080dbf6d in ProcessRequestThread::run (this=0x8cfc1c8)
    at mainserver.cpp:159
#16 0xb42fb66f in ?? () from /usr/lib/qt4/libQtCore.so.4
#17 0xb418a8fe in start_thread () from /lib/libpthread.so.0
#18 0xb3fd695e in clone () from /lib/libc.so.6

The problem occurs due to a double locking of sockListLock (within MainServer::HandleFileTransferQuery? and also within the error handling callback MainServer::connectionClosed. The attached patch moves the unlock to before the call to SendResponse?, which avoids the issue.

Attachments (1)

disappearing_frontend_deadlock.patch (603 bytes) - added by doug@… 14 years ago.
Proposed fix

Download all attachments as: .zip

Change History (5)

Changed 14 years ago by doug@…

Proposed fix

comment:1 Changed 14 years ago by robertm

Owner: set to cpinkham
Status: newassigned

comment:2 Changed 14 years ago by beirdo

Summary: Backend deadlock when frontend playing video disappears from network[PATCH][HANG] Backend deadlock when frontend playing video disappears from network

comment:3 Changed 13 years ago by stuartm

Milestone: unknown0.25
Resolution: Fixed
Status: assignedclosed

comment:4 Changed 13 years ago by stuartm

Can I just say thanks to Doug for submitting this ticket and patch. I didn't see this ticket until after I had already fixed the problem and we're sorry it was overlooked for 8 months.

Note: See TracTickets for help on using tickets.