-
Bug
-
Resolution: Fixed
-
P3
-
22, 23, 24, 25, 26
-
b20
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
openjdk 25 2025-09-16 LTS
OpenJDK Runtime Environment Temurin-25+36 (build 25+36-LTS)
OpenJDK 64-Bit Server VM Temurin-25+36 (build 25+36-LTS, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
Calling CompletableFuture.join() from a ForkJoinWorkerThread which comes from a new ForkJoinPool, could cause to help to execute tasks in common pool.
REGRESSION : Last worked in version 21.0.8
---------- BEGIN SOURCE ----------
try (ForkJoinPool pool = new ForkJoinPool(2)) { // A new pool
ForkJoinTask<?> task = ForkJoinTask.adapt(() -> {
Thread thread = Thread.currentThread();
assertTrue(thread instanceof ForkJoinWorkerThread);
// submit to common pool
List<Thread> workers = range(0, 100).mapToObj(i -> CompletableFuture.supplyAsync(() -> {
LockSupport.parkNanos(1_000_000L);
return Thread.currentThread();
})).toList().stream()
.map(CompletableFuture::join) // join in current ForkJoinWorkerThread
.toList();
if (Runtime.version().feature() < 25) {
// before 25, ForkJoinWorkerThread won't help for a different ForkJoinPool
assertThat(workers).doesNotContain(thread);
} else {
// after 25, the ForkJoinWorkerThread will help even from a different ForkJoinPool
assertThat(workers).contains(thread);
}
});
pool.execute(task);
task.join();
}
---------- END SOURCE ----------
openjdk 25 2025-09-16 LTS
OpenJDK Runtime Environment Temurin-25+36 (build 25+36-LTS)
OpenJDK 64-Bit Server VM Temurin-25+36 (build 25+36-LTS, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
Calling CompletableFuture.join() from a ForkJoinWorkerThread which comes from a new ForkJoinPool, could cause to help to execute tasks in common pool.
REGRESSION : Last worked in version 21.0.8
---------- BEGIN SOURCE ----------
try (ForkJoinPool pool = new ForkJoinPool(2)) { // A new pool
ForkJoinTask<?> task = ForkJoinTask.adapt(() -> {
Thread thread = Thread.currentThread();
assertTrue(thread instanceof ForkJoinWorkerThread);
// submit to common pool
List<Thread> workers = range(0, 100).mapToObj(i -> CompletableFuture.supplyAsync(() -> {
LockSupport.parkNanos(1_000_000L);
return Thread.currentThread();
})).toList().stream()
.map(CompletableFuture::join) // join in current ForkJoinWorkerThread
.toList();
if (Runtime.version().feature() < 25) {
// before 25, ForkJoinWorkerThread won't help for a different ForkJoinPool
assertThat(workers).doesNotContain(thread);
} else {
// after 25, the ForkJoinWorkerThread will help even from a different ForkJoinPool
assertThat(workers).contains(thread);
}
});
pool.execute(task);
task.join();
}
---------- END SOURCE ----------
- links to
-
Commit(master) openjdk/jdk/b5b83247
-
Review(master) openjdk/jdk25u/317
-
Review(master) openjdk/jdk/27800