-
Type:
Bug
-
Resolution: Fixed
-
Priority:
P3
-
Affects Version/s: 22, 23, 24, 25, 26
-
Component/s: core-libs
-
b20
-
generic
-
generic
| Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
|---|---|---|---|---|---|---|
| JDK-8370311 | 25.0.2 | Viktor Klang | P3 | Resolved | Fixed | b03 |
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 ----------
- backported by
-
JDK-8370311 Calling CompletableFuture.join() could execute task in common pool
-
- Resolved
-
- causes
-
JDK-8370515 Regression in Renaissance-FutureGenetic with JDK-8369656
-
- Closed
-
- links to
-
Commit(master)
openjdk/jdk25u/0a6cbb7b
-
Commit(master)
openjdk/jdk/b5b83247
-
Review(master)
openjdk/jdk25u/317
-
Review(master)
openjdk/jdk/27800
(1 links to)