Change information
Commit message:
Fix race in DynamicConnectionPool. (https://github.com/bazelbuild/bazel/pull/29693)
numAvailableConnections() is called under lock but the connection creation happens outside of the lock so it's possible for the remote_max_concurrency_per_connection number of rpcs per connection to be exceeded.
This change makes the token acquisition happen under lock, while deferring the connection creation.
Closes #29693.
PiperOrigin-RevId: 926053103
Change-Id: I8cacb67ef7be1ffb338a7880d084b83074974914
Files:
- M src/main/java/com/google/devtools/build/lib/remote/grpc/DynamicConnectionPool.java
- M src/main/java/com/google/devtools/build/lib/remote/grpc/SharedConnectionFactory.java
- M src/main/java/com/google/devtools/build/lib/remote/grpc/TokenBucket.java
- M src/test/java/com/google/devtools/build/lib/remote/grpc/DynamicConnectionPoolTest.java
Change size: M
Delta: 4 files changed, 82 insertions(+), 29 deletions(-)
Branch: refs/heads/master