On Wed, 10 Jun 2026 01:42:49 GMT, Kirill Shirokov <[email protected]> wrote:

>> 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. Nor they respond to `Thread.interrupt()` 
> AFAIK. The original reproducer was able to exit early because it was a 
> standalone test with daemon threads.
> 
> I tried running the new test without the fix (`make test 
> TEST=test/jdk/java/util/concurrent/tck/`) and it was just stuck and timed out 
> in 1h+ (4000s). And this is a livelock with all threads using 100% of core...

My concern with asserting == 0 is that it risks more false positives. And yes, 
done.set(true) won't magically make infinite loops exit cleanly. Given that the 
test is never meant to fail (a regression test) we shouldn't have a situation 
where it hangs for 4000s using 100% CPU, and if we do, we have a regression.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31436#discussion_r3387562728

Reply via email to