-
Notifications
You must be signed in to change notification settings - Fork 37.8k
Fix ComputeTimeSmart test failure with -DDEBUG_LOCKORDER #12681
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
Conversation
src/wallet/wallet.cpp
Outdated
@@ -899,6 +899,7 @@ bool CWallet::MarkReplaced(const uint256& originalHash, const uint256& newHash) | |||
|
|||
bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose) | |||
{ | |||
AssertLockHeld(cs_main); // Needed for ComputeTimeSmart |
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.
Wouldn't it make sense to instead move this down to ComputeTimeSmart?
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -899,7 +899,6 @@ bool CWallet::MarkReplaced(const uint256& originalHash, const uint256& newHash)
bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose)
{
- AssertLockHeld(cs_main); // Needed for ComputeTimeSmart
LOCK(cs_wallet);
CWalletDB walletdb(*dbw, "r+", fFlushOnClose);
@@ -3815,10 +3814,8 @@ unsigned int CWallet::ComputeTimeSmart(const CWalletTx& wtx) const
unsigned int nTimeSmart = wtx.nTimeReceived;
if (!wtx.hashUnset()) {
const CBlockIndex* pindex = nullptr;
- {
- LOCK(cs_main);
- pindex = LookupBlockIndex(wtx.hashBlock);
- }
+ AssertLockHeld(cs_main);
+ pindex = LookupBlockIndex(wtx.hashBlock);
if (pindex) {
int64_t latestNow = wtx.nTimeReceived;
int64_t latestEntry = 0;
Actually I think it's enough to fix the test and remove the lock. The lock assertion is already in LookupBlockIndex. |
Failure looks like: Entering test case "ComputeTimeSmart" test_bitcoin: sync.cpp:100: void potential_deadlock_detected(const std::pair<void*, void*>&, const LockStack&, const LockStack&): Assertion `false' failed. unknown location(0): fatal error in "ComputeTimeSmart": signal: SIGABRT (application abort requested) wallet/test/wallet_tests.cpp(566): last checkpoint Reproducible with: ./configure --enable-debug make -C src test/test_bitcoin && src/test/test_bitcoin --log_level=test_suite --run_test=wallet_tests/ComputeTimeSmart Happens due to "92fabcd443 Add LookupBlockIndex function" which acquires cs_main from inside CWallet::ComputeTimeSmart.
Sounds good. Removed the lock and new assert. Updated 84ae51a -> 33eb907 (pr/locksmart.1 -> pr/locksmart.2) |
utACK 33eb907. Sorry for the bug, thanks @ryanofsky for the quick fix. |
utACK 33eb907 |
33eb907 Fix ComputeTimeSmart test failure with -DDEBUG_LOCKORDER (Russell Yanofsky) Pull request description: Failure looks like: ``` Entering test case "ComputeTimeSmart" test_bitcoin: sync.cpp:100: void potential_deadlock_detected(const std::pair<void*, void*>&, const LockStack&, const LockStack&): Assertion `false' failed. unknown location(0): fatal error in "ComputeTimeSmart": signal: SIGABRT (application abort requested) wallet/test/wallet_tests.cpp(566): last checkpoint ``` Reproducible with: ``` ./configure --enable-debug make -C src test/test_bitcoin && src/test/test_bitcoin --log_level=test_suite --run_test=wallet_tests/ComputeTimeSmart ``` Seems to be caused by acquiring `cs_main` inside `CWallet::ComputeTimeSmart` in #11041. I think this may be causing timeouts on travis like: https://travis-ci.org/bitcoin/bitcoin/jobs/353005676#L2692 Tree-SHA512: b263cd122ea9c88204d1d8e7e35291c71ea6319f05114c5009235a75dbd0f669bc0394f44afeed0d9eb08c2a956cd7c08f1ac4ef28616932fef9b43eaac5521b
…OCKORDER 33eb907 Fix ComputeTimeSmart test failure with -DDEBUG_LOCKORDER (Russell Yanofsky) Pull request description: Failure looks like: ``` Entering test case "ComputeTimeSmart" test_bitcoin: sync.cpp:100: void potential_deadlock_detected(const std::pair<void*, void*>&, const LockStack&, const LockStack&): Assertion `false' failed. unknown location(0): fatal error in "ComputeTimeSmart": signal: SIGABRT (application abort requested) wallet/test/wallet_tests.cpp(566): last checkpoint ``` Reproducible with: ``` ./configure --enable-debug make -C src test/test_bitcoin && src/test/test_bitcoin --log_level=test_suite --run_test=wallet_tests/ComputeTimeSmart ``` Seems to be caused by acquiring `cs_main` inside `CWallet::ComputeTimeSmart` in bitcoin#11041. I think this may be causing timeouts on travis like: https://travis-ci.org/bitcoin/bitcoin/jobs/353005676#L2692 Tree-SHA512: b263cd122ea9c88204d1d8e7e35291c71ea6319f05114c5009235a75dbd0f669bc0394f44afeed0d9eb08c2a956cd7c08f1ac4ef28616932fef9b43eaac5521b
…OCKORDER 33eb907 Fix ComputeTimeSmart test failure with -DDEBUG_LOCKORDER (Russell Yanofsky) Pull request description: Failure looks like: ``` Entering test case "ComputeTimeSmart" test_bitcoin: sync.cpp:100: void potential_deadlock_detected(const std::pair<void*, void*>&, const LockStack&, const LockStack&): Assertion `false' failed. unknown location(0): fatal error in "ComputeTimeSmart": signal: SIGABRT (application abort requested) wallet/test/wallet_tests.cpp(566): last checkpoint ``` Reproducible with: ``` ./configure --enable-debug make -C src test/test_bitcoin && src/test/test_bitcoin --log_level=test_suite --run_test=wallet_tests/ComputeTimeSmart ``` Seems to be caused by acquiring `cs_main` inside `CWallet::ComputeTimeSmart` in bitcoin#11041. I think this may be causing timeouts on travis like: https://travis-ci.org/bitcoin/bitcoin/jobs/353005676#L2692 Tree-SHA512: b263cd122ea9c88204d1d8e7e35291c71ea6319f05114c5009235a75dbd0f669bc0394f44afeed0d9eb08c2a956cd7c08f1ac4ef28616932fef9b43eaac5521b
…OCKORDER 33eb907 Fix ComputeTimeSmart test failure with -DDEBUG_LOCKORDER (Russell Yanofsky) Pull request description: Failure looks like: ``` Entering test case "ComputeTimeSmart" test_bitcoin: sync.cpp:100: void potential_deadlock_detected(const std::pair<void*, void*>&, const LockStack&, const LockStack&): Assertion `false' failed. unknown location(0): fatal error in "ComputeTimeSmart": signal: SIGABRT (application abort requested) wallet/test/wallet_tests.cpp(566): last checkpoint ``` Reproducible with: ``` ./configure --enable-debug make -C src test/test_bitcoin && src/test/test_bitcoin --log_level=test_suite --run_test=wallet_tests/ComputeTimeSmart ``` Seems to be caused by acquiring `cs_main` inside `CWallet::ComputeTimeSmart` in bitcoin#11041. I think this may be causing timeouts on travis like: https://travis-ci.org/bitcoin/bitcoin/jobs/353005676#L2692 Tree-SHA512: b263cd122ea9c88204d1d8e7e35291c71ea6319f05114c5009235a75dbd0f669bc0394f44afeed0d9eb08c2a956cd7c08f1ac4ef28616932fef9b43eaac5521b
…OCKORDER 33eb907 Fix ComputeTimeSmart test failure with -DDEBUG_LOCKORDER (Russell Yanofsky) Pull request description: Failure looks like: ``` Entering test case "ComputeTimeSmart" test_bitcoin: sync.cpp:100: void potential_deadlock_detected(const std::pair<void*, void*>&, const LockStack&, const LockStack&): Assertion `false' failed. unknown location(0): fatal error in "ComputeTimeSmart": signal: SIGABRT (application abort requested) wallet/test/wallet_tests.cpp(566): last checkpoint ``` Reproducible with: ``` ./configure --enable-debug make -C src test/test_bitcoin && src/test/test_bitcoin --log_level=test_suite --run_test=wallet_tests/ComputeTimeSmart ``` Seems to be caused by acquiring `cs_main` inside `CWallet::ComputeTimeSmart` in bitcoin#11041. I think this may be causing timeouts on travis like: https://travis-ci.org/bitcoin/bitcoin/jobs/353005676#L2692 Tree-SHA512: b263cd122ea9c88204d1d8e7e35291c71ea6319f05114c5009235a75dbd0f669bc0394f44afeed0d9eb08c2a956cd7c08f1ac4ef28616932fef9b43eaac5521b
…OCKORDER 33eb907 Fix ComputeTimeSmart test failure with -DDEBUG_LOCKORDER (Russell Yanofsky) Pull request description: Failure looks like: ``` Entering test case "ComputeTimeSmart" test_bitcoin: sync.cpp:100: void potential_deadlock_detected(const std::pair<void*, void*>&, const LockStack&, const LockStack&): Assertion `false' failed. unknown location(0): fatal error in "ComputeTimeSmart": signal: SIGABRT (application abort requested) wallet/test/wallet_tests.cpp(566): last checkpoint ``` Reproducible with: ``` ./configure --enable-debug make -C src test/test_bitcoin && src/test/test_bitcoin --log_level=test_suite --run_test=wallet_tests/ComputeTimeSmart ``` Seems to be caused by acquiring `cs_main` inside `CWallet::ComputeTimeSmart` in bitcoin#11041. I think this may be causing timeouts on travis like: https://travis-ci.org/bitcoin/bitcoin/jobs/353005676#L2692 Tree-SHA512: b263cd122ea9c88204d1d8e7e35291c71ea6319f05114c5009235a75dbd0f669bc0394f44afeed0d9eb08c2a956cd7c08f1ac4ef28616932fef9b43eaac5521b
…OCKORDER 33eb907 Fix ComputeTimeSmart test failure with -DDEBUG_LOCKORDER (Russell Yanofsky) Pull request description: Failure looks like: ``` Entering test case "ComputeTimeSmart" test_bitcoin: sync.cpp:100: void potential_deadlock_detected(const std::pair<void*, void*>&, const LockStack&, const LockStack&): Assertion `false' failed. unknown location(0): fatal error in "ComputeTimeSmart": signal: SIGABRT (application abort requested) wallet/test/wallet_tests.cpp(566): last checkpoint ``` Reproducible with: ``` ./configure --enable-debug make -C src test/test_bitcoin && src/test/test_bitcoin --log_level=test_suite --run_test=wallet_tests/ComputeTimeSmart ``` Seems to be caused by acquiring `cs_main` inside `CWallet::ComputeTimeSmart` in bitcoin#11041. I think this may be causing timeouts on travis like: https://travis-ci.org/bitcoin/bitcoin/jobs/353005676#L2692 Tree-SHA512: b263cd122ea9c88204d1d8e7e35291c71ea6319f05114c5009235a75dbd0f669bc0394f44afeed0d9eb08c2a956cd7c08f1ac4ef28616932fef9b43eaac5521b
…OCKORDER 33eb907 Fix ComputeTimeSmart test failure with -DDEBUG_LOCKORDER (Russell Yanofsky) Pull request description: Failure looks like: ``` Entering test case "ComputeTimeSmart" test_bitcoin: sync.cpp:100: void potential_deadlock_detected(const std::pair<void*, void*>&, const LockStack&, const LockStack&): Assertion `false' failed. unknown location(0): fatal error in "ComputeTimeSmart": signal: SIGABRT (application abort requested) wallet/test/wallet_tests.cpp(566): last checkpoint ``` Reproducible with: ``` ./configure --enable-debug make -C src test/test_bitcoin && src/test/test_bitcoin --log_level=test_suite --run_test=wallet_tests/ComputeTimeSmart ``` Seems to be caused by acquiring `cs_main` inside `CWallet::ComputeTimeSmart` in bitcoin#11041. I think this may be causing timeouts on travis like: https://travis-ci.org/bitcoin/bitcoin/jobs/353005676#L2692 Tree-SHA512: b263cd122ea9c88204d1d8e7e35291c71ea6319f05114c5009235a75dbd0f669bc0394f44afeed0d9eb08c2a956cd7c08f1ac4ef28616932fef9b43eaac5521b
Failure looks like:
Reproducible with:
Seems to be caused by acquiring
cs_main
insideCWallet::ComputeTimeSmart
in #11041.I think this may be causing timeouts on travis like: https://travis-ci.org/bitcoin/bitcoin/jobs/353005676#L2692