bazel: Query with rbuildfiles frequently throws IllegalStateException

Description of the problem / feature request:

In our CI system, we run the following query to determine if any modified files are dependencies of any BUILD files:

 bazel query \
   --keep_going \
   --order_output=no \
   --universe_scope='//...' \
   "rbuildfiles($comma_sep_modified_files)"

Frequently, this results in an exception that looks like this:

java.lang.IllegalStateException: File:[/buildkite/builds/hello-world[source]]frontend/web/src/js/app/middleware/initialization.js=InMemoryNodeEntry{identity=728588638, value=null, lastChangedVersion=IntVersion: 388, lastEvaluatedVersion=IntVersion: 388, directDeps=null, reverseDeps=ReverseDeps{reverseDeps=[], singleReverseDep=false, dataToConsolidate=null}, dirtyBuildingState=FullDirtyBuildingState{dirtyState=CHECK_DEPENDENCIES, signaledDeps=-1, externalDeps=0, dirtyDirectDepIndex=0, lastBuildDirectDeps=GroupedList{elements=[FILE:[/buildkite/builds/hello-world]/[frontend/web/src/js/app/middleware/initialization.js]], size=1}, lastBuildValue=RegularFileArtifactValue{digest=00190f7f9e1cb320fe146036e972844242a6aa8353a2b9aff2740a536146f894, size=1459, proxy=ctime of 1559922057219 and nodeId of 1317526}}}
--
  | at com.google.common.base.Preconditions.checkState(Preconditions.java:507)
  | at com.google.devtools.build.skyframe.DelegatingWalkableGraph.getReverseDeps(DelegatingWalkableGraph.java:132)
  | at com.google.devtools.build.lib.query2.RBuildFilesVisitor.getVisitResult(RBuildFilesVisitor.java:80)
  | at com.google.devtools.build.lib.query2.ParallelVisitor$VisitTask.process(ParallelVisitor.java:217)
  | at com.google.devtools.build.lib.query2.ParallelVisitor$Task.run(ParallelVisitor.java:197)
  | at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:387)
  | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

The affected filename differs on each build, but the stack trace is always the same, with the exception coming from RBuildFilesVisitor.

Feature requests: what underlying problem are you trying to solve with this feature?

Determining which targets may have been affected by a pull request.

Bugs: what’s the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Unfortunately this is in a mid-sized, private monorepo which I can’t provide here. Running the bazel query provided above results in this exception around 10-20% of the time on our CI servers.

What operating system are you running Bazel on?

Linux

What’s the output of bazel info release?

# bazel info release
INFO: Invocation ID: 2537f98b-c39a-4e98-a4fd-90ff745c9416
release 0.26.1

Note however that I also saw this issue with Bazel 0.25.

What’s the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?

1577a2caadd770afa708cf6e0eeea08cda579c34
bdfc59dde9a6eee44df21b66ba67ce027bd18e59

Have you found anything relevant by searching the web?

It is possible that #7294 is related but I’m not sure.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

Based on my notes, it does also seem that you’re correct that the filename is one that has been modified between Bazel commands, generally in the new commit that is being tested.

^^ that’s enough of a lead for us to debug. so, an INFO log is probably not needed.

thanks for the bug report!