bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.23k stars 4.07k forks source link

Starlark debugger crashes when a method references a symbol in the outer scope #24339

Open tpasternak opened 19 hours ago

tpasternak commented 19 hours ago

Description of the bug:

Bazel throws:

ERROR: Debug server listener thread died: java.lang.NullPointerException: null value in entry: l=null
    at com.google.common.collect.CollectPreconditions.checkEntryNotNull(CollectPreconditions.java:33)
    at com.google.common.collect.ImmutableMapEntry.<init>(ImmutableMapEntry.java:54)
    at com.google.common.collect.ImmutableMap.entryOf(ImmutableMap.java:341)
    at com.google.common.collect.ImmutableMap$Builder.put(ImmutableMap.java:450)
    at net.starlark.java.eval.StarlarkThread$Frame.getLocals(StarlarkThread.java:192)
    at com.google.devtools.build.lib.starlarkdebug.server.DebugEventHelper.getScopes(DebugEventHelper.java:150)
    at com.google.devtools.build.lib.starlarkdebug.server.DebugEventHelper.getFrameProto(DebugEventHelper.java:139)
    at com.google.devtools.build.lib.starlarkdebug.server.ThreadHandler.lambda$listFrames$1(ThreadHandler.java:240)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
    at java.base/java.util.Collections$2.tryAdvance(Unknown Source)
    at java.base/java.util.Collections$2.forEachRemaining(Unknown Source)
    at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
    at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
    at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
    at com.google.devtools.build.lib.starlarkdebug.server.ThreadHandler.listFrames(ThreadHandler.java:241)
    at com.google.devtools.build.lib.starlarkdebug.server.StarlarkDebugServer.listFrames(StarlarkDebugServer.java:187)
    at com.google.devtools.build.lib.starlarkdebug.server.StarlarkDebugServer.handleClientRequest(StarlarkDebugServer.java:162)
    at com.google.devtools.build.lib.starlarkdebug.server.StarlarkDebugServer.lambda$listenForClientRequests$0(StarlarkDebugServer.java:94)
    at java.base/java.lang.Thread.run(Unknown Source)%  

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.

Please just watch the movie:

https://github.com/user-attachments/assets/49e87337-470c-45eb-a438-8f7d15dce8ed

Which operating system are you running Bazel on?

No response

What is the output of bazel info release?

release 7.4.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

If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

meisterT commented 17 hours ago

cc @hvadehra