-
Notifications
You must be signed in to change notification settings - Fork 277
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
Draft: Enable security manager for ScalacWorker to allow using JDK 18+ #1539
Conversation
Hm, looks like this flag is not backwards compatible with earlier JVMs, maybe some kind of version detection is needed. |
@thirtyseven Thanks for looking into this. We've been discussing this issue over here. I think the version detection you mention has become available in I hope this is helpful :) |
Hi, @thirtyseven, have you looked at what @srdo suggested? Maybe that would work? But in general, since jdk does not provide any alternative for exit code trapping is see two options how we could go here:
Frankly I'm not a big fan of ifs by java version which might break in future java releases. WDYT would extra java toolchain configuration be a big hurdle? |
@simuons I don't understand why adjusting the Java toolchain would be the only option other than removing the exit trap? Can't we detect the Java version from Starlark in the way I suggested, and add I think that would keep basic toolchains working, and not cause any problems for existing users. It should keep working until the SM is actually removed from the JDK, and at that point there will hopefully be a replacement. My understanding is that not trapping exits means that any user code (e.g. tests) that invokes Edit: A fourth option would be to add this flag unconditionally and drop support for Java 11, but I don't know if that's acceptable? |
This is an emergency pr to make build pass on ci Probably tool_java_runtime_version started to resolve to jdk 21 And builds are failing with `java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release` Need to solve bazelbuild#1539 asap
This was resolved by #1556 |
Description
ScalacWorker.java uses the Java Security Manager to trap calls to System.exit(). In JDK 18+, enabling the security manager is disallowed by default, so a flag must be passed to allow it.
Motivation
When building with
--tool_java_runtime=remotejdk_21
, I found that this flag was needed when using Scalac persistent workers otherwise they would crash with anUnsupportedOperationException
.