Changes in potential_deadlock_detected behavior: (#1259)
1. print to stdout too 2. only print when it's critical (i.e. going to crash on assert)
This commit is contained in:
parent
26419596ce
commit
9114ef7930
23
src/sync.cpp
23
src/sync.cpp
@ -72,41 +72,46 @@ static void potential_deadlock_detected(const std::pair<void*, void*>& mismatch,
|
||||
bool firstLocked = false;
|
||||
bool secondLocked = false;
|
||||
bool onlyMaybeDeadlock = false;
|
||||
std::string strOutput = "";
|
||||
|
||||
LogPrintf("POTENTIAL DEADLOCK DETECTED\n");
|
||||
LogPrintf("Previous lock order was:\n");
|
||||
strOutput += "POTENTIAL DEADLOCK DETECTED\n";
|
||||
strOutput += "Previous lock order was:\n";
|
||||
BOOST_FOREACH (const PAIRTYPE(void*, CLockLocation) & i, s2) {
|
||||
if (i.first == mismatch.first) {
|
||||
LogPrintf(" (1)");
|
||||
strOutput += " (1)";
|
||||
if (!firstLocked && secondLocked && i.second.fTry)
|
||||
onlyMaybeDeadlock = true;
|
||||
firstLocked = true;
|
||||
}
|
||||
if (i.first == mismatch.second) {
|
||||
LogPrintf(" (2)");
|
||||
strOutput += " (2)";
|
||||
if (!secondLocked && firstLocked && i.second.fTry)
|
||||
onlyMaybeDeadlock = true;
|
||||
secondLocked = true;
|
||||
}
|
||||
LogPrintf(" %s\n", i.second.ToString());
|
||||
strOutput += strprintf(" %s\n", i.second.ToString().c_str());
|
||||
}
|
||||
firstLocked = false;
|
||||
secondLocked = false;
|
||||
LogPrintf("Current lock order is:\n");
|
||||
strOutput += "Current lock order is:\n";
|
||||
BOOST_FOREACH (const PAIRTYPE(void*, CLockLocation) & i, s1) {
|
||||
if (i.first == mismatch.first) {
|
||||
LogPrintf(" (1)");
|
||||
strOutput += " (1)";
|
||||
if (!firstLocked && secondLocked && i.second.fTry)
|
||||
onlyMaybeDeadlock = true;
|
||||
firstLocked = true;
|
||||
}
|
||||
if (i.first == mismatch.second) {
|
||||
LogPrintf(" (2)");
|
||||
strOutput += " (2)";
|
||||
if (!secondLocked && firstLocked && i.second.fTry)
|
||||
onlyMaybeDeadlock = true;
|
||||
secondLocked = true;
|
||||
}
|
||||
LogPrintf(" %s\n", i.second.ToString());
|
||||
strOutput += strprintf(" %s\n", i.second.ToString().c_str());
|
||||
}
|
||||
if(!onlyMaybeDeadlock) {
|
||||
printf("%s\n", strOutput.c_str());
|
||||
LogPrintf("%s\n", strOutput.c_str());
|
||||
}
|
||||
assert(onlyMaybeDeadlock);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user