1

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

Community
  • 1
  • 1
Bertolt
  • 995
  • 1
  • 13
  • 37
  • What service are we talking about? – Bart De Vos Mar 29 '11 at 08:08
  • A self-written service. The program was written in Python. – Bertolt Mar 29 '11 at 08:17
  • I think we can safely narrow this down to faulty coding. You need to debug your service and determine why it's not working as you intended. Bear in mind that the code wasn't working for the person who posted the question you linked to either. – John Gardeniers Mar 29 '11 at 09:13
  • I thought the restart options for windows services are exactly designed to work around such unexpected crashes. – Bertolt Mar 29 '11 at 09:20

1 Answers1

0

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...)
CoreTech
  • 2,345
  • 2
  • 17
  • 24