[ 
https://issues.apache.org/jira/browse/POLYGENE-308?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Niclas Hedhman resolved POLYGENE-308.
-------------------------------------
       Resolution: Fixed
    Fix Version/s: 3.1.0

AtomicInstancePool is indeed not thread-safe, and it is a rather confusing 
interaction between the "first" in each of the methods, and that consumers are 
modifying the retrieved instances, which may happen prior the compareAndSet() 
operation a couple of lines later or maybe something else because it is really 
tricky to debug.

Now, instead of trying to make it thread-safe, I have simply removed the class 
and replaced the only use with a ConcurrentLinkedQueue (of JDK) instead, which 
I assume is approximately as fast as AtomicReference, but is thread-safe thanks 
to Doug Lea.

> Possible corrupted composite method invocation
> ----------------------------------------------
>
>                 Key: POLYGENE-308
>                 URL: https://issues.apache.org/jira/browse/POLYGENE-308
>             Project: Polygene
>          Issue Type: Bug
>    Affects Versions: 2.0, 2.1, 3.0.0, 2.1.1
>         Environment: macOs 10.13.4
> jdk 1.8.0_141
>            Reporter: Tibor Mlynarik
>            Assignee: Niclas Hedhman
>            Priority: Major
>             Fix For: 3.1.0
>
>
> AtomicInstancePool seems to have multi thread issue.
> Here is test that throws NPE after some time:
> https://gist.github.com/tbml/5c11317fb06a7cfc0617b203fcf75cf5
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to