IllegalArgumentException: value already present
Description of the bug:
Random crashes ~1x/hour during a normal day of development. Definitely post-dates our upgrade to Bazel 7.1.2, but I don't have enough data to be confident in blaming 7.1.2 for the problem.
Which category does this issue belong to?
No response
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Unable to reproduce on demand; it happens at random.
Which operating system are you running Bazel on?
Ubuntu
What is the output of bazel info release?
release 7.1.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
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
No response
Have you found anything relevant by searching the web?
Thread on Bazel Slack: https://bazelbuild.slack.com/archives/CD4MDG09Z/p1715878298272369
Any other information, logs, or outputs that you want to share?
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.IllegalArgumentException: value already present: /cloud/services/fleet_state_app
at com.google.common.collect.HashBiMap.put(HashBiMap.java:316)
at com.google.common.collect.HashBiMap.put(HashBiMap.java:296)
at com.google.devtools.build.lib.skyframe.WatchServiceDiffAwareness$WatcherFileVisitor.preVisitDirectory(WatchServiceDiffAwareness.java:329)
at com.google.devtools.build.lib.skyframe.WatchServiceDiffAwareness$WatcherFileVisitor.preVisitDirectory(WatchServiceDiffAwareness.java:283)
at java.base/java.nio.file.Files.walkFileTree(Unknown Source)
at java.base/java.nio.file.Files.walkFileTree(Unknown Source)
at com.google.devtools.build.lib.skyframe.WatchServiceDiffAwareness.registerSubDirectoriesAndReturnContents(WatchServiceDiffAwareness.java:278)
at com.google.devtools.build.lib.skyframe.WatchServiceDiffAwareness.collectChanges(WatchServiceDiffAwareness.java:253)
at com.google.devtools.build.lib.skyframe.WatchServiceDiffAwareness.getCurrentView(WatchServiceDiffAwareness.java:135)
at com.google.devtools.build.lib.skyframe.DiffAwarenessManager.getDiff(DiffAwarenessManager.java:115)
at com.google.devtools.build.lib.skyframe.SkyframeExecutor.handleDiffs(SkyframeExecutor.java:3141)
at com.google.devtools.build.lib.skyframe.SequencedSkyframeExecutor.sync(SequencedSkyframeExecutor.java:285)
at com.google.devtools.build.lib.runtime.CommandEnvironment.syncPackageLoading(CommandEnvironment.java:737)
at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:567)
at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:244)
at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:573)
at com.google.devtools.build.lib.server.GrpcServerImpl.lambda$run$1(GrpcServerImpl.java:644)
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)
@bazel-io flag
@bazel-io fork 7.2.0
@iancha1992 This is probably Team-Core
Definitely post-dates our upgrade to Bazel 7.1.2, but I don't have enough data to be confident in blaming 7.1.2 for the problem.
Which version did you upgrade from? I had a brief look and none of the classes in the stack trace had any interesting changes in the past few months.
WatchServiceDiffAwareness hasn't been maintained for a while. It was originally implemented by folks outside team-Core, and they stopped working on Bazel a while ago.
Mentioning this to say: If someone wants to take a look, go for it!
This is still happening on bazel 9.0.0-pre.20241208.1. I have --watchfs enabled.
This happened to me after the following sequence of events:
- check out a branch with some symlinks; build a target with the symlinks
- delete the symlinks; build a target that previously included the symlinks
- switch to a branch where the symlinks still exist
- attempt to build a target that was completely unrelated to the symlinks => failure