RFR: 8373118: Test java/lang/Thread/virtual/Starvation.java timed out

Viktor Klang vklang at openjdk.org
Fri Dec 12 23:09:52 UTC 2025


On Fri, 12 Dec 2025 16:44:21 GMT, Doug Lea <dl at openjdk.org> wrote:

> Changes signal filtering to avoid possible starvation

src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 1468:

> 1466:                     ForkJoinTask<?> t; int qcap; long qk;
> 1467:                     ForkJoinTask<?>[] qa = q.array;
> 1468:                     if (q.base != qbase || qa == null || (qcap = qa.length) <= 0 ||

Seems like a negative array length would be problematic in general, so simplifying to a 0-check here?

Suggestion:

                    if (q.base != qbase || qa == null || (qcap = qa.length) == 0 ||

src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 1471:

> 1469:                         (t = (ForkJoinTask<?>)U.getReferenceAcquire(
> 1470:                             qa, qk = slotOffset((qcap - 1) & qbase))) == null ||
> 1471:                         q.base != qbase ||

Is this (repeated) check intended? (i.e. are we worried about q.base drift between polling the array?)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28797#discussion_r2615804439
PR Review Comment: https://git.openjdk.org/jdk/pull/28797#discussion_r2615806612


More information about the core-libs-dev mailing list