-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
refactor: move CConnman::RelayInv{Filtered} to PeerManager, remove CConnman::RelayTransaction #5977
Conversation
This pull request has conflicts, please rebase. |
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.
see comment about quorumInstantSendManager
CDeterministicMNManager& m_dmnman; | ||
CEvoDB& m_evoDb; | ||
const std::unique_ptr<PeerManager>& m_peerman; |
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.
I don't like const std::unique_ptr<PeerManager>&
spreading all over code base, but overall PR looks fine except quorumInstantSendManager case
@@ -43,7 +43,7 @@ LLMQContext::LLMQContext(CChainState& chainstate, CConnman& connman, CDeterminis | |||
}()}, | |||
isman{[&]() -> llmq::CInstantSendManager* const { | |||
assert(llmq::quorumInstantSendManager == nullptr); | |||
llmq::quorumInstantSendManager = std::make_unique<llmq::CInstantSendManager>(*llmq::chainLocksHandler, chainstate, connman, *llmq::quorumManager, *sigman, *shareman, sporkman, mempool, mn_sync, unit_tests, wipe); | |||
llmq::quorumInstantSendManager = std::make_unique<llmq::CInstantSendManager>(*llmq::chainLocksHandler, chainstate, connman, *llmq::quorumManager, *sigman, *shareman, sporkman, mempool, mn_sync, peerman, unit_tests, wipe); |
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.
can you describe a situation when exactly does it happen?
ProcessPendingInstantSendLocks > ProcessPendingInstantSendLocks[1] >
ProcessInstantSendLock > RelayInvFiltered
The separate threads won't travel like that until no messages received -> so, peerman won't be nullptr
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.
Crashing was observed in feature_dip3_v19
and feature_llmq_evo
without those changes (tested on d02dcb0)
2024-04-23T14:47:29.534746Z (mocktime: 2014-12-04T17:29:03Z) [ msghand] [net_processing.cpp:5470] [operator()] SendMessages -- queued inv: qsigrec 7239135df98b46c8ab03e684ef15b90c4b6bd5fe8aa757b11105c9c880f347e0 index=0 peer=1
2024-04-23T14:47:29.534770Z (mocktime: 2014-12-04T17:29:03Z) [ msghand] [net.cpp:4033] [PushMessage] sending inv (37 bytes) peer=1
2024-04-23T14:47:29.534845Z (mocktime: 2014-12-04T17:29:03Z) [ msghand] [net_processing.cpp:5470] [operator()] SendMessages -- queued inv: qsigrec 7239135df98b46c8ab03e684ef15b90c4b6bd5fe8aa757b11105c9c880f347e0 index=0 peer=2
2024-04-23T14:47:29.534861Z (mocktime: 2014-12-04T17:29:03Z) [ msghand] [net.cpp:4033] [PushMessage] sending inv (37 bytes) peer=2
2024-04-23T14:47:29.534956Z (mocktime: 2014-12-04T17:29:03Z) [ msghand] [net_processing.cpp:5470] [operator()] SendMessages -- queued inv: qsigrec 7239135df98b46c8ab03e684ef15b90c4b6bd5fe8aa757b11105c9c880f347e0 index=0 peer=4
2024-04-23T14:47:29.534971Z (mocktime: 2014-12-04T17:29:03Z) [ msghand] [net.cpp:4033] [PushMessage] sending inv (37 bytes) peer=4
2024-04-23T14:47:29.535221Z (mocktime: 2014-12-04T17:29:03Z) [ msghand] [net_processing.cpp:3146] [ProcessMessage] received: inv (37 bytes) peer=2
2024-04-23T14:47:29.535239Z (mocktime: 2014-12-04T17:29:03Z) [ msghand] [net_processing.cpp:3670] [ProcessMessage] got inv: qsigrec 7239135df98b46c8ab03e684ef15b90c4b6bd5fe8aa757b11105c9c880f347e0 have peer=2
2024-04-23T14:47:29.566421Z (mocktime: 2014-12-04T17:29:03Z) [ isman] [llmq/instantsend.cpp:951] [ProcessPendingInstantSendLocks] CInstantSendManager::ProcessPendingInstantSendLocks -- verified locks. count=0, alreadyVerified=1, vt=0, nodes=0
2024-04-23T14:47:29.566439Z (mocktime: 2014-12-04T17:29:03Z) [ isman] [llmq/instantsend.cpp:996] [ProcessInstantSendLock] CInstantSendManager::ProcessInstantSendLock -- txid=62fd9a36bf4b11c4e7c0bfa9ffe80f6dc66fef54136c2d241a478daae1f880e6, islock=c2e83196cf1af12277b225ff043b4fd[...]
2024-04-23T14:47:29.566499Z (mocktime: 2014-12-04T17:29:03Z) [ isman] [llmq/instantsend.cpp:1226] [RemoveNonLockedTx] CInstantSendManager::RemoveNonLockedTx -- txid=62fd9a36bf4b11c4e7c0bfa9ffe80f6dc66fef54136c2d241a478daae1f880e6, retryChildren=1, retryChildrenCount=0
2024-04-23T14:47:29.566591Z (mocktime: 2014-12-04T17:29:03Z) [ isman] [stacktraces.cpp:528] [PrintCrashInfo] Posix Signal: Segmentation fault
No debug information available for stacktrace. You should add debug information and then run:
dashd -printcrashinfo=bvcgc43iinzgc43ijfxgm3ybaacwiyltnbscaudponuxqictnftw4ylmhiqfgzlhnvsw45dboruw63ramzqxk3duaaaa====
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.
dash@db65c47c7824:/src/dash$ ./test/functional/test_runner.py
[...]
feature_asset_locks.py --legacy-wallet | � Failed | 55 s
feature_dip3_v19.py --legacy-wallet | � Failed | 120 s
feature_llmq_chainlocks.py --legacy-wallet | � Failed | 362 s
feature_llmq_evo.py --legacy-wallet | � Failed | 104 s
feature_llmq_is_cl_conflicts.py --legacy-wallet | � Failed | 96 s
feature_llmq_is_retroactive.py --legacy-wallet | � Failed | 96 s
feature_notifications.py --legacy-wallet | � Failed | 124 s
interface_zmq_dash.py --legacy-wallet | � Failed | 108 s
p2p_instantsend.py --legacy-wallet | � Failed | 120 s
rpc_verifyislock.py --legacy-wallet | � Failed | 111 s
ALL | � Failed | 7909 s (accumulated)
Runtime: 2009 s
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.
LGTM cbdc34d
Range diff here
|
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.
utACK 11df052
This pull request has conflicts, please rebase. |
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.
utACK 11df052
range-diff
|
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.
re-utACK f2fe39f
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.
LGTM, utACK (assuming CI is happy too)
Ranged diff:
|
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.
utACK f2fe39f
ForEachNode is publicly available, which will help us extract the functions from CConnman in a subsequent commit
Required to avoid crashes when calling RelayInvFiltered in situations where the PeerManager* atomic hasn't been set (possible when ProcessMessage isn't called, leaving the value unset, while a separate thread traverses the ProcessPendingInstantSendLocks > ProcessPendingInstantSendLocks[1] > ProcessInstantSendLock > RelayInvFiltered call chain). [1] - There is a function with the exact same name but with multiple arguments
, bitcoin#23695, bitcoin#21160, bitcoin#24692, partial bitcoin#20196, bitcoin#25176, merge bitcoin-core/gui#526 (networking backports: part 4) ab7ac1b partial bitcoin#25176: Fix frequent -netinfo JSON errors from null getpeerinfo#relaytxes (Kittywhiskers Van Gogh) c89799d merge bitcoin#24692: Follow-ups to bitcoin#21160 (Kittywhiskers Van Gogh) 33098ae merge bitcoin#21160: Move tx inventory into net_processing (Kittywhiskers Van Gogh) 24205d9 partial bitcoin#20196: fix GetListenPort() to derive the proper port (Kittywhiskers Van Gogh) 7f72009 merge bitcoin-core/gui#526: Add address relay/processed/rate-limited fields to peer details (Kittywhiskers Van Gogh) a9114f1 merge bitcoin#23695: Always serialize local timestamp for version msg (Kittywhiskers Van Gogh) d936c28 merge bitcoin#23575: Rework FillNode (Kittywhiskers Van Gogh) 6f8c730 merge bitcoin#19499: Make timeout mockable and type safe, speed up test (Kittywhiskers Van Gogh) 43a82bd merge bitcoin#20769: fixes "advertised address where nobody is listening" (Kittywhiskers Van Gogh) Pull request description: ## Additional Information * Dependent on #5978 * Dependent on #5977 ## Breaking Changes None observed. ## Checklist: - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)** - [x] I have added or updated relevant unit/integration/functional/e2e tests - [x] I have made corresponding changes to the documentation **(note: N/A)** - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: PastaPastaPasta: utACK ab7ac1b Tree-SHA512: 87bf5108bb80576c5bff8cd577add7800044da252fd18590e06a727f0bf70de94e2e9294b4412cdd9f1f6676472b0359902af361aaffc4c9ee299ad07d6af009
Additional information
Dependency for backport: merge bitcoin#20769, #19499, #23575, #23695, #21160, #24692, partial bitcoin#20196, #25176, merge bitcoin-core/gui#526 (networking backports: part 4) #5982
Unfortunately, we are stuck with using the
unique_ptr
const-ref ofPeerManager
for initializing {CJ
,LLMQ
}Context
due to some unit tests depending on Dash-specific entities but based on a testing setup that doesn't initializePeerManager
(specificallyvalidation_chainstatemanager_tests
, which usesChainTestingSetup
, as opposed toTestingSetup
, which initializesPeerManager
).Attempting to dereference it earlier will result in crashing (see CI pipeline here)
Breaking Changes
None observed.
Checklist: