mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #1024 from mavenugo/loc
Fixing a possible endpoint_cnt state inconsistency issue
This commit is contained in:
commit
b38b52c6b4
2 changed files with 19 additions and 0 deletions
|
@ -1000,5 +1000,17 @@ func (c *controller) cleanupLocalEndpoints() {
|
|||
log.Warnf("Could not delete local endpoint %s during endpoint cleanup: %v", ep.name, err)
|
||||
}
|
||||
}
|
||||
|
||||
epl, err = n.getEndpointsFromStore()
|
||||
if err != nil {
|
||||
log.Warnf("Could not get list of endpoints in network %s for count update: %v", n.name, err)
|
||||
continue
|
||||
}
|
||||
|
||||
epCnt := n.getEpCnt().EndpointCnt()
|
||||
if epCnt != uint64(len(epl)) {
|
||||
log.Warnf("Inconsistent endpoint_cnt for network %s. Expected=%d, Actual=%d", n.name, len(epl), epCnt)
|
||||
n.getEpCnt().setCnt(uint64(len(epl)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,6 +123,13 @@ func (ec *endpointCnt) updateStore() error {
|
|||
}
|
||||
}
|
||||
|
||||
func (ec *endpointCnt) setCnt(cnt uint64) error {
|
||||
ec.Lock()
|
||||
ec.Count = cnt
|
||||
ec.Unlock()
|
||||
return ec.updateStore()
|
||||
}
|
||||
|
||||
func (ec *endpointCnt) atomicIncDecEpCnt(inc bool) error {
|
||||
retry:
|
||||
ec.Lock()
|
||||
|
|
Loading…
Reference in a new issue