-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Closed
Labels
P1I'll work on this now. (Assignee required)I'll work on this now. (Assignee required)area-BzlmodBzlmod-specific PRs, issues, and feature requestsBzlmod-specific PRs, issues, and feature requestshelp wantedSomeone outside the Bazel team could own thisSomeone outside the Bazel team could own thisteam-ExternalDepsExternal dependency handling, remote repositiories, WORKSPACE file.External dependency handling, remote repositiories, WORKSPACE file.type: bug
Description
Description of the bug:
While trying to use the Bazel Module extension feature, I found a crash and I have not idea what's causing it.
I'm configuring the module build_tools_reloaded (a custom toolchain) from the TEST_PARTITION project.
The crash :
Loading: 0 packages loaded
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.RuntimeException: Unrecoverable error while evaluating node 'SINGLE_EXTENSION_EVAL:ModuleExtensionId{bzlFileLabel=@build_tools_reloaded~override//extensions:extensions.bzl, extensionName=build_tools_reloaded}' (requested by nodes 'BZLMOD_REPO_RULE:@build_tools_reloaded~override~build_tools_reloaded~build_tools_reloaded')
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(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: net.starlark.java.eval.Starlark$UncheckedEvalException: IllegalStateException thrown during Starlark evaluation
at <starlark>.init_helionix_toolchain(<builtin>:0)
at <starlark>._build_tools_reloaded_impl(C:/tools/dev/bazel_install/6fao65yg/external/build_tools_reloaded~override/extensions/extensions.bzl:7)
Caused by: java.lang.IllegalStateException: Expected BazelStarlarkContext to be available in this Starlark thread
at com.google.common.base.Preconditions.checkState(Preconditions.java:502)
at com.google.devtools.build.lib.packages.BazelStarlarkContext.from(BazelStarlarkContext.java:77)
at com.google.devtools.build.lib.analysis.starlark.StarlarkRuleClassFunctions$StarlarkRuleFunction.call(StarlarkRuleClassFunctions.java:776)
at net.starlark.java.eval.StarlarkCallable.fastcall(StarlarkCallable.java:86)
at net.starlark.java.eval.Starlark.fastcall(Starlark.java:638)
at net.starlark.java.eval.Eval.evalCall(Eval.java:682)
at net.starlark.java.eval.Eval.eval(Eval.java:497)
at net.starlark.java.eval.Eval.exec(Eval.java:271)
at net.starlark.java.eval.Eval.execStatements(Eval.java:82)
at net.starlark.java.eval.Eval.execFunctionBody(Eval.java:66)
at net.starlark.java.eval.StarlarkFunction.fastcall(StarlarkFunction.java:173)
at net.starlark.java.eval.Starlark.fastcall(Starlark.java:638)
at com.google.devtools.build.lib.bazel.bzlmod.SingleExtensionEvalFunction.compute(SingleExtensionEvalFunction.java:187)
at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:571)
at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:382)
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)
The command:
bazel build //:TEST_BIN --enable_bzlmod --override_module=build_tools_reloaded=..\BUILD_TOOLS_RELOADED --platforms=@build_tools_reloaded//platforms:myPlatform
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
TEST_PARTITION/MODULE.bazel:
[...]
bazel_dep(name = "build_tools_reloaded", version = "0.0.1", repo_name="build_tools_reloaded_unconfigured")
build_tools_reloaded = use_extension("@build_tools_reloaded_unconfigured//extensions:extensions.bzl", "build_tools_reloaded")
build_tools_reloaded.configure(includes=["TEST1","TEST2","TEST3"])
use_repo(build_tools_reloaded, "build_tools_reloaded")
[...]
build_tools_reloaded/extensions/extensions.bzl:
load("//toolchain/:rules.bzl", "init_my_toolchain")
def _build_tools_reloaded_impl(module_ctx):
init_my_toolchain(arg1=["TEST4","TEST5","TEST6"])
_configure = tag_class(attrs =
{
"includes": attr.string_list(),
})
build_tools_reloaded = module_extension(
implementation = _build_tools_reloaded_impl,
tag_classes = {
"configure": _configure
}
)
build_tools_reloaded/toolchain/rules.bzl:
def _init_my_toolchain_impl(ctx):
print("RULE CALLED")
init_my_toolchain = rule(
_init_my_toolchain_impl,
attrs = {
"arg1": attr.string_list()
}
)
Which operating system are you running Bazel on?
Windows
What is the output of bazel info release?
release 6.2.0
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?
Maybe similar to : #14974
Any other information, logs, or outputs that you want to share?
No response
Metadata
Metadata
Assignees
Labels
P1I'll work on this now. (Assignee required)I'll work on this now. (Assignee required)area-BzlmodBzlmod-specific PRs, issues, and feature requestsBzlmod-specific PRs, issues, and feature requestshelp wantedSomeone outside the Bazel team could own thisSomeone outside the Bazel team could own thisteam-ExternalDepsExternal dependency handling, remote repositiories, WORKSPACE file.External dependency handling, remote repositiories, WORKSPACE file.type: bug