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

HEAD crash after incompatible_enforce_config_setting_visibility #16446

Closed
keith opened this issue Oct 10, 2022 · 6 comments
Closed

HEAD crash after incompatible_enforce_config_setting_visibility #16446

keith opened this issue Oct 10, 2022 · 6 comments
Assignees
Labels
breakage P1 I'll work on this now. (Assignee required) team-Configurability platforms, toolchains, cquery, select(), config transitions type: bug

Comments

@keith
Copy link
Member

keith commented Oct 10, 2022

Description of the bug:

FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.RuntimeException: Unrecoverable error while evaluating node 'ConfiguredTargetKey{label=//doc:test_setup, config=BuildConfigurationKey[630cafa1c48a364b2467476885d51433a52c036dcff80d6d9ae99bce1a4ff886]}' (requested by nodes )
        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.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.IllegalStateException: Configurations don't match: BuildConfigurationKey[630cafa1c48a364b2467476885d51433a52c036dcff80d6d9ae99bce1a4ff886] BuildConfigurationKey[6a7278dae5db84a0f240ae2ba630f3e2171f37f2bbf86ba0cd0f54949d474623] 630cafa1c48a364b2467476885d51433a52c036dcff80d6d9ae99bce1a4ff886 (ConfiguredTarget(@bazel_tools//src/conditions:host_windows_x64_constraint, 6a7278dae5db84a0f240ae2ba630f3e2171f37f2bbf86ba0cd0f54949d474623) config_setting rule @bazel_tools//src/conditions:host_windows_x64_constraint)
        at com.google.common.base.Preconditions.checkState(Preconditions.java:534)
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetAndData.<init>(ConfiguredTargetAndData.java:72)
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetAndData.fromConfiguredTarget(ConfiguredTargetAndData.java:124)
        at com.google.devtools.build.lib.analysis.RuleContext$Builder.build(RuleContext.java:1759)
        at com.google.devtools.build.lib.analysis.RuleContext$Builder.build(RuleContext.java:1704)
        at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createRule(ConfiguredTargetFactory.java:324)
        at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createConfiguredTarget(ConfiguredTargetFactory.java:192)
        at com.google.devtools.build.lib.skyframe.SkyframeBuildView.createConfiguredTarget(SkyframeBuildView.java:1231)
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.createConfiguredTarget(ConfiguredTargetFunction.java:1197)
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.compute(ConfiguredTargetFunction.java:414)
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:571)
        ... 7 more

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Clone rules_swift, run USE_BAZEL_VERSION=174c67f0911c1cb013658f9b2b2d8959d6ef388c bazelisk build ...

I bisected to 174c67f, setting the flag to false does not avoid it

CI logs: https://buildkite.com/bazel/rules-swift-swift/builds/3745#0183c3e2-c2a4-4abc-9330-16b8c93f1b71

Which operating system are you running Bazel on?

macOS

What is the output of bazel info release?

174c67f

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

Have you found anything relevant by searching the web?

No response

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

No response

@keith
Copy link
Member Author

keith commented Oct 10, 2022

cc @gregestren

keith added a commit to bazelbuild/rules_swift that referenced this issue Oct 10, 2022
keith added a commit to bazelbuild/rules_swift that referenced this issue Oct 10, 2022
@gregestren
Copy link
Contributor

Thanks for the repro: I was trying to figure out how to trigger this from #12932 (comment).

@gregestren gregestren self-assigned this Oct 10, 2022
@gregestren gregestren added team-Configurability platforms, toolchains, cquery, select(), config transitions type: bug P1 I'll work on this now. (Assignee required) labels Oct 10, 2022
@gregestren
Copy link
Contributor

More direct:

USE_BAZEL_VERSION=174c67f0911c1cb013658f9b2b2d8959d6ef388c bazelisk build //doc:test_setup

@gregestren
Copy link
Contributor

Found a minimal repro:

$ cat aa/defs.bzl
def _impl(ctx):
    output = ctx.outputs.out
    ctx.actions.write(output = output, content = "hi", is_executable = True)
    return [DefaultInfo(executable = output)]

fake_test = rule(
    attrs = {
        "msg": attr.string(),
    },
    test = True,
    outputs = {"out": "foo.out"},
    implementation = _impl,
)
$ cat aa/BUILD
load(":defs.bzl", "fake_test")

config_setting(
    name = "actual_setting",
    define_values = {"a": "1"},
)

alias(
    name = "alias_setting",
    actual = ":actual_setting",
)

fake_test(
    name = "foo",
    msg = select({
        ":alias_setting": "hi",
        "//conditions:default": "there",
    }),
)
$ bazel build //aa:foo --incompatible_enforce_config_setting_visibility --trim_test_configuration
<crash>

This is how I found it:

  • $ bazel query --output=build //doc:test_setup
  • Built a filegroup target with the same select() as in the above.
  • That succeeded.
  • Since Bazel didn't crash, I could run $ bazel config 630c 6a72
  • That showed me that one config had TestOptions while the other didn't
  • That's basically the definition of --trim_test_configuration. This also explains why the filegroup succeeded but diff_test didn't: --trim_test_configuration only trims non-test targets. So in the failing build you get two distinct configurations: one for the *_test* and one for the config_setting it depends on

@gregestren
Copy link
Contributor

@meteorcloudy
Copy link
Member

Looks like the fix still need some tweaks, I'm rolling back the flag flip first.

copybara-service bot pushed a commit that referenced this issue Oct 11, 2022
*** Reason for rollback ***

The flip of this flag triggered some bug, the fix is in progress but rollback first to get a green downstream

#16446

*** Original change description ***

Default --incompatible_enforce_config_setting_visibility to true.

Fixes #12932.

PiperOrigin-RevId: 480281435
Change-Id: If6b45540fb21ba78fcafbca515d285f3e84932f0
copybara-service bot pushed a commit that referenced this issue Oct 11, 2022
174c67f

This was rolled back in
cef1437
while 268be23 was processing.

Fixes #12932
For #16446

PiperOrigin-RevId: 480364678
Change-Id: I4a8c05d748428e0493880796db40f3b718d0ad7b
aiuto pushed a commit to aiuto/bazel that referenced this issue Oct 12, 2022
*** Reason for rollback ***

The flip of this flag triggered some bug, the fix is in progress but rollback first to get a green downstream

bazelbuild#16446

*** Original change description ***

Default --incompatible_enforce_config_setting_visibility to true.

Fixes bazelbuild#12932.

PiperOrigin-RevId: 480281435
Change-Id: If6b45540fb21ba78fcafbca515d285f3e84932f0
aiuto pushed a commit to aiuto/bazel that referenced this issue Oct 12, 2022
Reproducing requires bazelbuild@a3a4cf8 and --incompatible_enforce_config_setting_visibility=1.

This is an obscure crash caused by a) building a test, b) with a select() on an alias, c) with --trim_test_configuration=1.

Details in commit.

For bazelbuild#12932.
Fixes bazelbuild#16446.

PiperOrigin-RevId: 480356600
Change-Id: I27227616dd2d1681b7769a29b73dac457f59d9b7
aiuto pushed a commit to aiuto/bazel that referenced this issue Oct 12, 2022
bazelbuild@174c67f

This was rolled back in
bazelbuild@cef1437
while bazelbuild@268be23 was processing.

Fixes bazelbuild#12932
For bazelbuild#16446

PiperOrigin-RevId: 480364678
Change-Id: I4a8c05d748428e0493880796db40f3b718d0ad7b
tymurmustafaiev pushed a commit to tymurmustafaiev/rules_swift that referenced this issue Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breakage P1 I'll work on this now. (Assignee required) team-Configurability platforms, toolchains, cquery, select(), config transitions type: bug
Projects
None yet
Development

No branches or pull requests

3 participants