bazelbuild / bazel

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

Silent Bazel crash with duplicate --bes_header flags #19406

Open jin opened 1 year ago

jin commented 1 year ago

Description of the bug:

Bazel will silently crash with duplicate --bes_header flags. This is confusing and requires users to look into java.log to figure out what happened.

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.

$ mkdir /tmp/repro && cd /tmp/repro
$ touch WORKSPACE BUILD
$ export USE_BAZEL_VERSION=last_green
$ bazelisk info output_base
/usr/local/google/home/jingwen/.cache/bazel/_bazel_jingwen/a81b5ac6b5d7900969957b5de3807d8b
$ bazelisk build :all --bes_header=A=B --bes_header=A=B --bes_backend=buildeventservice-pa.googleapis.com 
# Silent crash
$ less /usr/local/google/home/jingwen/.cache/bazel/_bazel_jingwen/a81b5ac6b5d7900969957b5de3807d8b/java.log
30905 06:46:10.947:I 108 [com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec] Exit status was DetailedExitCode{exitCode=BLAZE_INTERNAL_ERROR, failureDetail=message: "Crashed: (java.lang.IllegalArgumentException) Multiple entries with same key: A=B and A=B"
crash {
  causes {
    throwable_class: "java.lang.IllegalArgumentException"
    message: "Multiple entries with same key: A=B and A=B"
    stack_trace: "com.google.common.collect.ImmutableMap.conflictException(ImmutableMap.java:377)"
    stack_trace: "com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:371)"
    stack_trace: "com.google.common.collect.RegularImmutableMap.checkNoConflictInKeyBucket(RegularImmutableMap.java:241)"
    stack_trace: "com.google.common.collect.RegularImmutableMap.fromEntryArrayCheckingBucketOverflow(RegularImmutableMap.java:132)"
    stack_trace: "com.google.common.collect.RegularImmutableMap.fromEntryArray(RegularImmutableMap.java:94)"
    stack_trace: "com.google.common.collect.RegularImmutableMap.fromEntries(RegularImmutableMap.java:77)"
    stack_trace: "com.google.common.collect.ImmutableMap.copyOf(ImmutableMap.java:714)"
    stack_trace: "com.google.devtools.build.lib.buildeventservice.BazelBuildEventServiceModule$BackendConfig.create(BazelBuildEventServiceModule.java:67)"
    stack_trace: "com.google.devtools.build.lib.buildeventservice.BazelBuildEventServiceModule.getBesClient(BazelBuildEventServiceModule.java:95)"
    stack_trace: "com.google.devtools.build.lib.buildeventservice.BuildEventServiceModule.createBesTransport(BuildEventServiceModule.java:712)"
    stack_trace: "com.google.devtools.build.lib.buildeventservice.BuildEventServiceModule.createBepTransports(BuildEventServiceModule.java:834)"
    stack_trace: "com.google.devtools.build.lib.buildeventservice.BuildEventServiceModule.beforeCommand(BuildEventServiceModule.java:352)"
    stack_trace: "com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:412)"
    stack_trace: "com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:244)"
    stack_trace: "com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:550)"
    stack_trace: "com.google.devtools.build.lib.server.GrpcServerImpl.lambda$run$1(GrpcServerImpl.java:621)"
    stack_trace: "io.grpc.Context$1.run(Context.java:566)"
    stack_trace: "java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)"
    stack_trace: "java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)"
    stack_trace: "java.base/java.lang.Thread.run(Unknown Source)"
  }
}
}

Which operating system are you running Bazel on?

linux

What is the output of bazel info release?

2023/09/05 06:47:20 Using unreleased version at commit 290fc80a5aae9dea06de52deed7098a5b8443f26

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

bazelisk

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

n/a

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

jin commented 1 year ago

Internal bug: b/299043633

hauserx commented 1 month ago

Looks like it's duplicate of https://github.com/bazelbuild/bazel/issues/20681, works correctly on last green now.