Skip to content

Commit

Permalink
client: fix race between conn err and subconn shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
dfawley committed Aug 1, 2023
1 parent 0246373 commit 0478f66
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 0478f66

Please sign in to comment.