Freeze when trying to enter Live TV at random times (1 Viewer)

wanderingtripod

Portal Member
November 19, 2011
5
0
Home Country
MediaPortal Version: 1.2.1
MediaPortal Skin: StreamedMP
Windows Version: Windows 7 x64
CPU Type: Phenom II X2 955 BE
HDD: Samsung Spinpoint F3 1TB + 2TB Seagate Green
Memory: 4GB DDR3
Motherboard: Gigabyte GA-880GM-USB3
Video Card: ATi HD 4250 (onboard)
Video Card Driver: Catalyst 11.1
Sound Card: Realtek ALC889 (via optical out)
Sound Card Driver: 6.00.001.6235
1. TV Card: Leadtek DTV2000DS (dual tuner)
1. TV Card Type: DVB-T
1. TV Card Driver: 9.603.1.1028
MPEG2 Video Codec: ffdshow video decoder
MPEG2 Audio Codec: ffdshow audio decoder
h.264 Video Codec: ffdshow DXVA
HTPC Case: Antec Fusion Remote
Remote: iMon
TV - HTPC Connection: HDMI -> HDMI

Hello, having this problem for a while now. At seemingly random times, (though I usually encounter the issue after the HTPC has been idle for a while), mediaportal will freeze when trying to enter/start live tv, and require the process to be killed. Restarting the tv server seems to fix it however.

Tried fiddling with the codecs used, disabling standby/hibernate, disabling EPG grabbing, and setting up TV server to use the microsoft loopback adapter, though these didn't seem to solve it and the issue reoccured. Not sure what else I can try now. Logs attached, however these were created after the issue reoccured since I can't reproduce the bug at will, (killed mediaportal.exe and restarted mediaportal in debug mode, then tried to watch live TV, froze trying to enter it, after which I killed the process again, hopefully they help).
 

m.woessner

Portal Member
November 8, 2006
32
3
Home Country
Germany Germany
AW: Confirmed -> Deadlock in TvDvbChannel()/CMpTs::AddChannel

Hi altogether,

looks like this is exactly the same problem which was also reported by mrkaras.

I have that problem also on a stand alone TVServer (which is virtualized with VMware ESXi 4.1).
Problem happens both with MP 1.2.1 and MP 1.2.2.

At random times when TVServer is idle it stops providing live tv.
In that case killing TVService process gives me a BSOD 0x00000050 (PAGE_FAULT_IN_NONPAGED_AREA)

Currently I have that daily so I am able to reproduce it to some extent!

tv.log always shows the same pattern:

No deadlock:

2012-01-27 21:25:52.393554 [(21)]: dvb:GetNewSubChannel:0 #0
2012-01-27 21:25:52.714843 [(21)]: TvDvbChannel ctor new subchIndex:0


Deadlock:

2012-01-28 07:26:14.299804 [(24)]: dvb:GetNewSubChannel:0 #5
(no more log messages from that thread after that)


I tried to drill this down (by adding debug messages) and found that it happens exactly here:

TvDbChannel.cs, Line 185, TvDbChannel ctor

_tsFilterInterface.AddChannel(ref _subChannelIndex);

As far as I can seen, this is a call of:

(file TSWriter.cpp)

STDMETHODIMP CMpTs::AddChannel( int* handle)
{
CAutoLock lock(&m_Lock);
HRESULT hr;
CTsChannel* channel = new CTsChannel(GetOwner(), &hr,m_id);
*handle=m_id;
m_id++;
m_vecChannels.push_back(channel);
return S_OK;
}


If someone could provide a debug version of TsWriter.ax (with added logging) I would be happy to investigate further.
Unfortunately (even while I know C++ and C#) I currently do not have the time to set up a build environment for the C++ parts of the project.

I hope I could help!

Markus
 

wanderingtripod

Portal Member
November 19, 2011
5
0
Home Country
Well, at least now that it seems to be an actual issue, I can stop trying to fiddle with every setting in an attempt to fix it on my end :p
 

Owlsroost

Retired Team Member
  • Premium Supporter
  • October 28, 2008
    5,540
    5,038
    Cambridge
    Home Country
    United Kingdom United Kingdom
    Re: AW: Confirmed -> Deadlock in TvDvbChannel()/CMpTs::AddChannel

    If someone could provide a debug version of TsWriter.ax (with added logging) I would be happy to investigate further.
    Unfortunately (even while I know C++ and C#) I currently do not have the time to set up a build environment for the C++ parts of the project.

    I hope I could help!

    Markus

    It sounds like it would be really helpful if you could find the time :) (it's not that complicated to build a filter, they are all in one self-contained project - it just needs the MS SDK's installing, a few environment variables setting up and VC2010/VC2010 Express).

    Tony
     

    m.woessner

    Portal Member
    November 8, 2006
    32
    3
    Home Country
    Germany Germany
    AW: Freeze when trying to enter Live TV at random times

    OK, so far so good.
    It compiles.

    Let's see what I find out.
    Nevertheless it would be good, if the person in charge for TVServcie would monitor this thread or if I could get a direct contact...

    Markus
     

    Owlsroost

    Retired Team Member
  • Premium Supporter
  • October 28, 2008
    5,540
    5,038
    Cambridge
    Home Country
    United Kingdom United Kingdom
    Re: AW: Freeze when trying to enter Live TV at random times

    OK, so far so good.
    It compiles.

    Let's see what I find out.
    Nevertheless it would be good, if the person in charge for TVServcie would monitor this thread or if I could get a direct contact...

    Markus

    The lead developer for TV Server is -> mm1352000 <- (try sending him a PM) but if he is not available there are other devs around with some experience of TV server e.g. Gibman, miroslav22 and DJBlu (the MP team list is here - MEDIAPORTAL - The Team: Get to Know Us)

    Good luck !

    Tony
     

    m.woessner

    Portal Member
    November 8, 2006
    32
    3
    Home Country
    Germany Germany
    AW: Freeze when trying to enter Live TV at random times

    OK, as expected...

    It is the CriticalSection:

    STDMETHODIMP CMpTs::AddChannel( int* handle)
    {
    CAutoLock lock(&m_Lock);


    I will investigate further, but to me it looks very suspicious that the CriticalSection m_Lock is used in the construction of two other objects:

    m_pFilter = new CMpTsFilter(this, GetOwner(), &m_Lock, phr);
    m_pPin = new CMpTsFilterPin(this,GetOwner(),m_pFilter,&m_Lock,&m_ReceiveLock,phr);


    Are those accessed from other threads?
    Anyone around who knows?

    Markus
     

    m.woessner

    Portal Member
    November 8, 2006
    32
    3
    Home Country
    Germany Germany
    AW: Freeze when trying to enter Live TV at random times

    Bad news - after inserting a call to LogDebug befor acquiring m_Lock in CMpTs::AddChannel the problem seems to be gone.

    LogDebug("AddChannel (%ld), last lock: %s (%ld)", GetCurrentThreadId(), m_LastLock, m_LastLockThread);
    CAutoLock lock(&m_Lock);


    Not really surprising as it seems to be some sort of a race condition...

    I will keep a look on it, but I strongly suggest some of the core developers checks the usage of that CriticalSection.
    Also it would be nice if someone with access to Mantis would create a bug for that issue.

    Best regards,
    Markus
     

    Users who are viewing this thread

    Top Bottom