1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #42537 from dperny/vendor-swarmkit-fix-logbroker-deadlock

vendor: swarmkit to fix deadlock in log broker.
This commit is contained in:
Sebastiaan van Stijn 2021-06-21 14:32:47 +02:00 committed by GitHub
commit 44269c6653
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View file

@ -144,7 +144,7 @@ github.com/klauspost/compress a3b7545c88eea469c2246bee0e6c
github.com/pelletier/go-toml 65ca8064882c8c308e5c804c5d5443d409e0738c # v1.8.1 github.com/pelletier/go-toml 65ca8064882c8c308e5c804c5d5443d409e0738c # v1.8.1
# cluster # cluster
github.com/docker/swarmkit ccf0585f543eae7d74104ddd8f339a960322d214 # master github.com/docker/swarmkit 2dcf70aafdc9ea55af3aaaeca440638cde0ecda6 # master
github.com/gogo/protobuf b03c65ea87cdc3521ede29f62fe3ce239267c1bc # v1.3.2 github.com/gogo/protobuf b03c65ea87cdc3521ede29f62fe3ce239267c1bc # v1.3.2
github.com/golang/protobuf 84668698ea25b64748563aa20726db66a6b8d299 # v1.3.5 github.com/golang/protobuf 84668698ea25b64748563aa20726db66a6b8d299 # v1.3.5
github.com/cloudflare/cfssl 5d63dbd981b5c408effbb58c442d54761ff94fbd # 1.3.2 github.com/cloudflare/cfssl 5d63dbd981b5c408effbb58c442d54761ff94fbd # 1.3.2

View file

@ -204,20 +204,31 @@ func (s *subscription) watch(ch <-chan events.Event) error {
} }
add := func(t *api.Task) { add := func(t *api.Task) {
// this mutex does not have a deferred unlock, because there is work
// we need to do after we release it.
s.mu.Lock() s.mu.Lock()
defer s.mu.Unlock()
// Un-allocated task. // Un-allocated task.
if t.NodeID == "" { if t.NodeID == "" {
s.pendingTasks[t.ID] = struct{}{} s.pendingTasks[t.ID] = struct{}{}
s.mu.Unlock()
return return
} }
delete(s.pendingTasks, t.ID) delete(s.pendingTasks, t.ID)
if _, ok := s.nodes[t.NodeID]; !ok { if _, ok := s.nodes[t.NodeID]; !ok {
s.nodes[t.NodeID] = struct{}{} s.nodes[t.NodeID] = struct{}{}
s.mu.Unlock()
// if we try to call Publish before we release the lock, we can end
// up in a situation where the receiver is trying to acquire a read
// lock on it. it's hard to explain.
s.changed.Publish(s) s.changed.Publish(s)
return
} }
s.mu.Unlock()
} }
for { for {