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

Hard crash due to "No such attribute testonly in new_http_archive rule //external:zlib" #3676

Closed
endobson opened this issue Sep 4, 2017 · 5 comments
Assignees
Labels
P1 I'll work on this now. (Assignee required) type: bug

Comments

@endobson
Copy link
Contributor

endobson commented Sep 4, 2017

Source code:
https://github.com/endobson/examples/tree/testonly-crash

bazel version 0.5.4

endobson@yggdrasil () ~/proj/bes-example % bazel build @googleapis//:build_event_service_grpc_cc                                                                                                                                          (0)
INFO: Reading 'startup' options from /Users/endobson/.bazelrc: --watchfs
.............
Unhandled exception thrown during build; message: Unrecoverable error while evaluating node 'CONFIGURED_TARGET:@grpc//:grpc_base_c 1bde2b824d8d0d8b964fcc970e455a65 (252815988 848607884)' (requested by nodes 'CONFIGURED_TARGET:@grpc//:grpc_base 1bde2b824d8d0d8b964fcc970e455a65 (1365554887 848607884)')
INFO: Elapsed time: 4.727s
java.lang.RuntimeException: Unrecoverable error while evaluating node 'CONFIGURED_TARGET:@grpc//:grpc_base_c 1bde2b824d8d0d8b964fcc970e455a65 (252815988 848607884)' (requested by nodes 'CONFIGURED_TARGET:@grpc//:grpc_base 1bde2b824d8d0d8b964fcc970e455a65 (1365554887 848607884)')
        at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:475)
        at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:352)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: No such attribute testonly in new_http_archive rule //external:zlib
        at com.google.devtools.build.lib.packages.AbstractAttributeMapper.getIndexWithTypeCheck(AbstractAttributeMapper.java:229)
        at com.google.devtools.build.lib.packages.AbstractAttributeMapper.get(AbstractAttributeMapper.java:57)
        at com.google.devtools.build.lib.packages.NonconfigurableAttributeMapper.get(NonconfigurableAttributeMapper.java:45)
        at com.google.devtools.build.lib.bazel.rules.BazelPrerequisiteValidator.isTestOnlyRule(BazelPrerequisiteValidator.java:130)
        at com.google.devtools.build.lib.bazel.rules.BazelPrerequisiteValidator.validateDirectPrerequisiteForTestOnly(BazelPrerequisiteValidator.java:113)
        at com.google.devtools.build.lib.bazel.rules.BazelPrerequisiteValidator.validate(BazelPrerequisiteValidator.java:38)
        at com.google.devtools.build.lib.analysis.RuleContext$Builder.validateDirectPrerequisite(RuleContext.java:2078)
        at com.google.devtools.build.lib.analysis.RuleContext$Builder.createTargetMap(RuleContext.java:1794)
        at com.google.devtools.build.lib.analysis.RuleContext$Builder.build(RuleContext.java:1621)
        at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createRule(ConfiguredTargetFactory.java:315)
        at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createConfiguredTarget(ConfiguredTargetFactory.java:228)
        at com.google.devtools.build.lib.skyframe.SkyframeBuildView.createConfiguredTarget(SkyframeBuildView.java:494)
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.createConfiguredTarget(ConfiguredTargetFunction.java:1164)
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.compute(ConfiguredTargetFunction.java:269)
        at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:400)
        ... 4 more
java.lang.RuntimeException: Unrecoverable error while evaluating node 'CONFIGURED_TARGET:@grpc//:grpc_base_c 1bde2b824d8d0d8b964fcc970e455a65 (252815988 848607884)' (requested by nodes 'CONFIGURED_TARGET:@grpc//:grpc_base 1bde2b824d8d0d8b964fcc970e455a65 (1365554887 848607884)')
        at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:475)
        at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:352)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: No such attribute testonly in new_http_archive rule //external:zlib
        at com.google.devtools.build.lib.packages.AbstractAttributeMapper.getIndexWithTypeCheck(AbstractAttributeMapper.java:229)
        at com.google.devtools.build.lib.packages.AbstractAttributeMapper.get(AbstractAttributeMapper.java:57)
        at com.google.devtools.build.lib.packages.NonconfigurableAttributeMapper.get(NonconfigurableAttributeMapper.java:45)
        at com.google.devtools.build.lib.bazel.rules.BazelPrerequisiteValidator.isTestOnlyRule(BazelPrerequisiteValidator.java:130)
        at com.google.devtools.build.lib.bazel.rules.BazelPrerequisiteValidator.validateDirectPrerequisiteForTestOnly(BazelPrerequisiteValidator.java:113)
        at com.google.devtools.build.lib.bazel.rules.BazelPrerequisiteValidator.validate(BazelPrerequisiteValidator.java:38)
        at com.google.devtools.build.lib.analysis.RuleContext$Builder.validateDirectPrerequisite(RuleContext.java:2078)
        at com.google.devtools.build.lib.analysis.RuleContext$Builder.createTargetMap(RuleContext.java:1794)
        at com.google.devtools.build.lib.analysis.RuleContext$Builder.build(RuleContext.java:1621)
        at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createRule(ConfiguredTargetFactory.java:315)
        at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createConfiguredTarget(ConfiguredTargetFactory.java:228)
        at com.google.devtools.build.lib.skyframe.SkyframeBuildView.createConfiguredTarget(SkyframeBuildView.java:494)
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.createConfiguredTarget(ConfiguredTargetFunction.java:1164)
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.compute(ConfiguredTargetFunction.java:269)
        at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:400)
        ... 4 more
@endobson
Copy link
Contributor Author

endobson commented Sep 4, 2017

This looks like it is partially caused by the new_http_archive and bind call in the WORKSPACE file both using the name "zlib". If I change them to be different then it doesn't crash.

@meteorcloudy
Copy link
Member

Looks like we have the solution here, I'm closing this issue, please reopen if having any more questions.

@endobson
Copy link
Contributor Author

endobson commented Sep 4, 2017

I have a workaround not a solution, so please reopen (the acls don't let me do it myself.)

The bug here is that bazel crashes on some input, which it should never do, it should instead nicely print an error message if there is an error.

There is also the problem that the workspace file is accepted, and many things work but some particular configuration of rules don't like the reused names. Either using the name twice is an error and there should be always be an error message in that scenario or what ever thing is erroring out needs to figure out how to handle this situation and not produce an error.

@meteorcloudy meteorcloudy reopened this Sep 4, 2017
@meteorcloudy meteorcloudy added category: extensibility > external repositories P2 We'll consider working on this in future. (Assignee optional) type: bug labels Sep 4, 2017
@dslomov dslomov added P1 I'll work on this now. (Assignee required) external-repos-triaged and removed P2 We'll consider working on this in future. (Assignee optional) labels Jan 9, 2018
@dslomov dslomov self-assigned this Jan 12, 2018
@dslomov
Copy link
Contributor

dslomov commented Jan 12, 2018

https://bazel-review.googlesource.com/c/bazel/+/31892 is the work towards fixing the hard crash. We need to revisit the general question of duplicate names (see also #588, #1952)

bazel-io pushed a commit that referenced this issue Jan 15, 2018
…: target.

Work towards #3676.

The behavior is still incorrect (we should in fact disallow this), but
at least there is no hard crash.

Change-Id: I5181dba73ad725d20b2ea82b2f19e86664b9dbff
PiperOrigin-RevId: 181954820
@dslomov
Copy link
Contributor

dslomov commented Jan 15, 2018

Hard crash is fixed in 822a8b3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 I'll work on this now. (Assignee required) type: bug
Projects
None yet
Development

No branches or pull requests

3 participants