-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Describe the bug
I am using the OIE 4.5.2-ubuntu Docker image. My understanding of utilizing the VMOPTIONS environment variable is that it should override any of the Java options specified in any of the other *.vmoptions files that come with the default installation of OIE, including a user's custom.vmoptions file. This thinking seems to be supported in the README and this comment. However, my experience is that my Java options in VMOPTIONS are specified FIRST and the *.vmoptions Java options are coming later, allowing for the opportunity that my env var Java option(s) get overridden.
To Reproduce
My VMOPTIONS environment variable:
VMOPTIONS='-Xmx2048m,-Djava.awt.headless=false,--add-opens=java.sql.rowset/com.sun.rowset=ALL-UNNAMED'
This updates oieserver.vmoptions in my container as expected:
# Lines begining with a # are ignored as comments.
# Do not add customizations to this file.
-include-options conf/base_includes.vmoptions
# Comment out the following line if you are running on Java 8
-include-options conf/default_modules.vmoptions
# Put any custom options in the following file
-include-options conf/custom.vmoptions
-Xmx2048m
-Djava.awt.headless=false
--add-opens=java.sql.rowset/com.sun.rowset=ALL-UNNAMED
However, my Java process is getting run with those options specified first:
# ps -ef | grep [j]ava
engine 1 0 51 21:06 ? 00:05:57 /opt/java/openjdk/bin/java -Xmx2048m -Djava.awt.headless=false --add-opens=java.sql.rowset/com.sun.rowset=ALL-UNNAMED -server -Xmx256m -Djava.awt.headless=true -Dapple.awt.UIElement=true --add-modules=java.sql.rowset --add-exports=java.base/com.sun.crypto.provider=ALL-UNNAMED --add-exports=java.base/sun.security.provider=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.math=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.security.cert=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/sun.security.pkcs=ALL-UNNAMED --add-opens=java.base/sun.security.rsa=ALL-UNNAMED --add-opens=java.base/sun.security.x509=ALL-UNNAMED --add-opens=java.desktop/java.awt=ALL-UNNAMED --add-opens=java.desktop/java.awt.color=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED --add-opens=java.xml/com.sun.org.apache.xalan.internal.xsltc.trax=ALL-UNNAMED -classpath /opt/engine/.install4j/i4jruntime.jar:/opt/engine/.install4j/launcher9856f65c.jar:/opt/engine/mirth-server-launcher.jar install4j.com.mirth.connect.server.launcher.MirthLauncher_oieserver
The end result is my Java max heap size remains the default 256MB and Java's headless mode is not disabled.
If I add my Java options to my custom.vmoptions file (mounted into the container as a volume), I get the expected behavior with my options specified last:
# ps -ef | grep [j]ava
engine 1 0 5 21:30 ? 00:00:39 /opt/java/openjdk/bin/java -Xmx2048m -Djava.awt.headless=false --add-opens=java.sql.rowset/com.sun.rowset=ALL-UNNAMED -server -Xmx256m -Djava.awt.headless=true -Dapple.awt.UIElement=true --add-modules=java.sql.rowset --add-exports=java.base/com.sun.crypto.provider=ALL-UNNAMED --add-exports=java.base/sun.security.provider=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.math=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.security.cert=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/sun.security.pkcs=ALL-UNNAMED --add-opens=java.base/sun.security.rsa=ALL-UNNAMED --add-opens=java.base/sun.security.x509=ALL-UNNAMED --add-opens=java.desktop/java.awt=ALL-UNNAMED --add-opens=java.desktop/java.awt.color=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED --add-opens=java.xml/com.sun.org.apache.xalan.internal.xsltc.trax=ALL-UNNAMED -Xmx2048m -Djava.awt.headless=false --add-opens=java.sql.rowset/com.sun.rowset=ALL-UNNAMED -classpath /opt/engine/.install4j/i4jruntime.jar:/opt/engine/.install4j/launcher9856f65c.jar:/opt/engine/mirth-server-launcher.jar install4j.com.mirth.connect.server.launcher.MirthLauncher_oieserver
I debated whether to report this here or the engine repository, since this issue may be related to the oieserver executable reading in the *.vmoptions files. Since this specifically applies to utilizing a Docker-only environment variable, I ultimately decided to report the bug here. Granted, even in a non-Docker context, a user could update oieserver.vmoptions and I imagine the same behavior would occur (I haven't tested this). Let me know if it makes sense for me to move this issue over to the engine project.
Expected behavior
Java options specified in the VMOPTIONS environment variable should be specified LAST when executing the OIE Java process.
Actual behavior
Java options specified in the VMOPTIONS environment variable are specified FIRST when executing the OIE Java process.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
- OS: Amazon Linux 2023
- Java Distribution/Version: OpenJDK 17 (OIE 4.5.2-ubuntu Docker image)
- Connect Version: 4.5.2
Workaround(s)
Move desired Java options into custom.vmoptions and do not utilize the VMOPTIONS environment variable.
Additional context
Add any other context about the problem here.