Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
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.