-
Bug
-
Resolution: Fixed
-
P3
-
17, 18
-
b05
-
b18
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8274756 | 17.0.2 | David Holmes | P3 | Resolved | Fixed | b01 |
ADDITIONAL SYSTEM INFORMATION :
$ java -version
openjdk version "17" 2021-09-14
OpenJDK Runtime Environment Temurin-17+35 (build 17+35)
OpenJDK 64-Bit Server VM Temurin-17+35 (build 17+35, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
The common pool does not process any submitted tasks if the JVM was started with Runtime.getRuntime().availableProcessors() reporting 1. This can be the case when starting it in a container or by setting the -XX:ActiveProcessorCount=1 flag.
REGRESSION : Last worked in version 16.0.2
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the code given below with `java -XX:ActiveProcessorCount=1 ForkJoinForget`.
"Hello World" won't be printed this way
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Tasks submitted to the common pool get executed.
ACTUAL -
Tasks submitted to the common pool aren't executed.
---------- BEGIN SOURCE ----------
import java.util.concurrent.ForkJoinPool;
public class ForkJoinForget {
public static void main(String[] args) throws Exception {
ForkJoinPool.commonPool().submit(() -> System.out.println("Hello World"));
Thread.sleep(1000);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
One of:
- Not using containers with 1 CPU
- manually set the property `java.util.concurrent.ForkJoinPool.common.parallelism` to 1
- Not using -XX:ActiveProcessorCount=1 as startup flag
FREQUENCY : always
$ java -version
openjdk version "17" 2021-09-14
OpenJDK Runtime Environment Temurin-17+35 (build 17+35)
OpenJDK 64-Bit Server VM Temurin-17+35 (build 17+35, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
The common pool does not process any submitted tasks if the JVM was started with Runtime.getRuntime().availableProcessors() reporting 1. This can be the case when starting it in a container or by setting the -XX:ActiveProcessorCount=1 flag.
REGRESSION : Last worked in version 16.0.2
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the code given below with `java -XX:ActiveProcessorCount=1 ForkJoinForget`.
"Hello World" won't be printed this way
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Tasks submitted to the common pool get executed.
ACTUAL -
Tasks submitted to the common pool aren't executed.
---------- BEGIN SOURCE ----------
import java.util.concurrent.ForkJoinPool;
public class ForkJoinForget {
public static void main(String[] args) throws Exception {
ForkJoinPool.commonPool().submit(() -> System.out.println("Hello World"));
Thread.sleep(1000);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
One of:
- Not using containers with 1 CPU
- manually set the property `java.util.concurrent.ForkJoinPool.common.parallelism` to 1
- Not using -XX:ActiveProcessorCount=1 as startup flag
FREQUENCY : always
- backported by
-
JDK-8274756 ForkJoinPool.commonPool() does not work with 1 CPU
- Resolved
- relates to
-
JDK-8246585 ForkJoin updates
- Resolved
-
JDK-8279484 Runtime.availableProcessors reports incorrect processor count
- Closed
- links to
-
Commit openjdk/jdk17u/328358a4
-
Commit openjdk/jdk/2e542e33
-
Review openjdk/jdk17u/151
-
Review openjdk/jdk/5784
(2 links to)