Opened 9 years ago

Closed 9 years ago

#9057 closed defect (Fixed)

RemoteFile deadlock

Reported by: stuartm Owned by: stuartm
Priority: critical Milestone: 0.24
Component: MythTV - General Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

I can reliably reproduce a deadlock in RemoteFile? if the connection/transfer is allowed to time out. In this case it does so because we're trying to play a recording from a drive which is in standby and is spinning up.

2010-10-05 10:54:28.920 TV: Attempting to change from None to WatchingPreRecorded
2010-10-05 10:54:28.921 SendReceiveStringList(QUERY_CHECKFILE,0...) called from UI thread
2010-10-05 10:54:35.929 MythSocket(3fa5570:61): readStringList: Error, timed out after 7000 ms.
2010-10-05 10:54:35.929 RemoteFile::openSocket(file data socket), Error: Did not get proper response from 192.168.159.2:6543
2010-10-05 10:54:35.929 RemoteFile::openSocket(file data socket), Error: Failed to open socket, error was invalid response

Backtrace attached.

N.B. There appears to be a change of behaviour wrt to timeouts that probably deserves another ticket, we used to wait for the drive in the past.

Attachments (2)

backtrace.txt (15.0 KB) - added by stuartm 9 years ago.
Backtrace
remotefile_deadlock.diff (1.0 KB) - added by stuartm 9 years ago.
Possible fix

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by stuartm

Attachment: backtrace.txt added

Backtrace

comment:1 Changed 9 years ago by stuartm

Owner: set to stuartm
Status: newaccepted

This one is pretty obvious, we call Close() in openSocket() if an error occurred, but Open() is still holding the lock which Close() requires.

Changed 9 years ago by stuartm

Attachment: remotefile_deadlock.diff added

Possible fix

comment:2 Changed 9 years ago by stuartm

Possible fix attached, needs to be reviewed by someone familiar with RemoteFile?.

comment:3 Changed 9 years ago by stuartm

Resolution: Fixed
Status: acceptedclosed

(In [26656]) Fix a frontend deadlock in the RemoteFile? socket code should we fail to open a socket successfully. This could be because the backend is waiting on a drive to spin up before responding which would exceed the 7 second timeout. Signed off by Chris Pinkham since he knows this code better than I do. Fixes #9057

Note: See TracTickets for help on using tickets.