commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r1412011 - /commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.c
Date Wed, 21 Nov 2012 08:25:34 GMT
Author: mturk
Date: Wed Nov 21 08:25:33 2012
New Revision: 1412011

URL: http://svn.apache.org/viewvc?rev=1412011&view=rev
Log:
DAEMON-267: Report service as stopped pnly when VM exits cleanly

Modified:
    commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.c

Modified: commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.c?rev=1412011&r1=1412010&r2=1412011&view=diff
==============================================================================
--- commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.c (original)
+++ commons/proper/daemon/branches/1.0.x/src/native/windows/apps/prunsrv/prunsrv.c Wed Nov
21 08:25:33 2012
@@ -836,7 +836,7 @@ int reportServiceStatusE(DWORD dwCurrent
    static DWORD dwCheckPoint = 1;
    BOOL fResult = TRUE;
 
-   apxLogWrite(APXLOG_MARK_DEBUG "reportServiceStatus: %d, %d, %d, %d", 
+   apxLogWrite(APXLOG_MARK_DEBUG "reportServiceStatus: %d, %d, %d, %d",
                dwCurrentState, dwWin32ExitCode, dwWaitHint, dwServiceSpecificExitCode);
 
    if (_service_mode && _service_status_handle) {
@@ -911,7 +911,15 @@ static int onExitStart(void)
     if (_service_mode) {
         apxLogWrite(APXLOG_MARK_DEBUG "Start exit hook called ...");
         apxLogWrite(APXLOG_MARK_DEBUG "VM exit code: %d", apxGetVmExitCode());
-        reportServiceStatusStopped(apxGetVmExitCode());
+        /* Reporting the service as stopped even with a non-zero exit code
+         * will not cause recovery actions to be initiated, so don't report at all.
+         * "A service is considered failed when it terminates without reporting a
+         * status of SERVICE_STOPPED to the service controller"
+         * http://msdn.microsoft.com/en-us/library/ms685939(VS.85).aspx
+         */
+        if (apxGetVmExitCode() == 0) {
+            reportServiceStatusStopped(0);
+        }
     }
     return 0;
 }



Mime
View raw message