bazelbuild/bazel

error building packages with visibility with bazel 0.5.4 and rules_go 0.6.0

nlacasse opened this issue · 3 comments

Description of the problem / feature request / question:

I'm using Bazel version 0.5.4, and just upgraded rules_go plugin to 0.6.0. Now building packages with non-default visibility breaks.

Upgrading Bazel to version 0.6.1 fixes this issue.

If possible, provide a minimal example to reproduce the problem:

A simple repro package is here:

https://github.com/nlacasse/rules_go/tree/visibility_test/tests/visibility

$ bazel build //tests/visibility:foo                                                                                                                                                                                                        
...........
Unhandled exception thrown during build; message: Unrecoverable error while evaluating node 'CONFIGURED_TARGET://tests/visibility:foo 0f763d6a9b9fd42cc649394441b374f2 (1803222502 2081008356)' (requested by nodes )
INFO: Elapsed time: 3.308s
FAILED: Build did NOT complete successfully (15 packages loaded)
java.lang.RuntimeException: Unrecoverable error while evaluating node 'CONFIGURED_TARGET://tests/visibility:foo 0f763d6a9b9fd42cc649394441b374f2 (1803222502 2081008356)' (requested by nodes )
        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.NullPointerException
        at com.google.devtools.build.lib.analysis.ToolchainContext.lambda$findToolchains$0(ToolchainContext.java:131)
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
        at com.google.common.collect.CollectSpliterators$1.lambda$tryAdvance$0(CollectSpliterators.java:110)
        at java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1812)
        at com.google.common.collect.CollectSpliterators$1.tryAdvance(CollectSpliterators.java:109)
        at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
        at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
        at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
        at com.google.devtools.build.lib.analysis.ToolchainContext.findToolchains(ToolchainContext.java:132)
        at com.google.devtools.build.lib.analysis.ToolchainContext.resolveToolchains(ToolchainContext.java:89)
        at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createRule(ConfiguredTargetFactory.java:298)
        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://tests/visibility:foo 0f763d6a9b9fd42cc649394441b374f2 (1803222502 2081008356)' (requested by nodes )
        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.NullPointerException
        at com.google.devtools.build.lib.analysis.ToolchainContext.lambda$findToolchains$0(ToolchainContext.java:131)
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
        at com.google.common.collect.CollectSpliterators$1.lambda$tryAdvance$0(CollectSpliterators.java:110)
        at java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1812)
        at com.google.common.collect.CollectSpliterators$1.tryAdvance(CollectSpliterators.java:109)
        at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
        at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
        at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
        at com.google.devtools.build.lib.analysis.ToolchainContext.findToolchains(ToolchainContext.java:132)
        at com.google.devtools.build.lib.analysis.ToolchainContext.resolveToolchains(ToolchainContext.java:89)
        at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createRule(ConfiguredTargetFactory.java:298)
        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

Environment info

  • Operating System:
    Ubuntu

  • Bazel version (output of bazel info release):
    0.5.4

Have you found anything relevant by searching the web?

I originally filed this bug for the rules_go project here, but was told to file it for bazel, as the actual crash is coming from bazel.

katre commented

If this is fixed in Bazel 0.6.1, is there anything further to do? We're not going to be able to patch a fix into 0.5.4.

katre commented

@nlacasse, what sort of resolution would you like to see for this issue?

I'm fine closing this, since it has been fixed in 0.6.1.

I mostly wanted to file it for posterity, and in case anybody else runs into it. The error message is not very helpful, and it took a while to figure out that it was caused by the visibility attribute.

I'm using an external CI service that has not yet upgraded to Bazel 0.6.1. I guess I will have to pressure them to upgrade.