Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FATAL: bazel crashed due to an internal error. Printing stack trace: #19820

Closed
rnburn opened this issue Oct 15, 2023 · 2 comments
Closed

FATAL: bazel crashed due to an internal error. Printing stack trace: #19820

rnburn opened this issue Oct 15, 2023 · 2 comments
Labels
duplicate team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug untriaged

Comments

@rnburn
Copy link

rnburn commented Oct 15, 2023

Description of the bug:

In the process of upgrading to bazel 6.3.2, I get the error below.

There's probably something wrong with my config, but I expect bazel shouldn't be crashing like this.

rnburn@TheJester:~/proj/strix$ bazel build //...
Starting local Bazel server and connecting to it...
Analyzing: 2605 targets (407 packages loaded, 17594 targets configured)
    currently loading: @io_bazel_rules_go//
    Fetching repository @local_config_cc; starting
    Fetching ...dtools; Cloning d6daef01a1a2f41a4143a314bf1996bf351caa30 of https://github.com/bazelbuild/b\
uildtools
    Fetching ...chmark; Cloning bf585a2789e30585b4e3ce6baf11ef2750b54677 of https://github.com/google/bench\
mark
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.RuntimeException: Unrecoverable error while evaluating node 'REPOSITORY_DIRECTORY:@local_config_cc' (requested by nodes 'PACKAGE_LOOKUP:@local_config_cc//')
        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$RunnableExecuteAction.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.IllegalArgumentException: Multiple entries with same key: CXX=/usr/bin/clang++-18 and CXX=/usr/bin/clang++-18
        at com.google.common.collect.ImmutableMap.conflictException(ImmutableMap.java:377)
        at com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:371)
        at com.google.common.collect.RegularImmutableMap.checkNoConflictInKeyBucket(RegularImmutableMap.java:241)
        at com.google.common.collect.RegularImmutableMap.fromEntryArrayCheckingBucketOverflow(RegularImmutableMap.java:132)
        at com.google.common.collect.RegularImmutableMap.fromEntryArray(RegularImmutableMap.java:94)
        at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:573)
        at com.google.common.collect.ImmutableMap$Builder.buildOrThrow(ImmutableMap.java:601)
        at com.google.devtools.build.lib.skyframe.ActionEnvironmentFunction.getEnvironmentView(ActionEnvironmentFunction.java:105)
        at com.google.devtools.build.lib.rules.repository.RepositoryFunction.getEnvVarValues(RepositoryFunction.java:305)
        at com.google.devtools.build.lib.rules.repository.RepositoryFunction.declareEnvironmentDependencies(RepositoryFunction.java:293)
        at com.google.devtools.build.lib.bazel.repository.starlark.StarlarkRepositoryFunction.fetch(StarlarkRepositoryFunction.java:123)
        at com.google.devtools.build.lib.rules.repository.RepositoryDelegatorFunction.fetchRepository(RepositoryDelegatorFunction.java:411)
        at com.google.devtools.build.lib.rules.repository.RepositoryDelegatorFunction.compute(RepositoryDelegatorFunction.java:342)
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:562)
        ... 7 more

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.

Maybe add multiple CXX options?

Which operating system are you running Bazel on?

linux

What is the output of bazel info release?

release 6.3.2

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?

No response

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

No response

@rnburn
Copy link
Author

rnburn commented Oct 15, 2023

I have a custom cc_configure in my project (below). It looks like putting CXX twice in environ triggered the crash.

I think bazel is missing a validation step for repository_rules... Or maybe it should just ignore multiple entries which it seemed to do up until at least 5.3.2.

cc_autoconf = repository_rule(
    implementation = cc_autoconf_impl,
    attrs = {
        "_proj_cc_wrapper": attr.label(default = "@com_github_rnburn_strix//bazel:cc_wrapper.py"),
    },   
 environ = [
        "ABI_LIBC_VERSION",
        "ABI_VERSION",
        "BAZEL_COMPILER",
        "BAZEL_HOST_SYSTEM",
        "BAZEL_PYTHON",
        "BAZEL_SH",
        "BAZEL_TARGET_CPU",
        "BAZEL_TARGET_LIBC",
        "BAZEL_TARGET_SYSTEM",
        "BAZEL_USE_CPP_ONLY_TOOLCHAIN",
        "BAZEL_VC",
        "BAZEL_VS",
        "CC",
        "CXX",
        "CC_CONFIGURE_DEBUG",
        "CC_TOOLCHAIN_NAME",
        "CPLUS_INCLUDE_PATH",
        "CUDA_COMPUTE_CAPABILITIES",
        "CUDA_PATH",
        "CXX",
        "HOMEBREW_RUBY_PATH",
        "NO_WHOLE_ARCHIVE_OPTION",
        "USE_DYNAMIC_CRT",
        "USE_MSVC_WRAPPER",
        "SYSTEMROOT",
        "VS90COMNTOOLS",
        "VS100COMNTOOLS",
        "VS110COMNTOOLS",
        "VS120COMNTOOLS",
        "VS140COMNTOOLS",
    ],
)

@fmeum
Copy link
Collaborator

fmeum commented Oct 15, 2023

This is a duplicate of #19244. The fix #19245 is available in last_green, but not in 6.X yet.

@Pavank1992 Pavank1992 added duplicate team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. labels Oct 16, 2023
@iancha1992 iancha1992 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug untriaged
Projects
None yet
Development

No branches or pull requests

5 participants