On Mon, 20 Jul 2026 18:47:15 GMT, Per Minborg <[email protected]> wrote:
> This PR proposes to fix a race condition. > > --------- > - [X] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). src/java.base/share/classes/java/util/LazyCollections.java line 680: > 678: // There might be a race where the value is already computed > and > 679: // the mutex is cleared, so we need to re-check the value > again > 680: final T t = (T) UNSAFE.getReferenceAcquire(array, offset); It is not obvious to me from the code below that the setting of the value and the clearing of the "mutex" are guaranteed to be ordered i.e. you might see a null mutex and also not see the new value. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/31979#discussion_r3619838877
