commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Miller (JIRA)" <>
Subject [jira] [Created] (DAEMON-286) Race condition during stopping service
Date Tue, 12 Mar 2013 03:39:13 GMT
Mike Miller created DAEMON-286:

             Summary: Race condition during stopping service
                 Key: DAEMON-286
             Project: Commons Daemon
          Issue Type: Bug
          Components: Procrun
    Affects Versions: 1.0.13
         Environment: Windows 7 64 bit
            Reporter: Mike Miller
            Priority: Minor

While debugging an issue where ProcRun NT Service hangs in the stopping state, I noticed a
race condition that causes 2 possible code paths during stopping.   
serviceStop() calls afxJavaStart(...).  I have observed apxJavaStart() returns both TRUE &
FALSE for a successful call to my stop method.  I think this is caused by a potential race
condition in apxJavaStart() & __apxJavaWorkerThread.  The afxJavaStart() waits for lpJava->hWorkerSync
event to be set and then checks the lpJava->dwWorkerStatus.  The race condition is that
__apxJavaWorkerThread sets the dwWorkerStatus to 1 and sets the event but there is no guarantee
that afxJavaStart() will see the 1.  If the __apxJavaWorkerThread completes the stop call
before afxJavaStart has a chance to check the dwWorkerStatus, the __apxJavaWorkerThread may
have changed the dwWorkerStatus back to 0.   So depending on timing, it appears apxJavaStart()
could return either TRUE or FALSE even if the stop method behaved the same.
This race condition results in the stopService() method not always calling afxjavaWait(hWorker,

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message