On Tue, 9 Jun 2026 19:19:50 GMT, Viktor Klang <[email protected]> wrote:
>> Addresses a case where a `null`-value can sneak in to a reference chain and >> lead to a live lock. Introduces a regression test which stochastically >> reproduces the error. >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > Viktor Klang has updated the pull request incrementally with one additional > commit since the last revision: > > Indentation and comment refinement test/jdk/java/util/concurrent/tck/SemaphoreTest.java line 707: > 705: > 706: final int permitsAvailable = s.availablePermits(); > 707: done.set(true); // Ensure that tasks > can exit If the threads are stuck in livelock in `AQS.cleanQueue()`, they will not exit the `do {...} while` this way. test/jdk/java/util/concurrent/tck/SemaphoreTest.java line 708: > 706: final int permitsAvailable = s.availablePermits(); > 707: done.set(true); // Ensure that tasks > can exit > 708: assertTrue(permitsAvailable < width); // Some permits > should've been taken I think it is better to check for `permitsAvailable == 0` here, so we catch a case where only some of threads are stuck. Additionally, it would be great to check the stacks of the running acquire() threads to see if some of are RUNNABLE and still in `cleanQueue()`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/31436#discussion_r3384920675 PR Review Comment: https://git.openjdk.org/jdk/pull/31436#discussion_r3385004294
