eclipse-openj9 / openj9

Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Other
3.27k stars 721 forks source link

Unable to declare *_TOOL_OPTIONS with -XshowSettings:vm #8417

Closed mbarbero closed 4 years ago

mbarbero commented 4 years ago

Java -version output

openjdk version "1.8.0_232"
OpenJDK Runtime Environment (build 1.8.0_232-b09)
Eclipse OpenJ9 VM (build openj9-0.17.0, JRE 1.8.0 Mac OS X amd64-64-Bit Compressed References 20191101_372 (JIT enabled, AOT enabled)
OpenJ9   - 77c1cf708
OMR      - 20db4fbc1
JCL      - 3504dff40aa based on jdk8u232-b09)

Summary of problem

When I add -XshowSettings:vm to either OPENJ9_TOOL_OPTIONS or JAVA_TOOL_OPTIONS, OpenJ9 fails with:

JVMJ9VM007E Option de ligne de commande non identifiée : -XshowSettings:vm
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

See steps below to reproduce

# For reference
$ java -version
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (build 1.8.0_232-b09)
Eclipse OpenJ9 VM (build openj9-0.17.0, JRE 1.8.0 Mac OS X amd64-64-Bit Compressed References 20191101_372 (JIT enabled, AOT enabled)
OpenJ9   - 77c1cf708
OMR      - 20db4fbc1
JCL      - 3504dff40aa based on jdk8u232-b09)

# Use XshowSettings:vm on the command line: no issue
$ java -XshowSettings:vm -version
VM settings:
    Max. Heap Size (Estimated): 512.00M
    Ergonomics Machine Class: server
    Using VM: Eclipse OpenJ9 VM

openjdk version "1.8.0_232"
OpenJDK Runtime Environment (build 1.8.0_232-b09)
Eclipse OpenJ9 VM (build openj9-0.17.0, JRE 1.8.0 Mac OS X amd64-64-Bit Compressed References 20191101_372 (JIT enabled, AOT enabled)
OpenJ9   - 77c1cf708
OMR      - 20db4fbc1
JCL      - 3504dff40aa based on jdk8u232-b09)

# Add XshowSettings:vm to OPENJ9_JAVA_OPTIONS => issue
$ export OPENJ9_JAVA_OPTIONS=-XshowSettings:vm
$ java -version
JVMJ9VM007E Option de ligne de commande non identifiée : -XshowSettings:vm
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

# Add XshowSettings:vm to JAVA_TOOL_OPTIONS => issue
$ unset OPENJ9_JAVA_OPTIONS
$ export JAVA_TOOL_OPTIONS="-XshowSettings:vm"
$ java -version
JVMJ9VM007E Option de ligne de commande non identifiée : -XshowSettings:vm
Error: Could not create the Java Virtual Machine.
DanHeidinga commented 4 years ago

Does -verbose:sizes give you the information you need?

-XshowSettings is an option that is parsed by the launcher, resulting in an upcall to a Java helper, while *_JAVA_OPTIONS are processed by the VM and are not seen by the launcher.

mbarbero commented 4 years ago

Yes, -verbose:sizes gives me what I need (and more). Issue is: it's less portable. I'd like to use -XshowSettings in JAVA_TOOL_OPTIONS as it would work with hotspot / openj9

pshipton commented 4 years ago

This is expected behavior, but I can see the User Guide needs some updates to make this clear. There is a partial list of options that won't work in the environment variables found in https://www.eclipse.org/openj9/docs/xoptionsfile/

pshipton commented 4 years ago

Created https://github.com/eclipse/openj9-docs/issues/487

DanHeidinga commented 4 years ago

When testing with a version of Hotspot, I get similar behaviour:

$ ~/projects/jdk8/jdk8u212-b03/Contents/Home/bin/java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_212-b03)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.212-b03, mixed mode)

$ ~/projects/jdk8/jdk8u212-b03/Contents/Home/bin/java -version
Picked up JAVA_TOOL_OPTIONS: -XshowSettings:vm
Unrecognized option: -XshowSettings:vm
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
mbarbero commented 4 years ago

My bad, I did not try with Hotspot. As I tried with openj9 first, I was just assuming this was a different behavior. I guess I should raise an issue against openjdk then. Sorry about the noise.

DanHeidinga commented 4 years ago

Thanks for raising the issue @mbarbero. It helped highlight a short-coming in our documentation which we're fixing in eclipse/openj9-docs#487