Uploaded image for project: 'MediaPortal 1'
  1. MediaPortal 1
  2. MP1-3172

TVService ignores shutdown

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.7.0
    • 1.3.0, 1.4.0, 1.5.0
    • TvServer
    • None

    Description

      <h3 style="margin-top:10px;color:#222222;line-height:115%;font-style:normal;font-size:1.4em;font-weight:bold;font-variant:normal;font-family:arial,verdana,sans-serif;"><a data-cke-saved-name="StepstoReproduce" name="StepstoReproduce"></a>Issue reopened</h3><p>The <a data-cke-saved-href="http://issues.team-mediaportal.com/browse/MP1-3172" href="http://issues.team-mediaportal.com/browse/MP1-3172" title="TVService ignores shutdown">MP1-3172</a> fix (implemented in MP 1.4 and later) makes the TVService react on the Windows pre-shutdown message and let it stop the TVController and all TVServer plugins cleanly. But: Though the TVService shuts down cleanly now (seen from MP's view), Windows does not notice that the TVService has been stopped and therefore now waits for 10 seconds to get a stop notification (gives an error in the System event log) and only then continues its shutdown progress. This issue is discussed in <a data-cke-saved-href="http://forum.team-mediaportal.com/threads/tv-service-taking-long-while-to-shutdown-delaying-windows-shutdown-reboot.120453/page-4" href="http://forum.team-mediaportal.com/threads/tv-service-taking-long-while-to-shutdown-delaying-windows-shutdown-reboot.120453/page-4">http://forum.team-mediaportal.com/threads/tv-service-taking-long-while-to-shutdown-delaying-windows-shutdown-reboot.120453.&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Therefore the issue is reopened to fix this bug.</p><p>The solution is described in <a data-cke-saved-href="http://www.atomia.com/blog/2011/11/16/how-to-process-the-preshutdown-event-in-a-managed-windows-service" href="http://www.atomia.com/blog/2011/11/16/how-to-process-the-preshutdown-event-in-a-managed-windows-service">http://www.atomia.com/blog/2011/11/16/how-to-process-the-preshutdown-event-in-a-managed-windows-service&lt;/a&gt;&lt;/p&gt;&lt;h3 style="margin-top:10px;color:#222222;line-height:115%;font-style:normal;font-size:1.4em;font-weight:bold;font-variant:normal;font-family:arial,verdana,sans-serif;"><a data-cke-saved-name="StepstoReproduce" name="StepstoReproduce"></a>Original issue</h3><p>The TV Service does not react on a system shutdown by stopping and disabling the plugins and the TVController cleanly. It simply waits until its processes are killed by Windows, which leads to error messages in the log files.<br />But even a manual stop (net stop tvservice) is logged as error, though the tvservice and its plugins terminate cleanly.</p><h4><a data-cke-saved-name="StepstoReproduce" name="StepstoReproduce"></a>Steps to Reproduce</h4><p>Reboot system and have a look in the TV Server's error.log. You will find something like:<br />2013-03-02 13:44:37.615427 <span class="error">[PowerScheduler poll thread(14)]</span>: Exception :Error: DatabaseUnavailableUnclassified<br />Gentle.Common.GentleException: The database backend (provider MySQL) could not be reached.<br />...</p><p>Do a manual stop of the TV Service (net stop tvservice). In the TV Server's error.log you will find:<br />2013-03-02 13:44:37.615427 <span class="error">[TVService(6)]</span>: TvService OnStart failed : System.Threading.ThreadAbortException: Thread was being aborted.<br />at System.Threading.Thread.SleepInternal(Int32 millisecondsTimeout)<br />at TvService.TvServiceThread.OnStart()</p><h4><a data-cke-saved-name="AdditionalInformation" name="AdditionalInformation"></a>Additional Information</h4><p>The bugfix branch in mantis is <a data-cke-saved-href="https://github.com/MediaPortal/MediaPortal-1/tree/BUG-4264-TVService_ignores_shutdown" href="https://github.com/MediaPortal/MediaPortal-1/tree/BUG-4264-TVService_ignores_shutdown" class="external-link" rel="nofollow">https://github.com/MediaPortal/MediaPortal-1/tree/BUG-4264-TVService_ignores_shutdown&lt;/a&gt;&lt;br />It contains those changes in Service1.cs:</p><ul class="alternate" type="square"><li>The OnShutdown() method is implemented now. This method is called on system shutdown and stops the tvservice by calling OnStop() on Windows XP systems.</li><li>For Vista and up the SYSTEM_CONTROL_PRESHUTDOWN message is enabled. This message is sent prior to a system shutdown. It is handled by the newly implemented OnCustomCommand() method which then calls OnStop().</li><li>The order of enabling / disabling remoting, TVController and plugins in OnStart() and OnStop() is now correct.</li><li>Rework of OnStop() to avoid error logs on clean stop of tvservice</li></ul>

      Attachments

        Activity

          People

            sebastiii sebastiii
            michael_t michael_t (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: