mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
log: Avoid broken DEBUG_LOCKORDER log
This commit is contained in:
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("POTENTIAL DEADLOCK DETECTED\n");
|
||||||
LogPrintf("Previous lock order was:\n");
|
LogPrintf("Previous lock order was:\n");
|
||||||
for (const LockStackItem& i : s1) {
|
for (const LockStackItem& i : s1) {
|
||||||
|
std::string prefix{};
|
||||||
if (i.first == mismatch.first) {
|
if (i.first == mismatch.first) {
|
||||||
LogPrintf(" (1)"); /* Continued */
|
prefix = " (1)";
|
||||||
}
|
}
|
||||||
if (i.first == mismatch.second) {
|
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;
|
std::string mutex_a, mutex_b;
|
||||||
LogPrintf("Current lock order is:\n");
|
LogPrintf("Current lock order is:\n");
|
||||||
for (const LockStackItem& i : s2) {
|
for (const LockStackItem& i : s2) {
|
||||||
|
std::string prefix{};
|
||||||
if (i.first == mismatch.first) {
|
if (i.first == mismatch.first) {
|
||||||
LogPrintf(" (1)"); /* Continued */
|
prefix = " (1)";
|
||||||
mutex_a = i.second.Name();
|
mutex_a = i.second.Name();
|
||||||
}
|
}
|
||||||
if (i.first == mismatch.second) {
|
if (i.first == mismatch.second) {
|
||||||
LogPrintf(" (2)"); /* Continued */
|
prefix = " (2)";
|
||||||
mutex_b = i.second.Name();
|
mutex_b = i.second.Name();
|
||||||
}
|
}
|
||||||
LogPrintf(" %s\n", i.second.ToString());
|
LogPrintf("%s %s\n", prefix, i.second.ToString());
|
||||||
}
|
}
|
||||||
if (g_debug_lockorder_abort) {
|
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());
|
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("DOUBLE LOCK DETECTED\n");
|
||||||
LogPrintf("Lock order:\n");
|
LogPrintf("Lock order:\n");
|
||||||
for (const LockStackItem& i : lock_stack) {
|
for (const LockStackItem& i : lock_stack) {
|
||||||
|
std::string prefix{};
|
||||||
if (i.first == mutex) {
|
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) {
|
if (g_debug_lockorder_abort) {
|
||||||
tfm::format(std::cerr,
|
tfm::format(std::cerr,
|
||||||
|
|||||||
Reference in New Issue
Block a user