MP2 - V2.1 MP2-632: ResourceServer deadlock on shutdown (1 Viewer)

Status
Not open for further replies.

morpheus_xx

Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    he issue is that when trying to subsequently stop the server it waits for the shutdownEvent to be set, but that's only ever set in the OnAccept method, which doesn't ever get called if the listener failed to start so it just waits there indefinitely.
    Any suggestions for a solution? Should we set it immediately if the listener fails to start or avoid calling stop in the first place or...?
    Bad bug :p

    I guess the exception happens on "_listener.Start(backlog);" if the port is in use? We could add a try/catch here and do set the _shutdownEvent in catch block.
    But as I understand this, even the normal shutdown procedure depends on at least one request to be accepted? So the catch in Start() would be only a partial solution.

    That all remembers me that we planned to replace the quite old HttpServer part by new .NET provided server components, because there are more known issues...
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    I believe its used in a 'multi-seat' environment, where there is more than 1 client on the network, it allows the possibility to configure clients to view media on the other client's local machine.
    This is one usage, right.

    But it is also used in single seat, i.e. the FanArt service delivers results over the resource server via http. So it's a quite important service.
     

    Brownard

    Development Group
  • Team MediaPortal
  • March 21, 2007
    2,306
    1,884
    Home Country
    United Kingdom United Kingdom
    But as I understand this, even the normal shutdown procedure depends on at least one request to be accepted?
    I wondered this as well but assumed that OnAccept must always be called after calling TcpListener.Stop which would make sense as that would complete the IAsyncResult from BeginAcceptSocket (assuming BeginAcceptSocket had previously been called which should always be the case if everything started correctly). But best to test this :)
     

    tlhackque

    Portal Member
    June 3, 2015
    44
    1
    Home Country
    United States of America United States of America
    I don't remember exactly how the port was chosen; I certainly didn't expect my desktop to have IIS installed!

    As with anything I install, I went through the settings to see what needed attention. "0" is an invalid port number; had the default been "Automatic" I would not have changed it.
     

    Brownard

    Development Group
  • Team MediaPortal
  • March 21, 2007
    2,306
    1,884
    Home Country
    United Kingdom United Kingdom
    @morpheus_xx branch with fix is here, does it look OK to you? I wrapped most of it in the try block as BeginAcceptSocket could also throw. I also checked and the BeginAcceptSocket callback is always called if Stop is called, so that part should be OK.
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    Looks good, thank you! Can you merge it into pre2 branch, please?
     
    Status
    Not open for further replies.

    Users who are viewing this thread

    Top Bottom