Skip to content

Commit 0784a23

Browse files
iancha1992Jaden Peterson
andauthored
[8.3.0] Fix the issue with duplicate work request IDs (bazelbuild#26285)
Fixes bazelbuild#26251. Closes bazelbuild#26269. PiperOrigin-RevId: 770671688 Change-Id: Ie43adaea98377ea92cfb38b55f25d9e034c179de Commit bazelbuild@7319e5e Co-authored-by: Jaden Peterson <[email protected]>
1 parent 4454cc5 commit 0784a23

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/java/com/google/devtools/build/lib/worker/WorkerSpawnRunner.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,20 @@ final class WorkerSpawnRunner implements SpawnRunner {
9191
private static final int VERBOSE_LEVEL = 10;
9292

9393
private final SandboxHelpers helpers;
94+
/**
95+
* The next work request ID to use. This field is static so we don't reuse work request IDs across
96+
* Bazel invocations. Although that shouldn't happen under normal circumstances because we wait
97+
* until a request finishes before exiting, it can happen if dynamic execution is enabled and one
98+
* branch beats the other in the race.
99+
*/
100+
private static final AtomicInteger requestIdCounter = new AtomicInteger(1);
101+
94102
private final Path execRoot;
95103
private final ExtendedEventHandler reporter;
96104
private final ResourceManager resourceManager;
97105
private final RunfilesTreeUpdater runfilesTreeUpdater;
98106
private final WorkerOptions workerOptions;
99107
private final WorkerParser workerParser;
100-
private final AtomicInteger requestIdCounter = new AtomicInteger(1);
101108
private final WorkerProcessMetricsCollector metricsCollector;
102109

103110
public WorkerSpawnRunner(

0 commit comments

Comments
 (0)