Hi Archie and Kim,

Thank you for your patience, I tried to get back to this as soon as possible.

Trying to swap this in again, looking at the code it would seem like 
lockInterruptibly() by external threads can indeed get interleaved with 
signaled waiters in the Condition's wait list.

It is worth noting, however, that you could have any number of different 
Conditions operating within the same lock, so the question would be what the 
relative priority should be between the different waiters within the different 
Conditions, esp. in the face of competition from "the outside".

Before we do anything at all, does there exist a reproducer which would 
illustrate that the current behavior causes problems?

Cheers,
√


Viktor Klang
Software Architect, Java Platform Group
Oracle
________________________________
From: Archie Cobbs <archie.co...@gmail.com>
Sent: Friday, 20 September 2024 16:32
To: 김민주 <miiiinj...@gmail.com>
Cc: Viktor Klang <viktor.kl...@oracle.com>; Daniel FUCHS 
<daniel.fu...@oracle.com>; core-libs-dev@openjdk.org <core-libs-dev@openjdk.org>
Subject: Re: [External] : Re: [POTENTIAL BUG] Potential FIFO violation in 
BlockingQueue under high contention and suggestion for fair mode in 
ArrayBlockingQueue and LinkedBlockingQueue

Hi Kim,

Here is a quick summary of my thoughts...

Before diving into coding solutions, we need to make sure we're all on the same 
page.

First: (Viktor) Do we all agree that "Interpretation B" accurately describes 
how things are actually working today?

If "No" then we need to stop and understand the disagreement.

If "Yes" then the next step is to collectively decide what, if anything, we 
might want to change. Here are some options:

  1.  Do nothing
  2.  Do nothing but document the behavior more clearly in the Javadoc
  3.  Change the behavior from B → A and update the Javadoc accordingly
  4.  Something else?

Deciding among 1-4 will likely need to involve more core-libs-dev people, 
especially of the java.util.concurrent ilk.

-Archie

On Fri, Sep 20, 2024 at 1:58 AM 김민주 
<miiiinj...@gmail.com<mailto:miiiinj...@gmail.com>> wrote:

Hi Viktor, Archie, and Daniel,

I hope everything is going well on your end. I really appreciate the thoughtful 
feedback you've provided so far, and I wanted to follow up on our previous 
discussion about the potential fairness issue in ArrayBlockingQueue when using 
ReentrantLock with Condition.await().

--
Archie L. Cobbs

Reply via email to