forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deadlocks #1168
Closed
Closed
Deadlocks #1168
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,8 +110,6 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, std::string& strCommand, C | |
|
||
if(pfrom->nVersion < MIN_GOVERNANCE_PEER_PROTO_VERSION) return; | ||
|
||
LOCK(cs); | ||
|
||
// ANOTHER USER IS ASKING US TO HELP THEM SYNC GOVERNANCE OBJECT DATA | ||
if (strCommand == NetMsgType::MNGOVERNANCESYNC) | ||
{ | ||
|
@@ -164,6 +162,8 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, std::string& strCommand, C | |
return; | ||
} | ||
|
||
LOCK2(cs_main, cs); | ||
|
||
if(mapSeenGovernanceObjects.count(nHash)) { | ||
// TODO - print error code? what if it's GOVOBJ_ERROR_IMMATURE? | ||
LogPrint("gobject", "CGovernanceManager -- Received already seen object: %s\n", strHash); | ||
|
@@ -278,7 +278,7 @@ void CGovernanceManager::CheckOrphanVotes(CNode* pfrom, CGovernanceObject& govob | |
|
||
bool CGovernanceManager::AddGovernanceObject(CGovernanceObject& govobj) | ||
{ | ||
LOCK(cs); | ||
LOCK2(cs_main, cs); | ||
std::string strError = ""; | ||
|
||
DBG( cout << "CGovernanceManager::AddGovernanceObject START" << endl; ); | ||
|
@@ -333,7 +333,7 @@ void CGovernanceManager::UpdateCachesAndClean() | |
|
||
std::vector<uint256> vecDirtyHashes = mnodeman.GetAndClearDirtyGovernanceObjectHashes(); | ||
|
||
LOCK(cs); | ||
LOCK2(cs_main, cs); | ||
|
||
for(size_t i = 0; i < vecDirtyHashes.size(); ++i) { | ||
object_m_it it = mapObjects.find(vecDirtyHashes[i]); | ||
|
@@ -542,7 +542,8 @@ void CGovernanceManager::NewBlock() | |
|
||
bool CGovernanceManager::ConfirmInventoryRequest(const CInv& inv) | ||
{ | ||
LOCK(cs); | ||
// FIXME: | ||
// LOCK(cs); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the problem with this ? This is called only from AlreadyHave() which is called from 2 places in main.cpp. I don't see any locks held there. Should be OK if cs_main is held on entry since that would be the correct order. |
||
|
||
LogPrint("gobject", "CGovernanceManager::ConfirmInventoryRequest inv = %s\n", inv.ToString()); | ||
|
||
|
@@ -606,7 +607,7 @@ void CGovernanceManager::Sync(CNode* pfrom, uint256 nProp) | |
// SYNC GOVERNANCE OBJECTS WITH OTHER CLIENT | ||
|
||
{ | ||
LOCK(cs); | ||
LOCK2(cs_main, cs); | ||
for(object_m_it it = mapObjects.begin(); it != mapObjects.end(); ++it) { | ||
uint256 h = it->first; | ||
|
||
|
@@ -867,7 +868,7 @@ void CGovernanceManager::UpdatedBlockTip(const CBlockIndex *pindex) | |
return; | ||
} | ||
|
||
LOCK(cs); | ||
LOCK2(cs_main, cs); | ||
pCurrentBlockIndex = pindex; | ||
nCachedBlockHeight = pCurrentBlockIndex->nHeight; | ||
LogPrint("gobject", "CGovernanceManager::UpdatedBlockTip pCurrentBlockIndex->nHeight: %d\n", pCurrentBlockIndex->nHeight); | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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 was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather see CountEnabled() changed to not call Check() than adding all these locks. I think that is the only function we call from these governance functions that locks cs_main.
Same comment for the other governance functions and rpcgovernance.cpp