mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-20 05:42:50 +02:00
log: Avoid broken DEBUG_LOCKORDER log
This commit is contained in:
parent
faffaa85cd
commit
faeae2980f
19
src/sync.cpp
19
src/sync.cpp
@ -97,27 +97,29 @@ static void potential_deadlock_detected(const LockPair& mismatch, const LockStac
|
||||
LogPrintf("POTENTIAL DEADLOCK DETECTED\n");
|
||||
LogPrintf("Previous lock order was:\n");
|
||||
for (const LockStackItem& i : s1) {
|
||||
std::string prefix{};
|
||||
if (i.first == mismatch.first) {
|
||||
LogPrintf(" (1)"); /* Continued */
|
||||
prefix = " (1)";
|
||||
}
|
||||
if (i.first == mismatch.second) {
|
||||
LogPrintf(" (2)"); /* Continued */
|
||||
prefix = " (2)";
|
||||
}
|
||||
LogPrintf(" %s\n", i.second.ToString());
|
||||
LogPrintf("%s %s\n", prefix, i.second.ToString());
|
||||
}
|
||||
|
||||
std::string mutex_a, mutex_b;
|
||||
LogPrintf("Current lock order is:\n");
|
||||
for (const LockStackItem& i : s2) {
|
||||
std::string prefix{};
|
||||
if (i.first == mismatch.first) {
|
||||
LogPrintf(" (1)"); /* Continued */
|
||||
prefix = " (1)";
|
||||
mutex_a = i.second.Name();
|
||||
}
|
||||
if (i.first == mismatch.second) {
|
||||
LogPrintf(" (2)"); /* Continued */
|
||||
prefix = " (2)";
|
||||
mutex_b = i.second.Name();
|
||||
}
|
||||
LogPrintf(" %s\n", i.second.ToString());
|
||||
LogPrintf("%s %s\n", prefix, i.second.ToString());
|
||||
}
|
||||
if (g_debug_lockorder_abort) {
|
||||
tfm::format(std::cerr, "Assertion failed: detected inconsistent lock order for %s, details in debug log.\n", s2.back().second.ToString());
|
||||
@ -131,10 +133,11 @@ static void double_lock_detected(const void* mutex, const LockStack& lock_stack)
|
||||
LogPrintf("DOUBLE LOCK DETECTED\n");
|
||||
LogPrintf("Lock order:\n");
|
||||
for (const LockStackItem& i : lock_stack) {
|
||||
std::string prefix{};
|
||||
if (i.first == mutex) {
|
||||
LogPrintf(" (*)"); /* Continued */
|
||||
prefix = " (*)";
|
||||
}
|
||||
LogPrintf(" %s\n", i.second.ToString());
|
||||
LogPrintf("%s %s\n", prefix, i.second.ToString());
|
||||
}
|
||||
if (g_debug_lockorder_abort) {
|
||||
tfm::format(std::cerr,
|
||||
|
Loading…
x
Reference in New Issue
Block a user