mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #6916 from heyitsanthony/fix-coalesce-bcast-race
grpcproxy: fix race between coalesce and bcast on nextrev
This commit is contained in:
commit
4e52b80590
@ -59,6 +59,7 @@ func (wbs *watchBroadcasts) coalesce(wb *watchBroadcast) {
|
||||
if wbswb == wb {
|
||||
continue
|
||||
}
|
||||
wb.mu.Lock()
|
||||
wbswb.mu.Lock()
|
||||
// 1. check if wbswb is behind wb so it won't skip any events in wb
|
||||
// 2. ensure wbswb started; nextrev == 0 may mean wbswb is waiting
|
||||
@ -71,6 +72,7 @@ func (wbs *watchBroadcasts) coalesce(wb *watchBroadcast) {
|
||||
wb.receivers = nil
|
||||
}
|
||||
wbswb.mu.Unlock()
|
||||
wb.mu.Unlock()
|
||||
if wb.empty() {
|
||||
delete(wbs.bcasts, wb)
|
||||
wb.stop()
|
||||
|
Loading…
x
Reference in New Issue
Block a user