Tracker: Feature Requests

5 Add support for service recovery - ID: 3588884
Last Update: Comment added ( rupole )

Currently there seems to be no way to use the automatic service recovery options provided by the service manager in case of a failure in the service. According to http://msdn.microsoft.com/en-us/library/ms685939%28VS.85%29.aspx , a service is considered failed if it didn't report a status of SERVICE_STOPPED before terminating.

When using the win32serviceutil.ServiceFramework the SERVICE_STOPPED status is always reported to the service manager (at the end of the service_main() function in PythonService.cpp) and there is no way to prevent this. One way to support this is by checking for a SystemExit exception with a code != 0 when returning from the "SvcRun" method in the service_main() function and not report the SERVICE_STOPPED status in that case. One can thus trigger the recovery by calling "exit(1)".


Dieter G ( dgovaerts ) - 2012-11-21 01:34:27 PST

5

Open

None

Nobody/Anonymous

win32

None

Public


Comment ( 1 )

Date: 2012-11-22 19:28:20 PST
Sender: rupoleSourceForge.net Subscriber

Given that there's a difference between how a crash and a reported win32
error is handled, it might be better to not set SERVICE_STOPPED when an
unhandled python exception occurs. That way it can be treated as a crash.
Otherwise, if the service method returns an error code, still set
SERVICE_STOPPED and report the error using ERROR_SERVICE_SPECIFIC_ERROR.



Attached File

No Files Currently Attached

Change

No changes have been made to this artifact.