-
Bug
-
Resolution: Fixed
-
P4
-
11, 15, 16
-
b17
We have actually observed it with JDK 11u jobs trying to run ZGC on Windows. But the issue is not ZGC-specific, and it affects head jdk as well.
Steps to reproduce:
1. Build current jdk with --with-jvm-features=-zgc
2. Do: export JAVA_TOOL_OPTIONS="-XX:+UseZGC"
3. Run -version, observing silent fallback to G1:
$ jdk/build/linux-x86_64-server-fastdebug/images/jdk/bin/java -Xlog:gc -version
Picked up JAVA_TOOL_OPTIONS: -XX:+UseZGC
[0.036s][info][gc] Using G1
4. Run with explicit flags:
~/trunks/jdk/build/linux-x86_64-server-fastdebug/images/jdk/bin/java -Xlog:gc -XX:+UseZGC -version
Picked up JAVA_TOOL_OPTIONS: -XX:+UseZGC
Error occurred during initialization of VM
Option -XX:+UseZGC not supported
I think that happens because GCConfig checks only for FLAG_IS_CMDLINE, which is only from cmdline-originated flags. In this case, the flag comes from the environment variable. Maybe checking for !FLAG_IS_DEFAULT is better, as it captures all non-default origins.
Steps to reproduce:
1. Build current jdk with --with-jvm-features=-zgc
2. Do: export JAVA_TOOL_OPTIONS="-XX:+UseZGC"
3. Run -version, observing silent fallback to G1:
$ jdk/build/linux-x86_64-server-fastdebug/images/jdk/bin/java -Xlog:gc -version
Picked up JAVA_TOOL_OPTIONS: -XX:+UseZGC
[0.036s][info][gc] Using G1
4. Run with explicit flags:
~/trunks/jdk/build/linux-x86_64-server-fastdebug/images/jdk/bin/java -Xlog:gc -XX:+UseZGC -version
Picked up JAVA_TOOL_OPTIONS: -XX:+UseZGC
Error occurred during initialization of VM
Option -XX:+UseZGC not supported
I think that happens because GCConfig checks only for FLAG_IS_CMDLINE, which is only from cmdline-originated flags. In this case, the flag comes from the environment variable. Maybe checking for !FLAG_IS_DEFAULT is better, as it captures all non-default origins.