diff --git a/clientconn.go b/clientconn.go index 7ed19711d508..ebcd64f33a4c 100644 --- a/clientconn.go +++ b/clientconn.go @@ -735,6 +735,9 @@ func (ac *addrConn) connect() error { ac.mu.Unlock() return nil } + // Update connectivity state within the lock to prevent subsequent or + // concurrent calls from resetting the transport more than once. + ac.updateConnectivityState(connectivity.Connecting) ac.mu.Unlock() // Start a goroutine connecting to the server asynchronously.