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

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

  1. doveman

    doveman Portal Pro

    Joined:
    February 12, 2008
    Messages:
    2,326
    Likes Received:
    166
    Ratings:
    +182 / 3
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    MediaPortal Version: 1.4.0

    Description
    I've noticed that when shutting down/rebooting Windows, it gets stuck on "TVService is shutting down" for about 10s (I'm using VerboseStatus to see the shutdown steps).
    I've set WaitToKillServiceTimeout to 2000 (2s) but this doesn't seem to make any difference. I did have TVService set to Restart on Failure for all three settings so thought it was maybe restarting and having to be killed again but I changed them all to Take No Action and it still takes 10s for it to shutdown.
    In the System log I see this
    "The TVService service did not shut down properly after receiving a preshutdown control."
    If I go into Services and manually Stop TVService, it does shutdown within 2s.
    I'm not actually using MP on this system at the moment and don't even have an aerial connected to the tuner card, so ignore any errors related to that in the logs. I don't suppose the logs will help much with this problem and it's more a matter of tweaking things to make it behave better.



    Steps to Reproduce:
    Shutdown Windows
     
    • Like Like x 2
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,527
    Likes Received:
    4,738
    Ratings:
    +8,205 / 17
    Home Country:
    New Zealand New Zealand
    Hello doveman

    Please can you refer to an example in your log files? In other words, please specify a date and time when you see this occurring.
    I see this:
    In other words, if there is a delay I think it is a delay in TV service receiving the shutdown command or somehow due to an interaction with powerscheduler.

    As it stands I don't see any evidence of an issue that we can look into...

    mm
     
  4. 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
    I can confirm the issue!
    I was wondering why shutting down Windows took so long since some time ago (approx. 30 secs).
    Now I stopped TVService manually - and voilá: Windows shuts down as before (approx 10 secs).
    I tried this five times now: Shutdown Windows w/o manually stopping TVService = approx. 30 secs, stopping TVService manually before shutting down Windows = 10 secs!
    BTW: I was already searching a lot of forums why the shutdown time increased dramatically....
    I´m talking about shutting down Windows after MP was stopped or even not running at all ;)
     
  5. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,527
    Likes Received:
    4,738
    Ratings:
    +8,205 / 17
    Home Country:
    New Zealand New Zealand
    Same comments apply as for doveman - not enough info here yet to confirm.
    Please provide:
    1. Log files for delayed and non delayed shutdown.
    2. Date and time when you attempt to shutdown (referring to the provided logs).
    3. Dates and times when you see or don't see the delay (referring to the provided logs).
    4. Confirm whether you use PowerScheduler or PowerScheduler++.
    5. Specify how you're shutting down Windows.
    Missing a lot of info still! ;)
     
  6. 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
    As I said above: MP is already shut - so nothing in any MP log ;)
    I don´t run any PowerScheduler ;)
    I thought my explanation above was clear enough ;)
     
  7. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,527
    Likes Received:
    4,738
    Ratings:
    +8,205 / 17
    Home Country:
    New Zealand New Zealand
    The MP log is irrelevant. I'm talking about the TV service logs! ;)

    Okay thanks.

    Nope. :)
    Please provide the times as requested...
     
  8. doveman

    doveman Portal Pro

    Joined:
    February 12, 2008
    Messages:
    2,326
    Likes Received:
    166
    Ratings:
    +182 / 3
    Home Country:
    United Kingdom United Kingdom
    Show System Specs

    Hi mm

    I've just done two shutdown traces (attached), one at 12:11 without TVService running, which took 8-10s and another at 12:16 with TVService running, which took 20-25s. I'm using PS++ and shutting down using the Start Menu. Windows Update service and then Eventlog service are the two services that stop before it gets to TVService.

    The traces (summary_shutdown2.xml is the one with TVService running) show:

    Code (Text):
    1. Without TVService running:
    2.       <intervals>
    3.         <interval name="WaitForWinstationShutdown" startTime="1491" endTime="1524" duration="33"/>
    4.         <interval name="PreShutdownNotification" startTime="1600" endTime="2910" duration="1310"/>
    Code (Text):
    1. With TVService running:
    2.       <intervals>
    3.         <interval name="WaitForWinstationShutdown" startTime="1561" endTime="1583" duration="22"/>
    4.         <interval name="PreShutdownNotification" startTime="1658" endTime="23625" duration="21967"/>
    so you can see, with TVService running the PreShutdownNotification stages takes about 20s longer.

    I found this information about this stage:

    "What Happens in SystemSession

    This phase includes two subphases:
    • Preshutdown notification. Windows serially shuts down all services that registered to receive preshutdown notifications. Ordered services—services that have set up the shutdown order of dependent services—are shut down before non-ordered services.
    • Shutdown notification. All services that registered to receive shutdown notifications are shut down in parallel.

    If all services have not exited after 20 seconds (in Windows Vista) or 12 seconds (in Windows 7), the system continues the shutdown. Processes and services that do not shut down in a timely manner are left running as the system shuts down.

    SystemSession Performance Vulnerabilities

    In the preshutdown notification subphase, the SCM serializes the waits. Therefore, these services block system shutdown until they exit or until the wait hint time-out expires.
    Services are not guaranteed to have enough time to finish all their work in the shutdown notification subphase before the system shuts down."

    Quite why TVService stops in 2s when done manually but causes this delay when doing a Windows shutdown I'm not sure. It may be that it's not properly notifying Windows that it has stopped and so Windows is waiting this 12 seconds before continuing anyway.
     

    Attached Files:

    Last edited: July 16, 2013
    • Thank You! Thank You! x 1
    • Informative Informative x 1
  9. mm1352000
    • Team MediaPortal

    mm1352000 Development Group

    Joined:
    September 1, 2008
    Messages:
    21,527
    Likes Received:
    4,738
    Ratings:
    +8,205 / 17
    Home Country:
    New Zealand New Zealand
    The key to progress here is to be able to differentiate between whether the problem is:
    1. TV Server not receiving the stop request in a timely fashion.
    2. TV Server actually taking a long time to stop when stopped automatically.
    3. Windows not detecting that the TV service has stopped.
    From the previously supplied logs I don't think the issue is (2).
    Differentiating between (1) and (3) requires very specific timing. Essentially we need to know when you click on OK to shutdown so we can see how long it takes before the "TvService is beeing stopped" message is logged.
     
  10. FreakyJ
    • Team MediaPortal

    FreakyJ Development Group

    Joined:
    July 25, 2010
    Messages:
    4,021
    Likes Received:
    839
    Gender:
    Male
    Ratings:
    +1,424 / 1
    Home Country:
    Germany Germany
    so maybe the evntlog could give us the answer at which time the system goes to sleep, because we need the seconds :)


    (this is from my computer entering the sleep state), but it should also log the shutdown time. In combination with the tv server log files it should be helpful, right?

    Edit: the event details tell you which power state it is, so this is important, too
    e.g
     
    Last edited: July 16, 2013
    • Thank You! Thank You! x 1
  11. doveman

    doveman Portal Pro

    Joined:
    February 12, 2008
    Messages:
    2,326
    Likes Received:
    166
    Ratings:
    +182 / 3
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    Hmm, seems the attachments disappeared somehow. I've re-attached them.

    I can see from the SYSTEM log that the first events when shutting down were at

    12:07:18

    12:11:06

    12:16:21
     
    Last edited: July 16, 2013
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!