File tree 1 file changed +6
-1
lines changed
core/src/main/java/io/grpc/internal
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -249,9 +249,14 @@ public void run() {
249
249
delayedTransport .endBackoff ();
250
250
boolean shutdownDelayedTransport = false ;
251
251
Runnable runnable = null ;
252
+ // TransportSet as a channel layer class should not call into transport methods while
253
+ // holding the lock, thus we call hasPendingStreams() outside of the lock. It will cause
254
+ // a _benign_ race where the TransportSet may transition to CONNECTING when there is not
255
+ // pending stream.
256
+ boolean hasPendingStreams = delayedTransport .hasPendingStreams ();
252
257
synchronized (lock ) {
253
258
reconnectTask = null ;
254
- if (delayedTransport . hasPendingStreams () ) {
259
+ if (hasPendingStreams ) {
255
260
// Transition directly to CONNECTING
256
261
runnable = startNewTransport (delayedTransport );
257
262
} else {
You can’t perform that action at this time.
0 commit comments