adoptium / adoptium/adoptium-support

On AIX 7.2, arguments set using the JDK_JAVA_OPTIONS environment variable are picked up twice

Open
#303 9 comments 0 reactions 0 assignees View on GitHub
bug jbs:needs-report keep platform:aix
Dominant language
No language data
Stars
59
Forks
13
PR merge metrics
No merged PRs in 30d

Description

## Summary
On AIX, when you specify jvm arguments using the JDK_JAVA_OPTIONS environment variable, they are picked up twice when launching the jvm. As a result, if you have specified an argument that may only occur once on the commandline, the jvm fails to launch.

## Steps to reproduce
In a terminal, on an AIX system, execute the following :
export JDK_JAVA_OPTIONS="--patch-module java.base=dummy.jar"
java [Any Class]

## Expected results
A JVM is initialized, and the main() method of the class is executed.

## Actual results
The JVM doesn't initialize, and these errors are produced :

AdoptOpenJDK Hotspot :
NOTE: Picked up JDK_JAVA_OPTIONS: --patch-module java.base=dummy.jar
NOTE: Picked up JDK_JAVA_OPTIONS: --patch-module java.base=dummy.jar
Error occurred during initialization of VM
Cannot specify java.base more than once to --patch-module

AdoptOpenJDK OpenJ9 :
NOTE: Picked up JDK_JAVA_OPTIONS: --patch-module java.base=dummy.jar
NOTE: Picked up JDK_JAVA_OPTIONS: --patch-module java.base=dummy.jar
Exception in thread "main" java/lang/ExceptionInInitializerError
at java/lang/J9VMInternals.ensureError (java.base@9/J9VMInternals.java:184)
at java/lang/J9VMInternals.recordInitializationFailure (java.base@9/J9VMInternals.java:173)
at java/lang/ClassLoader.initializeClassLoaders (java.base@9/ClassLoader.java:210)
at java/lang/Thread.initialize (java.base@9/Thread.java:430)
at java/lang/Thread. (java.base@9/Thread.java:155)
java/lang/RuntimeException: java.base specified more than once to --patch-module
at jdk/internal/module/ModuleBootstrap.fail (java.base@9/ModuleBootstrap.java:941)
at jdk/internal/module/ModuleBootstrap.decode (java.base@9/ModuleBootstrap.java:881)
at jdk/internal/module/ModuleBootstrap.initModulePatcher (java.base@9/ModuleBootstrap.java:572)
at jdk/internal/module/ModuleBootstrap. (java.base@9/ModuleBootstrap.java:100)
at java/lang/ClassLoader.initializeClassLoaders (java.base@9/ClassLoader.java:210)
at java/lang/Thread.initialize (java.base@9/Thread.java:430)
at java/lang/Thread. (java.base@9/Thread.java:155)

IBM Java :
NOTE: Picked up JDK_JAVA_OPTIONS: --patch-module java.base=dummy.jar
NOTE: Picked up JDK_JAVA_OPTIONS: --patch-module java.base=dummy.jar
Exception in thread "main" java/lang/ExceptionInInitializerError
at java/lang/J9VMInternals.ensureError (java.base@9/J9VMInternals.java:185)
at java/lang/J9VMInternals.recordInitializationFailure (java.base@9/J9VMInternals.java:174)
at java/lang/ClassLoader.initializeClassLoaders (java.base@9/ClassLoader.java:211)
at java/lang/Thread.initialize (java.base@9/Thread.java:430)
at java/lang/Thread. (java.base@9/Thread.java:155)
java/lang/RuntimeException: java.base specified more than once to --patch-module
at jdk/internal/module/ModuleBootstrap.fail (java.base@9/ModuleBootstrap.java:941)
at jdk/internal/module/ModuleBootstrap.decode (java.base@9/ModuleBootstrap.java:881)
at jdk/internal/module/ModuleBootstrap.initModulePatcher (java.base@9/ModuleBootstrap.java:572)
at jdk/internal/module/ModuleBootstrap. (java.base@9/ModuleBootstrap.java:100)
at java/lang/ClassLoader.initializeClassLoaders (java.base@9/ClassLoader.java:211)
at java/lang/Thread.initialize (java.base@9/Thread.java:430)
at java/lang/Thread. (java.base@9/Thread.java:155)

## Triaging info
Tested with these Java versions :

AdoptOpenJDK HotSpot :
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)

AdoptOpenJDK OpenJ9 :
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
Eclipse OpenJ9 VM AdoptOpenJDK-11.0.11+9 (build openj9-0.26.0, JRE 11 AIX ppc64-64-Bit Compressed References 20210421_970 (JIT enabled, AOT enabled)
OpenJ9 - b4cc246d9
OMR - 162e6f729
JCL - 7796c80419 based on jdk-11.0.11+9)

IBM Java :
java version "11.0.10" 2021-01-19
Java(TM) SE Runtime Environment 11.0.10.0-IBM (build 11.0.10+9)
Eclipse OpenJ9 VM 11.0.10.0-IBM (build openj9-0.24.0, JRE 11 AIX ppc64-64-Bit Compressed References 20210202_3 (JIT enabled, AOT enabled)
OpenJ9 - 345e1b09e2a
OMR - 741e94ea867
JCL - 80f3ace9274 based on jdk-11.0.10+9)

What is your operating system and platform?
AIX 7.2 7200-03-02-1846
AIX Kernel Version : 7.2.3.16 TL03

How did you install Java?
The AdoptOpenJDK versions were extracted from a tar.gz
The IBM jvm was an executable .bin file (ibm-java-jdk_ppc64_aix_11.0.10.0.bin)

Did it work before?
It works when you set the options directly on the commandline, not using the JDK_JAVA_OPTIONS environment variable

Did you test with other Java versions?
I did not find any other AIX compatible jvm besides the ones from AdoptOpenJDK or IBM. I didn't test with other Java 11 or lower versions.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the AIX 7.2 failure with JDK_JAVA_OPTIONS set to --patch-module java.base=dummy.jar and launching java with any class. Trace the Java launcher and environment-option handling to determine why the option is reported twice; done means the option is processed once and the JVM initializes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.