-
Notifications
You must be signed in to change notification settings - Fork 330
Replace JAVA_OPTS
variable with JAVA_TOOL_OPTIONS
#13256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✨ GUI Checks ResultsSummary
See individual check results for more details. |
4ef2786
to
df1ee08
Compare
Do we need to get clients using ENSO_JVM_OPTS to change things? |
Seems like that, since |
|
b49fda6
to
00657ec
Compare
@@ -210,7 +210,7 @@ private static <S> void printFrame( | |||
static String adjustCwdToProject(String fileToRun) { | |||
assert fileToRun != null; | |||
if (!ImageInfo.inImageRuntimeCode()) { | |||
return null; | |||
return System.getProperty("enso.user.dir"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- the 17e2200 change is unrelated to
_JAVA_OPTIONS
changed - but while testing various combinations of launcher I found out that
- with native image
enso
launcher the following execution fails: sbt:enso> runEngineDistribution --jvm --run test/Base_Tests
- saying it cannot find
test/Base_Tests
project - the problem is that the NI part
- properly resolves the project
- changes CWD to the
test
directory - invokes the JVM
main
- however the CWD for the JVM part is already
test
directory - and resolving
test/Base_Tests
in that directory doesn't work - this change fixes the problem by providing the JVM part the location of the original CWD via a property
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You set enso.user.dir
with
commandAndArgs.add("-Denso.user.dir=" + originalCwdOrNull);
meaning that it can be -Denso.user.dir=null
. And then when you get the property here, doesn't it return the "null"
string?
@@ -41,15 +41,6 @@ public static JVM create(File javaHome, String... options) { | |||
// java.home | |||
jvmArgs.add("-Djava.home=" + javaHome); | |||
|
|||
var jvmOptions = System.getenv("JAVA_OPTS"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- removal of this
JAVA_OPTS
handling is possible because the_JAVA_OPTIONS
are "standard" JVM variables - we don't need to pass them around ourselves
- the HotSpot JVM will pick them automatically up once it starts
- it is small benefit, but it is a simplification of the code
Any reason for preferring |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good simplification.
The difference on on GraalVM/OracleJVM is minimal as https://bugs.openjdk.org/browse/JDK-4971166 explains. But you are right, it is more standard to use
Let's make the switch before integrating! Thanks for pointing that out. Done in 80cae79 |
JAVA_OPTS
variable with JAVA_TOOL_OPTIONS
|
While testing
this happens only when the engine is native image. Because then the
|
@@ -1,5 +1,4 @@ | |||
COMP_PATH=$(dirname "$0")/../component | |||
|
|||
JAVA_OPTS="--enable-native-access=org.graalvm.truffle --sun-misc-unsafe-memory-access=allow --add-opens=java.base/java.nio=ALL-UNNAMED $JAVA_OPTS" | |||
JAVA_OPTS="--enable-native-access=org.graalvm.truffle --sun-misc-unsafe-memory-access=allow --add-opens=java.base/java.nio=ALL-UNNAMED" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That changes the behavior slightly but I understand why it is done this way.
@@ -210,7 +210,7 @@ private static <S> void printFrame( | |||
static String adjustCwdToProject(String fileToRun) { | |||
assert fileToRun != null; | |||
if (!ImageInfo.inImageRuntimeCode()) { | |||
return null; | |||
return System.getProperty("enso.user.dir"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You set enso.user.dir
with
commandAndArgs.add("-Denso.user.dir=" + originalCwdOrNull);
meaning that it can be -Denso.user.dir=null
. And then when you get the property here, doesn't it return the "null"
string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except for my comment about the enso.user.dir
it's good to go.
throws IOException, InterruptedException { | ||
var useJNI = true; | ||
var commandAndArgs = new ArrayList<String>(); | ||
if (originalCwdOrNull != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only set enso.user.dir
when originalCwdOrNull
is non-null
. The problem mentioned here cannot happen, @4e6, I hope.
The only drawback of this change is that
is now being printed always. AFAICT |
Yes, that's correct. Is it a problem for production? I hope not. |
It's annoying. I don't know why JDK authors decided to print a debug message to stderr 🤦 |
Pull Request Description
Use the standard
_JAVA_OPTIONS
environment variable whereJAVA_OPTS
option was used previously.Important Notes
JAVA_OPTS
in favor of_JAVA_OPTIONS
?_JAVA_OPTIONS
Channel
connecting twoJVM
instances #13206 (comment) demonstratesENSO_JVM_OPTS
as they are already used by our usersChecklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
Rust
runEngineDistribution --debug
works (Linux, Mac, Windows)runEngineDistribution --debug
worksENSO_LAUNCHER
env variable set tonative,test,-ls,fast
runProjectManagerDistribution --debug
worksrunProjectManagerDistribution --debug
works