none
Delaying restart RRS feed

  • Question

  • Sorry in advance if I've picked the wrong forum but I don't see a more appropriate forum.
     
    Is there a way to lengthen the time Windows 2003 server, or any other Windows OS, will wait for services to shut down before killing the service and restarting anyway?

    We have a service that often takes much longer to shut down due to releasing resources and and has a lot of files open that often haven't had their file buffers flushed to disk. When the processes are killed this often corrupts the index files requiring a lot of down time rebuilding the indexes after the restart and often the services don't run properly due to cyclic indexes and other issues.
    Wednesday, October 15, 2008 2:35 PM

Answers

  • Great question actually! Delays in shutdown of services is one of the reasons Windows machine can take a long time to shut down. It takes only one service to significantly impact this scenario and as part of our "good citizenship" best practices we advocate avoiding spending much time in the shutdown path, if possible. In fact, if you service does not need to persist data, we recommend that you don't accept the shutdown command at all - i.e. don't register to receive it when you start your service. That way your service doesn't affect the shutdown sequence at all.

    That said, some services, such as yours, do need to persist data on shutdown, and in that case our recommendation differs depending on the OS.

    For server SKUs, where data integrity is of outmost concern and it is expected that it may take a while to shutdown a server, you should extend the timeout period as necessary using the HKLM\SYSTEM\CurrentControlSet\Control\WaitToKillServiceTimeout registry key (see http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/regentry/26734.mspx?mfr=true for detail). Also, given that your service takes a long time to shutdown, you should strongly consider providing visual indication to the user as to its progress.

    For client SKUs, however, you do need to architect your solution so as to avoid taking more than the time alotted by the system to shutdown the service. This is extremely important for the user experience! We find that people shutdown their computers up to several times a day, expect that to be a quick experience, and if they see that it takes a long time to shut it down they often just power it down manually.

    Hope this helps,
    Michael
    Friday, October 17, 2008 10:44 PM

All replies

  • Great question actually! Delays in shutdown of services is one of the reasons Windows machine can take a long time to shut down. It takes only one service to significantly impact this scenario and as part of our "good citizenship" best practices we advocate avoiding spending much time in the shutdown path, if possible. In fact, if you service does not need to persist data, we recommend that you don't accept the shutdown command at all - i.e. don't register to receive it when you start your service. That way your service doesn't affect the shutdown sequence at all.

    That said, some services, such as yours, do need to persist data on shutdown, and in that case our recommendation differs depending on the OS.

    For server SKUs, where data integrity is of outmost concern and it is expected that it may take a while to shutdown a server, you should extend the timeout period as necessary using the HKLM\SYSTEM\CurrentControlSet\Control\WaitToKillServiceTimeout registry key (see http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/regentry/26734.mspx?mfr=true for detail). Also, given that your service takes a long time to shutdown, you should strongly consider providing visual indication to the user as to its progress.

    For client SKUs, however, you do need to architect your solution so as to avoid taking more than the time alotted by the system to shutdown the service. This is extremely important for the user experience! We find that people shutdown their computers up to several times a day, expect that to be a quick experience, and if they see that it takes a long time to shut it down they often just power it down manually.

    Hope this helps,
    Michael
    Friday, October 17, 2008 10:44 PM
  • That does answer the question quite well. I agree with most of your statement except that our application is more of a server type and must be up as close to 24/7 as possible and uses hardware that cannot be placed on a laptop for personal use. There are hardware services that could take a couple of minutes to properly close and if we kill them early, they can't properly notify remote connections and this could cause problems form more than the local machine. Since the machine is usually locked up in a server room, a progress message most likely not be seen by a human.

    Thanks for the information.
    Monday, October 20, 2008 5:58 PM
  • In that case, your scenario is that of a server SKU, so you can use the above mentioned registry key. Good luck! :)

    Michael
    Wednesday, October 22, 2008 4:31 AM