[jdk18] RFR: 8279294: NonblockingQueue::try_pop may improperly indicate queue is empty

David Holmes dholmes at openjdk.java.net
Mon Jan 17 22:45:35 UTC 2022


On Mon, 17 Jan 2022 08:23:37 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

> Please review this improvement to NonblockingQueue::try_pop.  The old code
> returned an indication that the queue was empty in some cases where that
> wasn't true.  In particular, contending try_pop operations could result in
> some incorrectly indicating empty.  The change fixes that and improves the
> interaction between contending try_pops.
> 
> Testing:
> mach5 tier1
> 
> Lots of testing of this change in conjunction with others as part of
> investigating and fixing JDK-8273383.

Hi Kim,

I haven't looked at this implementation in detail before, but what you are describing as a bug seems to be a known "property" of the implementation:

// A queue may temporarily appear to be empty even though elements have been
// added and not removed.  For example, after running the following program,
// the value of r may be NULL.
//
// thread1: q.push(a); r = q.pop();
// thread2: q.push(b);
//
// This can occur if the push of b started before the push of a, but didn't
// complete until after the pop.


??

David

-------------

PR: https://git.openjdk.java.net/jdk18/pull/106


More information about the hotspot-dev mailing list