Description of the bug:
When bootstrapping bazel from scratch using a distribution zip archive, the resulting bazel binary's A-server.jar does not contain the *_GsonTypeAdapter.class files which are needed for reading / writing the MODULE.bazel.lock file.
Which category does this issue belong to?
Core
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
- download https://github.com/bazelbuild/bazel/releases/download/6.4.0/bazel-6.4.0-dist.zip
mkdir build && cd build
unzip ~/Downloads/bazel-6.4.0-dist.zip
env EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk" bash ./compile.sh
unzip output/bazel A-server.jar
unzip -l A-server.jar | grep -F _GsonTypeAdapter.class (this should produce some output, but does not)
In a project with bzlmod enabled, trying to update the MODULE.bazel.lock file:
$ output/bazel mod deps --lockfile_mode=update
...
$ cat MODULE.bazel.lock
{}
When trying to run inside a project with a valid lock file, bazel crashes:
$ output/bazel mod deps --lockfile_mode=update
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$223/0x00000008401fe440@e6399be' (requested by nodes 'com.google.devtools.build.lib.bazel.bzlmod.BazelDepGraphValue$$Lambda$388/0x0000000840452440@260c34d0')
at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:633)
at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:365)
at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
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.getLockfileValue(BazelLockFileFunction.java:112)
at com.google.devtools.build.lib.bazel.bzlmod.BazelLockFileFunction.compute(BazelLockFileFunction.java:87)
at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:562)
... 7 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)
... 15 more
Which operating system are you running Bazel on?
Ubuntu Linux
What is the output of bazel info release?
n/a
If bazel info release returns development version or (@non-git), tell us how you built Bazel.
No response
What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?
No response
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
No response
Have you found anything relevant by searching the web?
Previously: #19672
Any other information, logs, or outputs that you want to share?
Contrary to when bootstrapping from scratch, building bazel with bazel works:
$ BAZEL=/usr/bin/bazel ./compile.sh
🍃 Building Bazel with Bazel.
.2023/12/12 13:06:16 Downloading https://releases.bazel.build/6.4.0/release/bazel-6.4.0-linux-x86_64...
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
...
Target //src:bazel_nojdk up-to-date:
bazel-bin/src/bazel_nojdk
INFO: Elapsed time: 431.183s, Critical Path: 138.05s
INFO: 2947 processes: 63 internal, 2084 local, 800 worker.
INFO: Build completed successfully, 2947 total actions
Build successful! Binary is here: /home/build/testme/output/bazel
$ unzip output/bazel A-server.jar
Archive: output/bazel
inflating: A-server.jar
$ unzip -l A-server.jar | grep -F _GsonTypeAdapter.class
3981 01-01-1980 00:00 com/google/devtools/build/lib/bazel/bzlmod/AttributeValues_GsonTypeAdapter.class
7945 01-01-1980 00:00 com/google/devtools/build/lib/bazel/bzlmod/BazelLockFileValue_GsonTypeAdapter.class
6648 01-01-1980 00:00 com/google/devtools/build/lib/bazel/bzlmod/BzlmodFlagsAndEnvVars_GsonTypeAdapter.class
4605 01-01-1980 00:00 com/google/devtools/build/lib/bazel/bzlmod/GsonTypeAdapterUtil_RootModuleFileEscapingLocation_GsonTypeAdapter.class
10559 01-01-1980 00:00 com/google/devtools/build/lib/bazel/bzlmod/InterimModule_GsonTypeAdapter.class
6948 01-01-1980 00:00 com/google/devtools/build/lib/bazel/bzlmod/LockFileModuleExtension_GsonTypeAdapter.class
3867 01-01-1980 00:00 com/google/devtools/build/lib/bazel/bzlmod/ModuleExtensionEvalFactors_GsonTypeAdapter.class
5393 01-01-1980 00:00 com/google/devtools/build/lib/bazel/bzlmod/ModuleExtensionMetadata_GsonTypeAdapter.class
9548 01-01-1980 00:00 com/google/devtools/build/lib/bazel/bzlmod/ModuleExtensionUsage_GsonTypeAdapter.class
8541 01-01-1980 00:00 com/google/devtools/build/lib/bazel/bzlmod/Module_GsonTypeAdapter.class
4684 01-01-1980 00:00 com/google/devtools/build/lib/bazel/bzlmod/RepoSpec_GsonTypeAdapter.class
5475 01-01-1980 00:00 com/google/devtools/build/lib/bazel/bzlmod/Tag_GsonTypeAdapter.class
Description of the bug:
When bootstrapping bazel from scratch using a distribution zip archive, the resulting bazel binary's
A-server.jardoes not contain the*_GsonTypeAdapter.classfiles which are needed for reading / writing theMODULE.bazel.lockfile.Which category does this issue belong to?
Core
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
mkdir build && cd buildunzip ~/Downloads/bazel-6.4.0-dist.zipenv EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk" bash ./compile.shunzip output/bazel A-server.jarunzip -l A-server.jar | grep -F _GsonTypeAdapter.class(this should produce some output, but does not)In a project with bzlmod enabled, trying to update the
MODULE.bazel.lockfile:When trying to run inside a project with a valid lock file, bazel crashes:
Which operating system are you running Bazel on?
Ubuntu Linux
What is the output of
bazel info release?n/a
If
bazel info releasereturnsdevelopment versionor(@non-git), tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD?No response
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
No response
Have you found anything relevant by searching the web?
Previously: #19672
Any other information, logs, or outputs that you want to share?
Contrary to when bootstrapping from scratch, building bazel with bazel works: