mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
grpcproxy: fix deadlock on watch broadcasts stop
Holding the WatchBroadcasts lock and waiting on donec was causing a deadlock with the coalesce loop. Was causing TestV3WatchSyncCancel to hang.
This commit is contained in:
parent
377f19b003
commit
7618fdd1d6
@ -116,13 +116,12 @@ func (wbs *watchBroadcasts) empty() bool { return len(wbs.bcasts) == 0 }
|
|||||||
|
|
||||||
func (wbs *watchBroadcasts) stop() {
|
func (wbs *watchBroadcasts) stop() {
|
||||||
wbs.mu.Lock()
|
wbs.mu.Lock()
|
||||||
defer wbs.mu.Unlock()
|
|
||||||
|
|
||||||
for wb := range wbs.bcasts {
|
for wb := range wbs.bcasts {
|
||||||
wb.stop()
|
wb.stop()
|
||||||
}
|
}
|
||||||
wbs.bcasts = nil
|
wbs.bcasts = nil
|
||||||
close(wbs.updatec)
|
close(wbs.updatec)
|
||||||
|
wbs.mu.Unlock()
|
||||||
<-wbs.donec
|
<-wbs.donec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user