INFO: Service Dependencies Not Used During Shutdown

ID: Q203878


The information in this article applies to:
  • Microsoft Windows NT
  • Microsoft Windows 2000


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:

Q146092 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.

Additional query words: kbDSupport prodnt

Keywords : kbinterop kbKernBase kbNTOS kbWinOS2000 kbService kbSvcMgr kbDSupport
Version : WINDOWS:; winnt:
Platform : WINDOWS winnt
Issue type : kbinfo


Last Reviewed: December 23, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.