Live TV Stopped Due To TCP/IP Error (1 Viewer)

CyberSimian

Test Group
  • Team MediaPortal
  • June 10, 2013
    2,849
    1,771
    Southampton
    Home Country
    United Kingdom United Kingdom
    I am using MP 1.9.0 pre, with "aMPed" skin, on 32-bit Vista, with client and server on the same system.

    Last night I was watching live TV when the screen froze. Several seconds later an error message was displayed, saying that a TCP/IP error had occurred. I tried restarting live TV, but it failed with the same error. There were three recordings being made, but I could not determine whether they were still active, or whether TV Server had stopped. So I decided to reboot. After reboot, the recordings restarted, and live TV was available again.

    This morning I looked at the error logs, including the Windows Event Logs. For the first time ever, the Windows Event Log actually gave a useful explanation. I tried to cut-and-paste the explanation, but cut-and-paste does not work on the event-log panels, so I took a screen shot (see attachment). I hope that the text is legible.

    The explanation in the event log says that MP or TV Server was disconnecting and then reconnecting so rapidly that the system used up all available ports and no more were available (so the TCP/IP connection to the SQL server could not be established). Apparently, TCP/IP does not allow a port to be re-used unless a minimum amount of time has elapsed.

    So, do I need to increase the number of ports available on my system? If so, how do I do that?

    Or is the problem that my system is doing far too many disconnects/reconnects, possibly due to some incorrect setting for MP or TV Server? If so, which setting?

    I have included relevant logs in the zip file. Thank you.

    -- from CyberSimian in the UK
     

    Attachments

    • live_tv_stopped_tcpip_error.jpg
      live_tv_stopped_tcpip_error.jpg
      135.5 KB
    • live_tv_stopped.zip
      154.9 KB

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    I have included relevant logs in the zip file.
    Rather than cherry-picking what you post and assuming that it will be what we need, please would you [always] use the watchdog tool to grab full log files. In this case please use option 3 to export your existing logs:
    http://wiki.team-mediaportal.com/1_MEDIAPORTAL_1/16_Support/3_Forums/2_Log_Files

    The watchdog tool will include all MediaPortal logs and settings, all TV Server logs [if TV Server is installed on the same PC], general system information, and Windows application and system event logs. Having access to all that information helps us to help you.
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Thanks :)

    The explanation in the event log says that MP or TV Server was disconnecting and then reconnecting so rapidly that the system used up all available ports and no more were available (so the TCP/IP connection to the SQL server could not be established). Apparently, TCP/IP does not allow a port to be re-used unless a minimum amount of time has elapsed.

    I have a different interpretation of that event log message:
    TCP/IP failed to establish an outgoing connection because the selected local endpoint was recently used to connect to the same remote endpoint. This error typically occurs when outgoing connections are opened and closed at a high rate, causing all available local ports to be used and forcing TCP/IP to reuse a local port for an outgoing connection. To minimize the risk of data corruption, the TCP/IP standard requires a minimum time period to elapse between successive connections from a given local endpoint to a given remote endpoint.

    My understanding is that this error is not application-specific. In other words:
    1. Any application (or combination of applications) that were running at the time could cause this.
    2. All applications that try to establish TCP connections after the limit is hit would be affected.
    The above is why there is no mention of MP or TV Server in the message.

    Now, it just so happens that TV Server was writing EPG data to the MySQL database at that time (which requires a TCP connection) and MP's TV feature requires a connection to TV Server (another TCP connection). That explains why MP and TV Server were affected. They possibly even tipped the system over the limit with a particular request... but crucially, I don't see any evidence that MP or TV Server would have been opening and closing connections at a high rate.

    So, do I need to increase the number of ports available on my system? If so, how do I do that?
    A cursory google search yields:
    http://www.dslreports.com/forum/r28809232-Windows-TCP-IP-Error-with-Event-ID-4227

    The first reply looks very helpful.

    [edit: Another interesting read...
    http://forums.overclockers.co.uk/showthread.php?t=18339095
    ]

    So I decided to reboot.
    Did you also try to restart the TV service instead of restarting the PC, and if so what happened?
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,849
    1,771
    Southampton
    Home Country
    United Kingdom United Kingdom
    Thank you for taking the time to look at this.

    So, do I need to increase the number of ports available on my system?
    I read both of the above references, but unfortunately I have not yet experienced the "lightbulb" moment. :( None of the possible causes seem to relate to my case.

    I checked the current port settings for TCP and UDP ports, and both are the expected 49152 and 16384. The NETSTAT command this morning did not show an excessive number of ports in use (but, of course, I have rebooted since the problem occurred). The system is a dedicated HTPC, and it is not used for gaming, or browsing the web, or streaming content from the web. I have just checked, and the only applications that I have installed (apart from those that are part of MediaPortal) are: AutoHotkey, Nvidia Control Panel, Open Object REXX, Recuva, VideoReDo.

    I have not tried the registry updates suggested in the references, as I don't think that increasing the number of ports, and/or decreasing the wait time before re-use, is the right solution (it addresses the symptom and not the cause). I have created a BAT file containing the NETSTAT command, and will run that the next time that this problem occurs.

    One question: when the TCP error occurred, I could not decide whether TV Server had stopped recording (so I rebooted). If this problem occurs again when TV Server is recording, will TV Server continue recording successfully, or will it abort recording? (If TV Server continues recording, I would defer the reboot until the recordings finish.)

    Did you also try to restart the TV service instead of restarting the PC, and if so what happened?
    When an inexplicable error occurs, I usually prefer to reboot, in order to restart with a "clean slate". If the problem had been (say) a corrupted value in a TV Server control block, restarting TV Server would not necessarily fix it (depending on what the restart does). Do you think that restarting TV Server would be worth trying if the problem occurs again? Presumably that would interrupt any recordings that were being made?

    -- from CyberSimian in the UK
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    I read both of the above references, but unfortunately I have not yet experienced the "lightbulb" moment. :( None of the possible causes seem to relate to my case.
    I didn't mean them to be interpreted as a full explanation of cause and/or solution. Rather, the point of reading them is that you'd understand the general cause, that the problem is not necessarily related to MP or TV Server, and how to get more information about the base cause if/when it occurs next time.

    I have not tried the registry updates suggested in the references, as I don't think that increasing the number of ports, and/or decreasing the wait time before re-use, is the right solution (it addresses the symptom and not the cause).
    I agree.

    I have created a BAT file containing the NETSTAT command, and will run that the next time that this problem occurs.
    Excellent. I'll be very interested to see the results. :)

    One question: when the TCP error occurred, I could not decide whether TV Server had stopped recording (so I rebooted). If this problem occurs again when TV Server is recording, will TV Server continue recording successfully, or will it abort recording? (If TV Server continues recording, I would defer the reboot until the recordings finish.)
    I cannot be 100% sure. After all, I've never seen this problem before (...which is another reason why I have my doubts that this problem is in any way related to MP or TV Server). If I had to guess I'd say TV Server would probably continue current recordings... but possibly not start new recordings or stop the current recordings at the scheduled time. Without access to the database the scheduler can't check the stop time for current recordings or start time for new schedules. Live TV would be toast as you saw.

    When an inexplicable error occurs, I usually prefer to reboot, in order to restart with a "clean slate".
    For a TV Server problem that will mostly either be overkill or ineffectual.
    Overkill because a TV service restart resets internal state in exactly the same way as a PC restart... except faster.
    Ineffectual because if the issue is related to persistent state (eg. database content) then neither a TV service restart or PC restart will have any effect. Only intervening directly with [for example] the database would solve such a problem.

    Of course rebooting can help with environmental (eg. hardware, Windows etc.) and unusual TV Server issues... but I think my point still stands: restarting the TV service will be faster and perhaps just as effective as rebooting while potentially preserving vital information about the cause of the issue, and if restarting the TV service doesn't help you have the ability to reboot at any time.

    If the problem had been (say) a corrupted value in a TV Server control block, restarting TV Server would not necessarily fix it (depending on what the restart does).
    PC reboot and TV service restart have exactly the same effect on TV Server, so for that reason I disagree. As above: if a restart of the TV service doesn't fix a problem then:
    • if the problem is with TV Server, it is very unlikely to be solved by a PC restart
    • if the problem is environmental (ie. hardware, Windows etc.), a restart may be necessary... but attempting a TV service restart first can give you information about the problem

    Do you think that restarting TV Server would be worth trying if the problem occurs again?
    As above: yes, absolutely.

    Presumably that would interrupt any recordings that were being made?
    Yes it would. Same as restarting the PC... except faster.
     

    Users who are viewing this thread

    Top Bottom