-
Notifications
You must be signed in to change notification settings - Fork 138
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
blooprifle: add -XX:+IgnoreUnrecognizedVMOptions to hardCodedDefaultJavaOpts #1845
blooprifle: add -XX:+IgnoreUnrecognizedVMOptions to hardCodedDefaultJavaOpts #1845
Conversation
5518ab7
to
fcf0942
Compare
Note that I see this error with the standalone JVM launcher and not with a native image created by Graal1. So I assume your suggestion does not apply? 1: I execute scala-cli on an armle machine and Graal has no support for 32-bit arm. |
@Flowdalic Thank you for working on this issue.
|
We discussed this internally and we agree to add It seems the following tests are failing and will need to be adjusted:
I suspect this test can be removed as invalid JVM options should not fail bloop. BTW. let me know if you'll don't have time to fix this, I can have a look. |
Thanks. I'll look into the test. Your suggestion to create an environment variable made me wonder if it wouldn't be sensible to be able to override the default hardcoded JVM options via an environment variable e.g., |
…avaOpts Some (most?) JVMs fail to launch if they encounter unrecognized non-standard options. For example, executing scala-cli on a armle machine running Debian 11 (Bullseye) with openjdk-17-jre-headless installed results in flo@raspi:~$ scala-cli bloop output Unrecognized VM option 'MaxInlineLevel=20' Did you mean 'MaxForceInlineLevel=<value>'? Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. flo@raspi:~$ java -version openjdk version "17.0.6" 2023-01-17 OpenJDK Runtime Environment (build 17.0.6+10-Debian-1deb11u1) OpenJDK Zero VM (build 17.0.6+10-Debian-1deb11u1, interpreted mode)
fcf0942
to
4964028
Compare
LGTM, thanks for the contribution! |
This was (is?) an attempt to fix #1843. However, adding this line had no effect. Just like removing the
XX:MaxInlineLevel
line. I assume that the error in #1843 is caused by a different code path. I suspect https://github.com/scalacenter/bloop/blob/a249e0a710ce169ca05d0606778f96f44a398680/bloopgun/src/main/scala/bloop/bloopgun/util/Environment.scala#L87, where, according to the code comment, the code in scala-cli originates from.I wonder if it is wise to hard code non-standard JVM options like it is done here and in scalacenter/bloop. As apparently #1843 demonstrates, some (most?) JVM will bail out if they are invoked with options they do not recognize (which is IMHO sensible behavior). I would be great of all TCK compatible JVMs would be supported by scala-cli (and bloop). So either do not use non-standard hard coded options, or add
-XX:+IgnoreUnrecognizedVMOptions
(which, according to JDK-6788376, is available since Java 6)1.1: A third option would be to only issue the option if it was detected the receiving JVM supports it. But that is probably not trivial to implement.