-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
No way exists to ignore a host JDK #12451
Comments
If you prevent one JDK selection, which JDK should be selected instead? If you know absolute path to the preferred JDK, you can put You can also use JDK from a remote repository for execution, by setting |
We have the following in our
Followed by the following in our
The goal being to have Bazel start up with the embedded JDK, and then use the hermetic JDK from there. I've got a local patch which replaces that function with |
If I understand correctly your configuration is already using embedded JDK for bazel and hermetic JDK from there, even if you don't patch the function. The call to that function is made in Or is there another loophole? |
If the patched version is used, we follow the if statement on 461 with an embedded jdk.
So we follow 2), the embedded JDK, or die if 3) is taken. If you look in
Essentially, we pass the default system javabase in to Bazel regardless of if there is an embedded JDK. I'm pretty certain one of the bazel versions I was using was built without the embedded JDK. The end result without the patch was that it auto-detected the host JDK instead of failing. This was resulting in random crashes of bazel which were hard to debug. I'd like a way to make bazel explode instead of falling back, catching the Options are things like: Or something else. I'm happy to plumb up whatever interface folks prefer. We have a |
I'd go for a startup command line option "--autodetect_server_javabase", type boolean with default value true. (Rationale: Ensure stable Bazel invocation on uncontrolled developer workstations) |
A startup option is not a great idea in any case, because changing it incurs a server restart, but it doesn't need to be since there are plenty of places to prevent the discovered javabase from getting into the value of Other than that, I don't have a very strong opinion; Ivo knows more about JVM/JRE selection so he can make a better decision. |
In this case this isn't a problem. The issue is particularly about not running Bazel using local JDK. |
Thanks! I'll put something together. |
PR sent! That's the functionality I would like. Happy to adjust as you see fit. |
I'm realizing you might be waiting for me to make the tests pass, and I'm waiting for feedback to see if the approach looks reasonable before fixing the last tests. Could I get a quick look? |
We want bazel to fail to start instead of falling back to a host JRE/JDK. We are using a hermetic JDK and the embedded JRE, so there should be no need to use anything from the host. We've debugged enough cases so far where the host installed JDK was buggy and causing random crashes on specific machines. Fixes: #12451 Closes #12542. PiperOrigin-RevId: 347411720
We want bazel to fail to start instead of falling back to a host JRE/JDK. We are using a hermetic JDK and the embedded JRE, so there should be no need to use anything from the host. We've debugged enough cases so far where the host installed JDK was buggy and causing random crashes on specific machines. Fixes: bazelbuild#12451 Closes bazelbuild#12542. PiperOrigin-RevId: 347411720
We have developers who accidentally (or on purpose) install different JDK versions. I want to be able to tell Bazel to never ever look at those.
In
src/main/cpp/blaze_util_linux.cc
This tries pretty hard to find a JDK. I'd like an environmental variable, reserved value (/dev/null?) or flag or something which I can pass in to return
""
, ie no JDK found. (I'm also happy to implement it if there is consensus.)The text was updated successfully, but these errors were encountered: