IllegalStateException in CyclesReporter when you have a folder named "workspace"
Please provide the following information. The more we know about your system and use case, the more easily and likely we can help.
Description of the problem / feature request / question:
We have a folder called bazel/workspace with a .bzl file in it and when we try to load this .bzl file we would encounter an IllegalStateException when we do bazel build ...
When the folder is renamed to "verification" the build works. I think it is due to some changes in cycle detection. This seems to have started happening in 0.4.1.
If possible, provide a minimal example to reproduce the problem:
here's a repo that can be cloned: https://github.com/xynny/bazel-workspace-issue . if you run bazel build ... from the root directory it would throw the ISE below.
Environment info
-
Operating System: mac os x 10.10.5
-
Bazel version (output of
bazel info release):
Xins-MacBook-Pro:bazel-workspace-issue xinlu$ bazel info release ....... release 0.4.4
Have you found anything relevant by searching the web? (e.g. GitHub issues, email threads in the [email protected] archive)
Seems to be related to recent changes in CyclesReporter, but nothing specific in the forums.
Anything else, information or logs or outputs that would be helpful?
(If they are large, please upload as attachment or provide link).
Xins-MacBook-Pro:bazel-workspace-issue xinlu$ bazel build ...
.......
WARNING: Sandboxed execution is not supported on your system and thus hermeticity of actions cannot be guaranteed. See http://bazel.build/docs/bazel-user-manual.html#sandboxing for more information. You can turn off this warning via --ignore_unsupported_sandboxing.
Unhandled exception thrown during build; message: topLevelKey: TARGET_PATTERN:...
alreadyReported: false
path to cycle:
TARGET_PATTERN:...
RECURSIVE_PKG:rootedPath=[/Users/xinlu/work/master/bazel-workspace-issue]/[], excludedPaths=
INFO: Elapsed time: 0.296s
java.lang.IllegalStateException: topLevelKey: TARGET_PATTERN:...
alreadyReported: false
path to cycle:
TARGET_PATTERN:...
RECURSIVE_PKG:rootedPath=[/Users/xinlu/work/master/bazel-workspace-issue]/[], excludedPaths=
at com.google.common.base.Preconditions.checkState(Preconditions.java:444)
at com.google.devtools.build.lib.util.Preconditions.checkState(Preconditions.java:201)
at com.google.devtools.build.skyframe.CyclesReporter.reportCycles(CyclesReporter.java:82)
at com.google.devtools.build.lib.skyframe.SkyframeTargetPatternEvaluator.parseTargetPatternKeys(SkyframeTargetPatternEvaluator.java:164)
at com.google.devtools.build.lib.skyframe.SkyframeTargetPatternEvaluator.parseTargetPatternList(SkyframeTargetPatternEvaluator.java:117)
at com.google.devtools.build.lib.skyframe.SkyframeTargetPatternEvaluator.parseTargetPatternList(SkyframeTargetPatternEvaluator.java:56)
at com.google.devtools.build.lib.skyframe.LegacyLoadingPhaseRunner.getTargetsToBuild(LegacyLoadingPhaseRunner.java:279)
at com.google.devtools.build.lib.skyframe.LegacyLoadingPhaseRunner.execute(LegacyLoadingPhaseRunner.java:133)
at com.google.devtools.build.lib.buildtool.BuildTool.evaluateTargetPatterns(BuildTool.java:426)
at com.google.devtools.build.lib.buildtool.BuildTool.buildTargets(BuildTool.java:170)
at com.google.devtools.build.lib.buildtool.BuildTool.processRequest(BuildTool.java:344)
at com.google.devtools.build.lib.runtime.commands.BuildCommand.exec(BuildCommand.java:65)
at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:479)
at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:294)
at com.google.devtools.build.lib.runtime.CommandExecutor.exec(CommandExecutor.java:47)
at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:814)
at com.google.devtools.build.lib.server.GrpcServerImpl.access$1900(GrpcServerImpl.java:101)
at com.google.devtools.build.lib.server.GrpcServerImpl$4$1.run(GrpcServerImpl.java:872)
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)
java.lang.IllegalStateException: topLevelKey: TARGET_PATTERN:...
alreadyReported: false
path to cycle:
TARGET_PATTERN:...
RECURSIVE_PKG:rootedPath=[/Users/xinlu/work/master/bazel-workspace-issue]/[], excludedPaths=
at com.google.common.base.Preconditions.checkState(Preconditions.java:444)
at com.google.devtools.build.lib.util.Preconditions.checkState(Preconditions.java:201)
at com.google.devtools.build.skyframe.CyclesReporter.reportCycles(CyclesReporter.java:82)
at com.google.devtools.build.lib.skyframe.SkyframeTargetPatternEvaluator.parseTargetPatternKeys(SkyframeTargetPatternEvaluator.java:164)
at com.google.devtools.build.lib.skyframe.SkyframeTargetPatternEvaluator.parseTargetPatternList(SkyframeTargetPatternEvaluator.java:117)
at com.google.devtools.build.lib.skyframe.SkyframeTargetPatternEvaluator.parseTargetPatternList(SkyframeTargetPatternEvaluator.java:56)
at com.google.devtools.build.lib.skyframe.LegacyLoadingPhaseRunner.getTargetsToBuild(LegacyLoadingPhaseRunner.java:279)
at com.google.devtools.build.lib.skyframe.LegacyLoadingPhaseRunner.execute(LegacyLoadingPhaseRunner.java:133)
at com.google.devtools.build.lib.buildtool.BuildTool.evaluateTargetPatterns(BuildTool.java:426)
at com.google.devtools.build.lib.buildtool.BuildTool.buildTargets(BuildTool.java:170)
at com.google.devtools.build.lib.buildtool.BuildTool.processRequest(BuildTool.java:344)
at com.google.devtools.build.lib.runtime.commands.BuildCommand.exec(BuildCommand.java:65)
at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:479)
at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:294)
at com.google.devtools.build.lib.runtime.CommandExecutor.exec(CommandExecutor.java:47)
at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:814)
at com.google.devtools.build.lib.server.GrpcServerImpl.access$1900(GrpcServerImpl.java:101)
at com.google.devtools.build.lib.server.GrpcServerImpl$4$1.run(GrpcServerImpl.java:872)
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)
It looks like a common trap on Mac: case-insensitive file system. I'll verify if something changed from 0.4.1. (BTW, I like your avatar)
https://github.com/bazelbuild/bazel/commit/b4f461ecc183d9adc9482f4cad848687ed0227ee This seems to be the problem.
I will investigate, but reverting commit b4f461e isn't an option at this point.