aboutsummaryrefslogtreecommitdiff
path: root/src/sync.cpp
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2020-06-22 18:21:12 +0300
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2020-06-22 18:24:29 +0300
commitbbe9cf4fe4ff9a8d1ea557fb763c76100db07679 (patch)
tree79a3d276e11e188e24149ec1b08a9383cb951ea8 /src/sync.cpp
parent35599344c886b62f198e35fd940c1ab15c4a9f90 (diff)
downloadbitcoin-bbe9cf4fe4ff9a8d1ea557fb763c76100db07679.tar.xz
test: Improve "potential deadlock detected" exception message
Diffstat (limited to 'src/sync.cpp')
-rw-r--r--src/sync.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/sync.cpp b/src/sync.cpp
index e7ea731482..e69ff090c6 100644
--- a/src/sync.cpp
+++ b/src/sync.cpp
@@ -114,13 +114,17 @@ static void potential_deadlock_detected(const LockPair& mismatch, const LockStac
}
LogPrintf(" %s\n", i.second.ToString());
}
+
+ std::string mutex_a, mutex_b;
LogPrintf("Current lock order is:\n");
for (const LockStackItem& i : s2) {
if (i.first == mismatch.first) {
LogPrintf(" (1)"); /* Continued */
+ mutex_a = i.second.Name();
}
if (i.first == mismatch.second) {
LogPrintf(" (2)"); /* Continued */
+ mutex_b = i.second.Name();
}
LogPrintf(" %s\n", i.second.ToString());
}
@@ -128,7 +132,7 @@ static void potential_deadlock_detected(const LockPair& mismatch, const LockStac
tfm::format(std::cerr, "Assertion failed: detected inconsistent lock order at %s:%i, details in debug log.\n", __FILE__, __LINE__);
abort();
}
- throw std::logic_error("potential deadlock detected");
+ throw std::logic_error(strprintf("potential deadlock detected: %s -> %s -> %s", mutex_b, mutex_a, mutex_b));
}
static void push_lock(void* c, const CLockLocation& locklocation)