Windows Service started, but process killed

1.2k Views Asked by At

I am running a Windows Service on a Windows 2000 machine. Sometimes the executable for this service dies, but the Windows service is still listed as "started" in the service manager. In this situation the restart behaviour defined for this service does not take effect.

How can I avoid this situation? Is this a configuration problem of Windows 2000 or is the Windows service wrongly configured?

EDIT: The windows service is self-written in Python using py2exe, based on this description: Creating a python win32 service

1

There are 1 best solutions below

0
On

The Windows Service Recovery mechanism will only kick in when it thinks the service has failed. It will NOT be triggered when it thinks the service has ended normally.

From Microsoft's documentation (http://msdn.microsoft.com/en-us/library/ms685939%28v=VS.85%29.aspx):

A service is considered failed when it terminates without reporting a status of SERVICE_STOPPED to the service controller.

My guess is that your Python program is either:

  1. Catching the crash, cleaning up and exiting normally, or
  2. Hung. Can you confirm that you don't see the exe in the Task Manager when this happens? (Be sure to show processes from all users...)