ADDITIONAL SYSTEM INFORMATION :
bash-4.4# java --version
openjdk 17.0.1 2021-10-19
OpenJDK Runtime Environment (build 17.0.1+12-39)
OpenJDK 64-Bit Server VM (build 17.0.1+12-39, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
1. The problem is observed only in containerized environments like minikube, docker desktop, kubernetes.
2. The computed parallelism on ForkJoinPool.commonPool() is 0 in minikube and 1 in kubernetes when the deployment file does not specify any cpu limits.
spec.containers[].resources.limits.cpu
spec.containers[].resources.requests.cpu
3. As a result, there are no fork join worker threads spawned and tasks are not executed.
REGRESSION : Last worked in version 11.0.12-oracle
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a Forkjoin pool
var parallelism = ForkJoinPool.commonPool().getParallelism();
LOGGER.info("The fork join pool computed parallelism {}.",parallelism);
2. Deploy this app in kubernetes infrastructure, without specifying cpu requests or limits in k8 deployment yaml. The computed parallelism is incorrect and is less then 2.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
1. In java version "11.0.10" 2021-01-19 LTS, the computed parallelism is correct specifying cpu requests or limits.
FREQUENCY : always