Skip to content

Commit

Permalink
client: fix race between connection error and subconn shutdown (#6494)
Browse files Browse the repository at this point in the history
  • Loading branch information
dfawley authored Aug 3, 2023
1 parent 2db7b17 commit b9356e3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions clientconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -1353,12 +1353,14 @@ func (ac *addrConn) resetTransport() {

if err := ac.tryAllAddrs(acCtx, addrs, connectDeadline); err != nil {
ac.cc.resolveNow(resolver.ResolveNowOptions{})
// After exhausting all addresses, the addrConn enters
// TRANSIENT_FAILURE.
ac.mu.Lock()
if acCtx.Err() != nil {
// addrConn was torn down.
ac.mu.Unlock()
return
}
ac.mu.Lock()
// After exhausting all addresses, the addrConn enters
// TRANSIENT_FAILURE.
ac.updateConnectivityState(connectivity.TransientFailure, err)

// Backoff.
Expand Down

0 comments on commit b9356e3

Please sign in to comment.