bazel: `--lockfile_mode` doesn't actually work in Bazel 6.2
Description of the bug:
My guess is that there is some bugfix missing. Invoking a build with --lockfile_mode=update
creates a MODULE.bazel.lock
file with the content {}
on the initial invocation. All subsequent invocations then crash with the following stacktrace:
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.RuntimeException: Unrecoverable error while evaluating node 'com.google.devtools.build.lib.bazel.bzlmod.BazelLockFileValue$$Lambda$215/0x0000000800297040@4eb05709'
(requested by nodes 'com.google.devtools.build.lib.bazel.bzlmod.BazelDepGraphValue$$Lambda$341/0x00000008004bf840@328bbd2c')
at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:642)
at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:382)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.RuntimeException: Failed to invoke public com.google.devtools.build.lib.bazel.bzlmod.BazelLockFileValue() with no args
at com.google.gson.internal.ConstructorConstructor$3.construct(ConstructorConstructor.java:113)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:212)
at com.google.gson.Gson.fromJson(Gson.java:932)
at com.google.gson.Gson.fromJson(Gson.java:897)
at com.google.gson.Gson.fromJson(Gson.java:846)
at com.google.gson.Gson.fromJson(Gson.java:817)
at com.google.devtools.build.lib.bazel.bzlmod.BazelLockFileFunction.compute(BazelLockFileFunction.java:81)
at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:571)
... 4 more
Caused by: java.lang.InstantiationException
at java.base/jdk.internal.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at com.google.gson.internal.ConstructorConstructor$3.construct(ConstructorConstructor.java:110)
... 11 more
aaron@ii ~/aaronmondal
What’s the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
- Use Bazel 6.2.
- Add
build --lockfile_mode=update
(and--enable_bzlmod
) to.bazelrc
- Run a command.
- Attempt to run another command.
Which operating system are you running Bazel on?
Gentoo x86_64
What is the output of bazel info release
?
release 6.2.0- (@non-git)
If bazel info release
returns development version
or (@non-git)
, tell us how you built Bazel.
Release from nixpkgs.
Have you found anything relevant by searching the web?
This might be relevant: https://github.com/bazelbuild/bazel/commit/23518b8df6bee3ca35202d942bfbd041ba7ca8f8
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 15 (12 by maintainers)
Commits related to this issue
- Update lockfile function exception Add new exception for this function to handle any syntax errors or missing data within the lockfile Related: https://github.com/bazelbuild/bazel/issues/18455 Piper... — committed to bazelbuild/bazel by SalmaSamy a year ago
- Update lockfile function exception Add new exception for this function to handle any syntax errors or missing data within the lockfile Related: https://github.com/bazelbuild/bazel/issues/18455 Piper... — committed to bazelbuild/bazel by SalmaSamy a year ago
- Update lockfile function exception Add new exception for this function to handle any syntax errors or missing data within the lockfile Related: https://github.com/bazelbuild/bazel/issues/18455 Piper... — committed to bazelbuild/bazel by SalmaSamy a year ago
- [6.3.0] Lockfile updates (#18894) * Update lockfile function exception Add new exception for this function to handle any syntax errors or missing data within the lockfile Related: https://githu... — committed to bazelbuild/bazel by SalmaSamy a year ago
@aaronmondal Yes, that shouldn’t matter. I will take a close look and get back to you.
@aaronmondal Thanks for the context! But I’m not sure it’s related the java version, since the lock file support in 6.2 only takes Bazel modules into account, but the JDK repos are not Bazel modules.
I believe in Bazel 6.2, the lock file flag should be
--lockfile_mode
instead of--enable_lockfile
. Are you sure this bug is reproducible with 6.2.0?