Skip to content

--lockfile_mode doesn't actually work in Bazel 6.2 #18455

@aaronmondal

Description

@aaronmondal

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: 23518b8

Metadata

Metadata

Assignees

Labels

P2We'll consider working on this in future. (Assignee optional)area-BzlmodBzlmod-specific PRs, issues, and feature requestsawaiting-user-responseAwaiting a response from the authorteam-ExternalDepsExternal dependency handling, remote repositiories, WORKSPACE file.type: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions