TSWriter deadlock potential fix. (1 Viewer)

DJBlu

Portal Pro
August 14, 2007
1,670
813
Llanelli
United Kingdom United Kingdom
Country flag
Hi,

This thread has been opened so we can get to the root of the problem so we can introduce the fix.

The following TSWriter is for 1.3.0 Beta.

To use and test.

Stop TV Server.
Make a backup of your original TSWriter.ax
Download the attached TSWriter.zip and extract the file to [%Program Files%]/Team MediaPortal/TV Server/
Start the TV Server.
Wait till/if the error occurs again.
Upload your TV.log and TSWriter.log to this thread.

The more logs we get the better.

TSWriter.ax

v1 Initial Test [FILE DELETED: superseded]
v2 Loop catcher in EPG Decoder sub. [FILE DELETED: superseded]
v3 Additional locks to make the TSWriter thread safe. [FILE DELETED: superseded]
v4 Edited out commented line in EPG Decoder which was setting m_bParseEPG=false. Changed the CRC32 value storage from int to DWORD. Checked all locks to ensure they should be there. [FILE DELETED: superseded]
v5 Diskrecorder wasn't updating continuity counter on a stream if it became encrypted/corrupt. [FILE DELETED: superseded]
v6 Removed v5 changes, removed an autolock in the filter interface. [FILE DELETED: superseded]
v7 Removed cascaded Autolock in GetTSChannel from TSWriter. [FILE DELETED: superseded]
v8 Added Critical Section lock to Audio Video Analyzer. [FILE DELETED: superseded]
v9 Added Critical Section lock to PMT grabber.
v10 Removed 2 Autolocks from AddChannel/RemoveChannel from TSChannel
v11 Added further locks
v12 Added EPG grabber abort when all channels are deleted.
MPFileWriter.ax
v13 Added extra logging in EPG Decoder to trap deadlock.

v1 Removed Autolock from filter interface. [FILE DELETED: superseded]
v2 Removed potential Autolock cascade

EDIT: Patched installer files for MP 1.5.0 Pre-release are here - https://forum.team-mediaportal.com/...ock-potential-fix.114898/page-24#post-1027981

EDIT: Patch files for MP 1.5.0 Final are here - https://forum.team-mediaportal.com/...ock-potential-fix.114898/page-26#post-1030415
 

Attachments

Last edited by a moderator:

ramu

Portal Pro
July 15, 2008
190
7
Country flag
Hi,

here is the first result and a little bit history to that thread:

1. I changed from normal EPG to webEPG and had no crashes afterwarts
2. Some days ago I updated to 1.3.0 beta, this version also runs over days!
3. There I had no problems with crashes and also normal EPG worked well
4. My only BIG problem was that dvb-S card stopped scanning after some channels and reported "nothing found", just discussing with mm
5. Today I changed tswriter.ax as described before
6. Had no problems scanning dvb-s, everything works well for some minutes
7. After about 5-10 min tvserver crashes without visible error messages and vanishes from MS task manager
8. So, i'll attach the logfiles and rechanged tswriter.ax to the orignial file from 1.3.0 beta

So I hope MP will stay stable now...

ramu
 

DJBlu

Portal Pro
August 14, 2007
1,670
813
Llanelli
United Kingdom United Kingdom
Country flag
Hi,

Thanks for the logs.

I have uploaded a v2 of the TSWriter. If you could give it a try and report back I would appreciate it thanks.
 

ramu

Portal Pro
July 15, 2008
190
7
Country flag
Ok, here are the logs. Tvserver crashed after second try to watch dvb-s....

By the way first try didn't run so I changed twice th etswriter.ax versions....

Last log entries are Your version.
 

stevie77

Portal Member
June 21, 2007
24
8
Austria Austria
Hi DJBlu,
I think i've already tracked down the problem. Tswriter in general is not threadsafe while accessing subchannels. Currently only the selection of subchannels ("GetTschannel") is protected. But this way subchannels may get destroyed while other threads are still acccessing it or before callbacks get resetted.

I've moved the critical section protection ("CAutoLock lock(&m_Lock)") from GetTsChannel to every interface function that uses it and haven't got any deadlocks using my personal version for months now.

I may provide source code and a compiled version of tswriter if someone likes to test.
 
Last edited:

DJBlu

Portal Pro
August 14, 2007
1,670
813
Llanelli
United Kingdom United Kingdom
Country flag
Thanks

Uploaded a new file to first post if everyone can test please.

Changes committed and pushed to git.
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

OP Similar threads Forum Replies Date
N Tswriter Watch / Listen Media 51
doskabouter No guide info added due to a MYSQL deadlock Electronic Program Guide 1
Similar threads


Top Bottom