Skip to content

Commit

Permalink
Start worker count at 1 to distinguish no worker request id from work…
Browse files Browse the repository at this point in the history
…er request id 0. This prevents the multiplex-enabled workers from thinking they occasionally get non-multiplex requests and blocking on those.

RELNOTES: none
PiperOrigin-RevId: 323539794

---
don't include test changes to avoid conflict
  • Loading branch information
larsrc-google authored and SrodriguezO committed Aug 25, 2020
1 parent 0f56df8 commit 62fa36f
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ final class WorkerFactory extends BaseKeyedPooledObjectFactory<WorkerKey, Worker
// It's fine to use an AtomicInteger here (which is 32-bit), because it is only incremented when
// spawning a new worker, thus even under worst-case circumstances and buggy workers quitting
// after each action, this should never overflow.
private static final AtomicInteger pidCounter = new AtomicInteger();
// This starts at 1 to avoid hiding latent problems of multiplex workers not returning a
// request_id (which is indistinguishable from 0 in proto3).
private static final AtomicInteger pidCounter = new AtomicInteger(1);

private WorkerOptions workerOptions;
private final Path workerBaseDir;
Expand Down

0 comments on commit 62fa36f

Please sign in to comment.