Microsoft KB Archive/154113

{|
 * width="100%"|

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), included with:
 * Microsoft Windows NT, versions 3.51, 4.0

-

SUMMARY
Stopping a Win32 Service may cause an ERROR_SERVICE_REQUEST_TIMEOUT, to be reported by the Service Controller. The description of this error (#1053) is:

The service did not respond to the start or control request in a timely fashion.

This problem existed in the Win32 SDK Simple Service sample for Windows NT 3.51 and has been corrected in the sample for Windows NT 4.0.

MORE INFORMATION
Error 1053 is the result of a race condition in the service's control handler function, caused by the service setting an event telling the service to stop. The Servicemain thread returns from the ServiceStart function, and calls SetServiceStatus to tell the service controller that the service has stopped before a status of STOP_PENDING can be reported by the control handler function.

To fix this problem, first report STOP_PENDING, and then set the event telling the other thread to stop.

Additional query words: 3.51 4.00

Keywords         : kberrmsg kbKernBase kbService kbGrpKernBase Version          : winnt:3.51,4.0 Platform         : winnt Issue type       :
 * }