Skip to content

Adding a cc_library to the constraint_values of a platform causes a crash #22996

@tpudlik

Description

@tpudlik

Description of the bug:

On Bazel 8.0.0-pre.20240618.2, adding a cc_library to the constraint_values of a platform causes Bazel to crash with an unhelpful error message:

java.lang.IllegalStateException: java.lang.RuntimeException: Unrecoverable error while evaluating node 'ConfiguredTargetKey{label=//:library, config=BuildConfigurationKey[6f97ef646cfec4f33129d2a43267b717f71213ca1cec09d0d350528022f27781]}' (requested by nodes 'ConfiguredTargetKey{label=//:platform, config=BuildConfigurationKey[6f97ef646cfec4f33129d2a43267b717f71213ca1cec09d0d350528022f27781]}')                            
        at com.google.devtools.build.lib.skyframe.SkyframeExecutor.evaluateSkyKeys(SkyframeExecutor.java:1996)                                                                                                                                                                                                                                                                                                                          
        at com.google.devtools.build.lib.skyframe.SkyframeExecutor.evaluateSkyKeys(SkyframeExecutor.java:1972)                                                                                                                                                                                                                                                                                                                          
        at com.google.devtools.build.lib.skyframe.SkyframeExecutor.createBuildConfigurationKey(SkyframeExecutor.java:1928)                                                                                                                                                                                                                                                                                                              
        at com.google.devtools.build.lib.skyframe.SkyframeExecutor.getConfiguration(SkyframeExecutor.java:1852)                                                                                                                                                                                                                                                                                                                         
        at com.google.devtools.build.lib.skyframe.SkyframeExecutor.createConfiguration(SkyframeExecutor.java:1608)                                                                                                                                                                                                                                                                                                                      
        at com.google.devtools.build.lib.analysis.BuildView.update(BuildView.java:258)                                                                                                                                                                                                                                                                                                                                                  
        at com.google.devtools.build.lib.buildtool.AnalysisAndExecutionPhaseRunner.runAnalysisAndExecutionPhase(AnalysisAndExecutionPhaseRunner.java:227)                                                                                                                                                                                                                                                                               
        at com.google.devtools.build.lib.buildtool.AnalysisAndExecutionPhaseRunner.execute(AnalysisAndExecutionPhaseRunner.java:125)                                                                                                                                                                                                                                                                                                    
        at com.google.devtools.build.lib.buildtool.BuildTool.buildTargetsWithMergedAnalysisExecution(BuildTool.java:358)                                                                                                                                                                                                                                                                                                                
        at com.google.devtools.build.lib.buildtool.BuildTool.buildTargets(BuildTool.java:197)                                                                                                                                                                                                                                                                                                                                           
        at com.google.devtools.build.lib.buildtool.BuildTool.processRequest(BuildTool.java:543)                                                                                                                                                                                                                                                                                                                                         
        at com.google.devtools.build.lib.buildtool.BuildTool.processRequest(BuildTool.java:511)                                                                                                                                                                                                                                                                                                                                         
        at com.google.devtools.build.lib.runtime.commands.BuildCommand.exec(BuildCommand.java:105)                                                                                                                                                                                                                                                                                                                                      
        at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:683)                                                                                                                                                                                                                                                                                                                
        at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:252)                                                                                                                                                                                                                                                                                                                           
        at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:607)                                                                                                                                                                                                                                                                                                                                  
        at com.google.devtools.build.lib.server.GrpcServerImpl.lambda$run$1(GrpcServerImpl.java:676)                                                                                                                                                                                                                                                                                                                                    
        at io.grpc.Context$1.run(Context.java:566)                                                                                                                                                                                                                                                                                                                                                                                      
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)                                                                                                                                                                                                                                                                                                                                                  
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)                                                                                                                                                                                                                                                                                                                                                 
        at java.base/java.lang.Thread.run(Unknown Source)                                                                                                                                                                                                                                                                                                                                                                               
Caused by: java.lang.RuntimeException: Unrecoverable error while evaluating node 'ConfiguredTargetKey{label=//:library, config=BuildConfigurationKey[6f97ef646cfec4f33129d2a43267b717f71213ca1cec09d0d350528022f27781]}' (requested by nodes 'ConfiguredTargetKey{label=//:platform, config=BuildConfigurationKey[6f97ef646cfec4f33129d2a43267b717f71213ca1cec09d0d350528022f27781]}')                                                  
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:557)                                                                                                                                                                                                                                                                                                                
        at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:426)                                                                                                                                                                                                                                                                                                             
        at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.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: com.google.common.base.VerifyException: expected a Starlark exec transition definition                                                                                                                                                                                                                                                                                                                                       
        at com.google.common.base.Verify.verifyNotNull(Verify.java:503)                                                                                                                                                                                                                                                                                                                                                                 
        at com.google.devtools.build.lib.analysis.config.ExecutionTransitionFactory.create(ExecutionTransitionFactory.java:99)                                                                                                                                                                                                                                                                                                          
        at com.google.devtools.build.lib.analysis.config.ExecutionTransitionFactory.create(ExecutionTransitionFactory.java:50)                                                                                                                                                                                                                                                                                                          
        at com.google.devtools.build.lib.analysis.producers.DependencyProducer.step(DependencyProducer.java:175)                                                                                                                                                                                                                                                                                                                        
        at com.google.devtools.build.skyframe.state.TaskTreeNode.run(TaskTreeNode.java:94)                                                                                                                                                                                                                                                                                                                                              
        at com.google.devtools.build.skyframe.state.Driver.drive(Driver.java:87)                                                                                                                                                                                                                                                                                                                                                        
        at com.google.devtools.build.lib.skyframe.DependencyResolver.computeDependencies(DependencyResolver.java:663)                                                                                                                                                                                                                                                                                                                   
        at com.google.devtools.build.lib.skyframe.DependencyResolver.evaluate(DependencyResolver.java:391)                                                                                                                                                                                                                                                                                                                              
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.compute(ConfiguredTargetFunction.java:265)                                                                                                                                                                                                                                                                                                                   
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:468)

@katre

Which category does this issue belong to?

Configurability

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

Minimal example: https://github.com/tpudlik/constraint_value_crash.

Which operating system are you running Bazel on?

Linux

What is the output of bazel info release?

release 8.0.0-pre.20240618.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 HEAD ?

No response

If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

Kind of? On Bazel 7.2.1 I get an error instead of a crash:

ERROR: /usr/local/google/home/tpudlik/.cache/bazel/_bazel_tpudlik/259e376b1fd08ce7249a45dd7f913f12/external/bazel_tools/src/conditions/BUILD:145:27: in config_setting rule @@bazel_tools//src/conditions:host_windows_arm64_constraint: all rules of type config_setting require the presence of all of [PlatformConfiguration], but these were all disabled in configuration ab8cba103302292a2b1ba4f5816adc45d4e4bc4d1f3a0e0ddbfd94da0
f3bd83b                                                                                                                                                                                                                                                                                                                                                                                                                                 
ERROR: /usr/local/google/home/tpudlik/.cache/bazel/_bazel_tpudlik/259e376b1fd08ce7249a45dd7f913f12/external/bazel_tools/src/conditions/BUILD:145:27: Analysis of target '@@bazel_tools//src/conditions:host_windows_arm64_constraint' failed                                                                                                                                                                                            
ERROR: /usr/local/google/home/tpudlik/.cache/bazel/_bazel_tpudlik/259e376b1fd08ce7249a45dd7f913f12/external/bazel_tools/src/conditions/BUILD:145:27: errors encountered resolving select() keys for @@bazel_tools//src/conditions:host_windows                                                                                                                                                                                          
ERROR: /usr/local/google/home/tpudlik/.cache/bazel/_bazel_tpudlik/259e376b1fd08ce7249a45dd7f913f12/external/bazel_tools/tools/def_parser/BUILD:11:10: errors encountered resolving select() keys for @@bazel_tools//tools/def_parser:def_parser                                                                                                                                                                                         
ERROR: /usr/local/google/home/tpudlik/src/constraint_value_crash/BUILD.bazel:14:10: Target //:platform was referenced as a platform, but does not provide PlatformInfo                                                                                                                                                                                                                                                                  
ERROR: Analysis of target '//:binary' failed; build aborted                                                                                                                                                                                                                                                                                                                                                                             
INFO: Elapsed time: 0.181s, Critical Path: 0.00s                                                                                                                                                                                                                                                                                                                                                                                        
INFO: 1 process: 1 internal.                                                                                                                                                                                                                                                                                                                                                                                                            
ERROR: Build did NOT complete successfully 

This error is not especially informative, but at least it suggests the problem is with the platform, somehow.

Have you found anything relevant by searching the web?

No response

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

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions