GOP/GKOP evict() method is not synchronised and is not thread-safe
------------------------------------------------------------------

                 Key: POOL-199
                 URL: https://issues.apache.org/jira/browse/POOL-199
             Project: Commons Pool
          Issue Type: Bug
    Affects Versions: 2.0
            Reporter: Sebb


The evict() method in Pool2 GOP/GKOP classes is not synchronised, yet it relies 
on accessing and updating the field evictionIterator without any 
synchronisation.

Adding volatile to the field would help with safe publication across threads, 
but won't address the problem of two evictions running in parallel.

AFAICT, two threads running evict() in parallel could operate on the same 
objects, which will almost certainly cause problems.

The evict() method should probably be synchronised, which would also solve the 
safe publication problem.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to