bazel
bazel copied to clipboard
Bazel crash on `fail(*some_tuple)`
Description of the bug:
Bazel crashes when fail() is applied to a tuple using the splat operator, i.e. fail(*some_tuple).
Which category does this issue belong to?
No response
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Checkout https://github.com/aherrmann/rules_zig/commit/c2f9bb6b97a6a7b429f99d81dde74167ba61c49a. Then run
$ cd e2e/workspace
$ bazel test //...
...
java.lang.NullPointerException: Cannot invoke "com.google.devtools.build.lib.skyframe.PackageValue.getPackage()" because the return value of "java.util.Map.get(Object)" is null
at com.google.devtools.build.lib.skyframe.StarlarkBuildSettingsDetailsFunction.verifyBuildSettingsAndGetAliases(StarlarkBuildSettingsDetailsFunction.java:209)
at com.google.devtools.build.lib.skyframe.StarlarkBuildSettingsDetailsFunction.getBuildSettingPackages(StarlarkBuildSettingsDetailsFunction.java:172)
at com.google.devtools.build.lib.skyframe.StarlarkBuildSettingsDetailsFunction.compute(StarlarkBuildSettingsDetailsFunction.java:71)
at com.google.devtools.build.skyframe.ParallelEvaluator.bubbleErrorUp(ParallelEvaluator.java:422)
at com.google.devtools.build.skyframe.ParallelEvaluator.waitForCompletionAndConstructResult(ParallelEvaluator.java:212)
at com.google.devtools.build.skyframe.ParallelEvaluator.doMutatingEvaluation(ParallelEvaluator.java:178)
at com.google.devtools.build.skyframe.ParallelEvaluator.eval(ParallelEvaluator.java:676)
at com.google.devtools.build.skyframe.InMemoryMemoizingEvaluator.evaluate(InMemoryMemoizingEvaluator.java:147)
at com.google.devtools.build.lib.skyframe.SkyframeExecutor.evaluateBuildDriverKeys(SkyframeExecutor.java:2040)
at com.google.devtools.build.lib.skyframe.SkyframeBuildView.analyzeAndExecuteTargets(SkyframeBuildView.java:667)
at com.google.devtools.build.lib.analysis.BuildView.update(BuildView.java:292)
at com.google.devtools.build.lib.buildtool.AnalysisAndExecutionPhaseRunner.runAnalysisAndExecutionPhase(AnalysisAndExecutionPhaseRunner.java:241)
at com.google.devtools.build.lib.buildtool.AnalysisAndExecutionPhaseRunner.execute(AnalysisAndExecutionPhaseRunner.java:139)
at com.google.devtools.build.lib.buildtool.BuildTool.buildTargetsWithMergedAnalysisExecution(BuildTool.java:305)
at com.google.devtools.build.lib.buildtool.BuildTool.buildTargets(BuildTool.java:173)
at com.google.devtools.build.lib.buildtool.BuildTool.processRequest(BuildTool.java:510)
at com.google.devtools.build.lib.buildtool.BuildTool.processRequest(BuildTool.java:478)
at com.google.devtools.build.lib.runtime.commands.TestCommand.doTest(TestCommand.java:163)
at com.google.devtools.build.lib.runtime.commands.TestCommand.exec(TestCommand.java:116)
at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:664)
at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:244)
at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:573)
at com.google.devtools.build.lib.server.GrpcServerImpl.lambda$run$1(GrpcServerImpl.java:644)
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)
Which operating system are you running Bazel on?
Ubuntu 22.04
What is the output of bazel info release?
release 7.1.1
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 HEAD ?
No response
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
not that I know
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
fail is invoked here in the example
This passes for me:
diff --git a/src/test/java/net/starlark/java/eval/MethodLibraryTest.java b/src/test/java/net/starlark/java/eval/MethodLibraryTest.java
index 933c951b1d..d2d34877b7 100644
--- a/src/test/java/net/starlark/java/eval/MethodLibraryTest.java
+++ b/src/test/java/net/starlark/java/eval/MethodLibraryTest.java
@@ -756,6 +756,7 @@ public final class MethodLibraryTest {
.testIfErrorContains("18", "fail(18)")
.testIfErrorContains("1 2 3", "fail(1, 2, 3)")
.testIfErrorContains("1, 2, 3", "fail(1, 2, 3, sep=', ')")
+ .testIfErrorContains("1 2 3", "fail(*(1, 2, 3))")
.testIfErrorContains("attribute foo: 1 2 3", "fail(1, 2, 3, attr='foo')") // deprecated
.testIfErrorContains("0 1 2 3", "fail(1, 2, 3, msg=0)"); // deprecated
}
I suspect that the root cause is something else here: Maybe the fail does work, but the resulting failure is swallowed somewhere in the transition logic (the stack trace looks like this) and results in an NPE at a later point?