-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge ddc0a60 into merged_master (Bitcoin PR #18617)
For reasons I do not really grok, this PR changes the timing behavior of the functional tests to reliably expose a deadlock in the claimpegin RPC that has existed since the 0.17 rebase. The mechanism is: in `claimpegin` in src/wallet/rpcwallet.cpp:5873, we call `AcceptToMemoryPoolWorker`. This requires cs_main to be locked, which it is not (contrast Core's `testmempoolaccept` RPC, which similarly calls `AcceptToMemoryPoolWorker` from the RPC thread, and locks cs_main immediately before). We do *say* that it is locked, in the `LockAssertion` one the line above, but this was added in ad3d496 during the 0.17 rebase (PR #620), apparently to shut up some linter on OSX, and as near as I can tell it was never true. Anyway, `AcceptToMemoryPoolWorker` calls through a couple layers which assume cs_main is locked, to `AcceptSingleTransaction`, which locks m_pool.cs on line src/validation.cpp:1101. It then calls `PreChecks`, which on line 784 calls ::ChainActive(), which _actually_ locks cs_main, though only briefly. This line is the deadlock, because we locked m_pool.cs followed by cs_main... ...meanwhile, in src/net_processing.cpp, we lock cs_main at the top of the `PeerLogicValidation::SendMessages` loop (src/net_processing.cpp:3628). In the same loop, in the `feefilter` message processing, we call CTxMemPool::GetMinFee (src/net_processing.cpp:4137), which locks m_pool.cs. Deadlock. Anyway, that explains the change to locking behavior that I added to an otherwise test-only PR.
- Loading branch information
Showing
6 changed files
with
31 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters