Repository navigation
Conversation
ProcessMessages reconsiders a peer's orphan transactions before taking its next message, and took cs_main for this even when the peer had none. Check for orphan work under m_tx_download_mutex first, so that a message from a peer without orphan work does not wait for a busy chainstate. Test that ProcessMessages completes for such a peer while cs_main is held.
Contributor
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process. ConflictsNo conflicts as of last run. |
Member
|
I think these kind of refactors only make sense if/when #36244 is an accepted goal by the project I have not actually looked, just noting for this PR's sake. |
Contributor
Author
Contributor
Author
|
PR description updated for greater clarity. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

ProcessMessagestakescs_mainfor every peer on every handler pass, just to check for orphan transactions to reconsider, though most peers have none. This PR checks for orphan work underm_tx_download_mutexfirst and skipscs_mainwhen there is none. Peers with orphan work take the same path as before, plus one uncontended lock.This removes needless
cs_maincontention with validation, RPC and wallet threads. It's part of a broader effort to reducecs_maincontention in net processing (see #36244 for context), but stands on its own.ProcessMessageshandling apingcs_mainfor 50 msRelease builds, median of 3 runs.
SendMessagesin the same handler pass still takescs_main.Tested by
process_messages_without_orphan_work, which fails without this change.