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.
release-3.1
Anthony Romano 2016-11-18 16:55:26 -08:00
parent 377f19b003
commit 7618fdd1d6
1 changed files with 1 additions and 2 deletions

View File

@ -116,13 +116,12 @@ func (wbs *watchBroadcasts) empty() bool { return len(wbs.bcasts) == 0 }
func (wbs *watchBroadcasts) stop() {
wbs.mu.Lock()
defer wbs.mu.Unlock()
for wb := range wbs.bcasts {
wb.stop()
}
wbs.bcasts = nil
close(wbs.updatec)
wbs.mu.Unlock()
<-wbs.donec
}