Fix a deadlock in miner.rs#1968
Merged
majecty merged 7 commits intoCodeChain-io:rc-2.2.xfrom Jun 3, 2020
Merged
Conversation
Contributor
|
How about just moving the line |
sgkim126
reviewed
May 21, 2020
Contributor
sgkim126
left a comment
There was a problem hiding this comment.
Dropping the lock guard of immune_users will not help to fix the deadlock. Since the thread will stop when requiring to lock mem_pool. How about locking mem_pool at the 531st line. To make code always lock mem_pool first?
Author
sgkim126
reviewed
Jun 3, 2020
added 7 commits
June 3, 2020 15:54
NextMandatoryReseal limits the lifetime of the inner lock.
NextAllowedReseal limits the lifetime of the inner lock.
Params limits the lifetime of the inner lock.
SealingBlockLastRequest limits the lifetime of the inner lock.
Nrtofiers limits the lifetime of the inner lock.
Users limits the lifetime of the inner lock.
bfbfce1 to
a9e9700
Compare
sgkim126
approved these changes
Jun 3, 2020
majecty
commented
Jun 3, 2020
This was referenced Jun 3, 2020
Merged
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.
There is a deadlock between immune_users and mem_pool.
A client worker thread locks immune_users first and mem_pool second in
prepare_block function.
An HTTP thread locks mem_pool first in import_own_transactions function
and locks immune_users in add_transactions_to_pool function.
It seems that this deadlock is added when we add immune_users lock. We
need to review the lock of immune_users.