TV Service taking long while to shutdown, delaying Windows shutdown/reboot | Page 5

Discussion in '1.5.x' started by doveman, July 15, 2013.

  1. doskabouter
    • Premium Supporter

    doskabouter Community Plugin Dev

    Joined:
    September 27, 2009
    Messages:
    2,803
    Likes Received:
    757
    Location:
    Nuenen
    Ratings:
    +1,122 / 1
    Home Country:
    Netherlands Netherlands
    Show System Specs
    Isn't the solution in doing the stop actions in a separate thread?
    Because. as I see it (don't know if my assumptions are correct), when a preshutdown event is triggered, Service1.Onstop is executed, which calls _tvServiceThread.Abort() and _tvServiceThread.Join() which is just waiting until all is done.
    After that, the control is returned to whoever called the OnCustomCommand.

    As I understand from here (http://msdn.microsoft.com/en-us/magazine/cc164252.aspx#S2)
    this is a better way



    Edit: sorry to mess around in archived discussions, but here's where the link in the jira call pointed to :)
     
    • Like Like x 1
    • Thank You! Thank You! x 1
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. michael_t

    michael_t Portal Pro

    Joined:
    November 30, 2008
    Messages:
    1,258
    Likes Received:
    580
    Ratings:
    +813 / 2
    Home Country:
    Germany Germany
    Show System Specs
    The things are not so easy with managed code (.NET). I found no explicit way to set the service state to SERVICE_STOPPED, which is necessary to inform the SCM about a successful stop of the service. Usually this state is set after a successful return from the OnStop event handler. But the OnStop event is not triggered when you activate the pre-shutdown event. So the TV Controller is stopped prior to the other services by the pre-shutdown event handler which eliminates dependency errors (MySQL). But without setting the SERVICE_STOPPED state the SCM runs into a timeout (usually 10 sec - some reported longer...).
    So the trick is that the OnStop event has to be raised by the SCM though the pre-shutdown event is enabled. This is done by the patch I found in an internet blog and provided for MP. It triggers the SCM OnStop event out of the preshutdown event handler. Thus (I assume) the SERVICE_STOPPED state is entered implicitely after the OnStop handler returns (like if the pre-shutdown event were not activated).

    Michael
     
    • Like Like x 1
    • Informative Informative x 1
  4. michael_t

    michael_t Portal Pro

    Joined:
    November 30, 2008
    Messages:
    1,258
    Likes Received:
    580
    Ratings:
    +813 / 2
    Home Country:
    Germany Germany
    Show System Specs
    I just committed a new branch based on MP 1.6 from my local git repository for this (MP1-3172_TVService_ignores_shutdown_(reopened)) and created a new review for it (MP1CR-244). The binary for testing is attached.

    Michael
     

    Attached Files:

    • TvService.zip
      File size:
      86.1 KB
      Uploaded:
      January 18, 2014
      Views:
      148
    • Like Like x 1
    • Thank You! Thank You! x 1
  5. catavolt
    • Team MediaPortal
    • Administrator

    catavolt Design Group Manager

    Joined:
    August 13, 2007
    Messages:
    12,240
    Likes Received:
    4,982
    Gender:
    Male
    Occupation:
    Technical Documentation, Translation
    Location:
    Lanzarote
    Ratings:
    +7,396 / 38
    Home Country:
    Germany Germany
    Show System Specs
    Hi Michael, tested the above TVService.exe and it works fine.
    Shutdown time with original TVService.exe: 32 secs.
    Shutdown time with new TVService.exe: 13 secs.
    This is a significant improvement ;)
    THX (y)
     
  6. badboyxx

    badboyxx Portal Pro

    Joined:
    June 15, 2012
    Messages:
    677
    Likes Received:
    52
    Gender:
    Male
    Ratings:
    +83 / 9
    Home Country:
    Germany Germany
    Show System Specs
    Is it possible that you create also one for MP 1.5?
     
  7. skorz
    • Premium Supporter

    skorz MP Donator

    Joined:
    December 19, 2011
    Messages:
    242
    Likes Received:
    33
    Gender:
    Male
    Location:
    Deutschland
    Ratings:
    +47 / 0
    Home Country:
    Germany Germany
    Show System Specs
    As i understand it the right way, this fix will solve problems where the tv service needs too long to shutdown? i have every time the pc goes to sleep the error message that the tv service cant shutdown completely after a preshutdown event...

    as i have 1.7 pre, is this fix included?
     
  8. HomeY
    • Team MediaPortal

    HomeY Test Group

    Joined:
    February 23, 2008
    Messages:
    6,460
    Likes Received:
    2,627
    Gender:
    Male
    Occupation:
    Network Engineer
    Location:
    ::1
    Ratings:
    +4,737 / 16
    Home Country:
    Netherlands Netherlands
    Show System Specs
    Nope, it's not included.
    You can follow development on our bugtracker (for other issues you only need the 4 digits of the issuekey, and use the quicksearch top right)
     
  9. lukeinv

    lukeinv Portal Member

    Joined:
    January 22, 2010
    Messages:
    11
    Likes Received:
    0
    Ratings:
    +0 / 0

    Hi Michael, the new TV service is working fine except loading plugins:
    [2014-03-23 01:29:53,539] [Log ] [TVService] [INFO ] - TV Service: Load plugins
    [2014-03-23 01:29:53,539] [Log ] [TVService] [INFO ] - PluginManager: TvEngine.ComSkipLauncher is incompatible with the current tvserver version and won't be loaded!
    [2014-03-23 01:29:53,555] [Log ] [TVService] [INFO ] - PluginManager: TvEngine.ConflictsManager is incompatible with the current tvserver version and won't be loaded!
    [2014-03-23 01:29:53,555] [Log ] [TVService] [INFO ] - PluginManager: Loaded MPExtended PowerScheduler plugin version:0.5.4 author:MPExtended Developers
    [2014-03-23 01:29:53,570] [Log ] [TVService] [INFO ] - PluginManager: TvEngine.PowerScheduler.PowerSchedulerPlugin is incompatible with the current tvserver version and won't be loaded!
    [2014-03-23 01:29:53,570] [Log ] [TVService] [INFO ] - PluginManager: TvEngine.ServerBlaster is incompatible with the current tvserver version and won't be loaded!
    [2014-03-23 01:29:53,570] [Log ] [TVService] [INFO ] - PluginManager: TvEngine.TvMovie is incompatible with the current tvserver version and won't be loaded!
    [2014-03-23 01:29:53,586] [Log ] [TVService] [INFO ] - PluginManager: TvEngine.WebEPGImport is incompatible with the current tvserver version and won't be loaded!
    [2014-03-23 01:29:53,586] [Log ] [TVService] [INFO ] - PluginManager: TvEngine.XmlTvImporter is incompatible with the current tvserver version and won't be loaded!
    (I'm only using bold ones)

    and I'm wondering is it possible to fix it
    Thanks
     
  10. michael_t

    michael_t Portal Pro

    Joined:
    November 30, 2008
    Messages:
    1,258
    Likes Received:
    580
    Ratings:
    +813 / 2
    Home Country:
    Germany Germany
    Show System Specs
    Your problem has nothing to do with shutdown, but shows a version / compatibilty issue. What "new TVService" are you using? If you want to try the fixed shutdown function, try the MP 1.7 Test build in which it is integrated.

    Michael
     
    • Thank You! Thank You! x 1
  11. lukeinv

    lukeinv Portal Member

    Joined:
    January 22, 2010
    Messages:
    11
    Likes Received:
    0
    Ratings:
    +0 / 0
    Hi Michael,
    I have currently installed MP 1.7 PreRelease installed (tv service version - 1.6.100.0) and shut down takes long time
    Combination of MP 1.7 PreRelease + tv service 1.6.0.0 performs much quicker shutdown but it is incompatible with few plugins
    Is there newer version of tv service than 1.6.100.0 one?

    Thanks
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!