File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
core/src/main/java/io/grpc/internal Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -249,9 +249,14 @@ public void run() {
249249 delayedTransport .endBackoff ();
250250 boolean shutdownDelayedTransport = false ;
251251 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 ();
252257 synchronized (lock ) {
253258 reconnectTask = null ;
254- if (delayedTransport . hasPendingStreams () ) {
259+ if (hasPendingStreams ) {
255260 // Transition directly to CONNECTING
256261 runnable = startNewTransport (delayedTransport );
257262 } else {
You can’t perform that action at this time.
0 commit comments