buchgr / bazel-remote

A remote cache for Bazel
https://bazel.build
Apache License 2.0
608 stars 157 forks source link

[Bazel CI] IllegalStateException and Unrecoverable error while evaluating node 'PlatformMappingValue.Keywith Bazel #772

Closed sgowroji closed 2 months ago

sgowroji commented 2 months ago

CI: https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/4089#0191a183-426e-4156-8022-89b74d184b1a

Platform: Ubuntu

Logs:

bazel --nosystem_rc --nohome_rc info
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.IllegalStateException: java.lang.RuntimeException: Unrecoverable error while evaluating node 'PlatformMappingValue.Key{path=platform_mappings, wasExplicitlySetByUser=false}' (requested by nodes 'BuildConfigurationKeyValue.Key{buildOptions=66cde87dcb43463733a906bf8bc70de6426656e05afd82628d1030fedd69a843}')
    at com.google.devtools.build.lib.skyframe.SkyframeExecutor.evaluateSkyKeys(SkyframeExecutor.java:2026)
    at com.google.devtools.build.lib.skyframe.SkyframeExecutor.evaluateSkyKeys(SkyframeExecutor.java:2002)
    at com.google.devtools.build.lib.skyframe.SkyframeExecutor.createBuildConfigurationKey(SkyframeExecutor.java:1958)
    at com.google.devtools.build.lib.skyframe.SkyframeExecutor.getConfiguration(SkyframeExecutor.java:1882)
    at com.google.devtools.build.lib.runtime.commands.InfoCommand.lambda$exec$0(InfoCommand.java:158)
    at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:181)
    at com.google.devtools.build.lib.runtime.commands.InfoCommand.exec(InfoCommand.java:219)
    at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:679)
    at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:252)
    at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:607)
    at com.google.devtools.build.lib.server.GrpcServerImpl.lambda$run$1(GrpcServerImpl.java:676)
    at io.grpc.Context$1.run(Context.java:566)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: Unrecoverable error while evaluating node 'PlatformMappingValue.Key{path=platform_mappings, wasExplicitlySetByUser=false}' (requested by nodes 'BuildConfigurationKeyValue.Key{buildOptions=66cde87dcb43463733a906bf8bc70de6426656e05afd82628d1030fedd69a843}')
    at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:547)
    at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:435)
    at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(Unknown Source)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
    at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Caused by: java.lang.NullPointerException: Null repoMapping
    at com.google.devtools.build.lib.cmdline.AutoValue_Label_RepoContextImpl.<init>(AutoValue_Label_RepoContextImpl.java:20)
    at com.google.devtools.build.lib.cmdline.Label$RepoContext.of(Label.java:122)
    at com.google.devtools.build.lib.skyframe.config.PlatformMappingFunction.compute(PlatformMappingFunction.java:82)
    at com.google.devtools.build.lib.skyframe.config.PlatformMappingFunction.compute(PlatformMappingFunction.java:60)
    at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:467)
    ... 7 more
Traceback (most recent call last):
  File "bazelci.py", line 4544, in <module>
    sys.exit(main())
  File "bazelci.py", line 4522, in main
    bazel_version=task_config.get("bazel") or configs.get("bazel"),
  File "bazelci.py", line 1318, in execute_commands
    bazel_version = print_bazel_version_info(bazel_binary, platform)
  File "bazelci.py", line 1621, in print_bazel_version_info
    [bazel_binary] + common_startup_flags() + ["--nosystem_rc", "--nohome_rc", "info"]
  File "bazelci.py", line 2741, in execute_command
    subprocess.PIPE if capture_stderr else None
  File "/usr/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['bazel', '--nosystem_rc', '--nohome_rc', 'info']' returned non-zero exit status 37.
🚨 Error: The command exited with status 1

Culprit: bazelbuild/bazel@5881c38

CC Greenteam @mai93 @meteorcloudy

mostynb commented 2 months ago

Added common --enable_workspace=true to .bazelrc until we're ready to migrate to bzlmod, so this might turn green on your side.

mostynb commented 2 months ago

Migrated to bzlmod now.

Is there a bazel issue filed for this, it should probably fail with a nice error message instead of crashing with a stack trace.

sgowroji commented 2 months ago

@mostynb Thanks for the fix. We can close this issue now.

mostynb commented 2 months ago

@sgowroji: just checking, should we open a bazel issue for this (print a useful error message instead of a big stack trace)?