RFR: 8132306: java/lang/ref/ReferenceEnqueue.java fails with "RuntimeException: Error: poll() returned null; expected ref object"
daniel.fuchs at oracle.com
Thu Jul 30 09:12:42 UTC 2015
I'm glad you're looking at this too! We can't have too many eyes :-)
On 30/07/15 10:38, Peter Levart wrote:
> Suppose we have a Reference 'r' and it's associated ReferenceQueue 'q'.
> Currently it can happen that the following evaluates to true, which is
> q.poll() == null && r.isEnqueued()
But on the other hand this can only happen if two different
threads are polling the queue - in which case only one of them
will get the reference. In such a situation, the symmetric condition
would not be surprising (as the other thread would
get q.poll() != null):
r.isEnqueued() && q.poll() == null
The original bug fixed by Kim is more surprising, because there's only
one Thread doing the polling, and it does get:
r.isEnqueud() && q.poll() == null
although nobody else is polling the queue.
This should no longer occur in this situation with Kim's fix.
More information about the hotspot-gc-dev