vendor: swarmkit to fix deadlock in log broker.#42537
Merged
thaJeztah merged 1 commit intoJun 21, 2021
Merged
Conversation
Revendors swarmkit to fix a bug that could result in a mutex deadlock in the logbroker. Signed-off-by: Drew Erny <[email protected]>
thaJeztah
approved these changes
Jun 18, 2021
| // 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) |
Member
There was a problem hiding this comment.
reading from my phone, but should we perhaps have a "Publish()" that does not try to acquire a lock for this purpose, or is that lock happening elsewhere?
Member
There was a problem hiding this comment.
Or to keep things safer we can do something like
var publish bool
s.mu.Lock()
defer func() {
s.mu.Unlock()
if publish {
s.changed.Publish(s)
}
}()
Member
|
FWIW; if we want to backport this, we'd need a 20.10 branch in swarmkit (not sure if we want) |
cpuguy83
approved these changes
Jun 18, 2021
cpuguy83
left a comment
Member
There was a problem hiding this comment.
This looks fine to me.
I like to keep unlocks in a defer where possible for safety sake but code looks OK as is.
| // 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) |
Member
There was a problem hiding this comment.
Or to keep things safer we can do something like
var publish bool
s.mu.Lock()
defer func() {
s.mu.Unlock()
if publish {
s.changed.Publish(s)
}
}()
Member
|
Let's merge this one; @dperny perhaps you could look at the suggestions above to address those in a follow-up swarmkit revenuer? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Revendors swarmkit to fix a deadlock in the log broker. Closes #42314.