INFO: Service Dependencies Not Used During Shutdown (203878)



The information in this article applies to:

  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Professional
  • Microsoft Win32 Application Programming Interface (API), when used with:
    • the operating system: Microsoft Windows NT 4.0
    • the operating system: Microsoft Windows 2000
    • the operating system: Microsoft Windows XP

This article was previously published under Q203878

SUMMARY

When a service is dependendent on other services, the Service Control Manager (SCM) will automatically start the dependencies before starting the dependent service itself. However, during system shutdown, the SCM does not take dependencies into consideration when stopping services. It simply enumerates the list of running services and sends a SERVICE_CONTROL_SHUTDOWN command to all of them. Thus, a service may stop responding or fail because another service it depends upon has already stopped.

MORE INFORMATION

To learn more about service dependencies, refer to the Win32 SDK documentation in the latest version of the MSDN Library. Note that the lpDependencies parameter passed to CreateService() and ChangeServiceConfig() is only documented for use in starting services.

The documentation for the Handler function (specified in RegisterServiceCtrlHandler()) contains a remark for SERVICE_CONTROL_SHUTDOWN stating that a service should only perform limited processing during shutdown because there is limited time available. By default, the service shutdown limit is 20 seconds. For additional information on how you can increase this time limit, click the article number below to view the article in the Microsoft Knowledge Base:

146092 How to Increase Shutdown Time For Services To Close Properly

The main purpose for the 20-second shutdown limit is that the shutdown may have occurred due to a power failure and the Uninterruptible Power Supply (UPS) can run out of battery power during shutdown. In addition, this limit improves the overall responsiveness to the user-initiated shutdown.

Modification Type:MajorLast Reviewed:12/17/2003
Keywords:kbinfo kbinterop kbKernBase kbSCM kbService KB203878