Jerry Cwiklik created UIMA-4857:
-----------------------------------

             Summary: UIMA-AS: Fix NullPointerException
                 Key: UIMA-4857
                 URL: https://issues.apache.org/jira/browse/UIMA-4857
             Project: UIMA
          Issue Type: Bug
          Components: Async Scaleout
            Reporter: Jerry Cwiklik
            Assignee: Jerry Cwiklik
             Fix For: 2.8.1AS


Fix NPE in the UIMA-AS service caused by a race condition when the service 
(remote multiplier) sends child CASes to a client. 

For each child it receives, the client sends a message to the service to free 
the CAS. Upon receipt of the message the service removes CAS from its cache.

The race condition is as follows:
1) Service in Thread 1 sends child CAS to client and the OS suspends the thread.
2) Client immediately sends request to free CAS to the service
3) Service in Thread 2 receives request to free CAS and deletes it from its 
cache.
4) Service in Thread 1 looks up the CAS in its cache and gets NULL (since the 
CAS was deleted in 3) above.

So the problem is that right after sending a child CAS to a client, the service 
tries to access cache entry for this CAS to change the state of the cache entry.

Move the cache look up and state change *before* the send. 




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to