Skip to content

Commit

Permalink
deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
dfawley committed May 21, 2021
1 parent 3747ef1 commit af686e6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions balancer_conn_wrappers.go
Expand Up @@ -82,16 +82,21 @@ func (ccb *ccBalancerWrapper) watcher() {
}

if ccb.closed.HasFired() {
ccb.balancerMu.Lock()
ccb.balancer.Close()
ccb.balancerMu.Unlock()
ccb.mu.Lock()
scs := ccb.subConns
ccb.subConns = nil
ccb.mu.Unlock()
ccb.UpdateState(balancer.State{ConnectivityState: connectivity.Connecting, Picker: nil})
ccb.done.Fire()
// Fire done before removing the addr conns. We can safely unblock
// ccb.close and allow the removeAddrConns to happen
// asynchronously.
for acbw := range scs {
ccb.cc.removeAddrConn(acbw.getAddrConn(), errConnDrain)
}
ccb.UpdateState(balancer.State{ConnectivityState: connectivity.Connecting, Picker: nil})
ccb.done.Fire()
return
}
}
Expand Down

0 comments on commit af686e6

Please sign in to comment.