Skip to content

Commit

Permalink
fix deadlock of roundrobin balancer (#1353)
Browse files Browse the repository at this point in the history
  • Loading branch information
nghialv authored and menghanl committed Jul 12, 2017
1 parent 8264d61 commit 27b2052
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ func (rr *roundRobin) watchAddrUpdates() error {
if rr.done {
return ErrClientConnClosing
}
select {
case <-rr.addrCh:
default:
}
rr.addrCh <- open
return nil
}
Expand All @@ -223,7 +227,7 @@ func (rr *roundRobin) Start(target string, config BalancerConfig) error {
return err
}
rr.w = w
rr.addrCh = make(chan []Address)
rr.addrCh = make(chan []Address, 1)
go func() {
for {
if err := rr.watchAddrUpdates(); err != nil {
Expand Down

0 comments on commit 27b2052

Please sign in to comment.