[mythtv-commits] Ticket #5591: Fix ThreadedFileWriter potential deadlock

MythTV mythtv at cvs.mythtv.org
Thu Jul 31 04:36:33 UTC 2008


#5591: Fix ThreadedFileWriter potential deadlock
------------------------------+---------------------------------------------
 Reporter:  jppoet at gmail.com  |       Owner:  ijr    
     Type:  patch             |      Status:  new    
 Priority:  major             |   Milestone:  unknown
Component:  mythtv            |     Version:  unknown
 Severity:  medium            |     Mlocked:  0      
------------------------------+---------------------------------------------
 If ThreadedFileWriter::Write() is fed more data than can fit into it's
 internal buffer, it will deadlock.  ThreadedFileWriter::Write() will block
 waiting for BufFree() to be greater than the data to be written, but that
 will never happen.

 The attached patch creates a loop in ThreadedFileWriter::Write() to
 process the fed data into the internal buffer as space becomes available.
 This can cause ThreadedFileWriter::Write() to take longer to return, but
 as long as the recorder has a big enough buffer (or uses
 DeviceReadBuffer), then it should not be a problem.

 The other option is for ThreadedFileWriter::Write() to only process as
 much as it can in one pass, then return that amount to the calling
 function.  However, this causes a problem with keyframes. Since
 "recorders" need to note the position in the file where keyrframes are
 written, if they don't actually get written, then the position would be
 wrong.

 I found this problem with recording from the HD-PVR.  I was experiencing
 deadlocks in about 1:10 recordings.

-- 
Ticket URL: <http://svn.mythtv.org/trac/ticket/5591>
MythTV <http://www.mythtv.org/>
MythTV


More information about the mythtv-commits mailing list