forked from cometbft/cometbft
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(consensus): Remove reactor rlocks on Consensus (cometbft#3211)
PR with @ebuchman !!! Remove (most) of the reactor RLock's on consensus! (Remaining one is in the gossip routine, should be easy to fix, but as a separate PR) The consensus reactor on ingesting messages takes RLock's on Consensus mutex, preventing us from adding things to the queue. (And therefore blocking behavior) This can cause the peer message queue to be blocked. Now it won't be blocked because we update the round state directly from the cs state update routine (via event bus) when: - A vote is added - A block part is added - We enter a new consensus step. (Receiving a full block triggers this for us, we will enter prevote or precommit round) This shouldn't change reactor message validity, because Reactor.Receive could always view a cs.RoundState that will be old when the packet reaches the cs.HandleMsg queue. Every update to consensus' roundstate pushes the update into the reactor's view, so we avoid locks. I don't think any new tests are required! --- #### PR checklist - [x] Tests written/updated - [x] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments - [x] Title follows the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec --------- Co-authored-by: Ethan Buchman <[email protected]> Co-authored-by: Anton Kaliaev <[email protected]>
- Loading branch information
1 parent
10bfd89
commit 4b278e9
Showing
3 changed files
with
40 additions
and
17 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
...ngelog/unreleased/improvements/3211-make-cs-reactor-no-longer-takes-cs-locks.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- `[consensus]` Make the consensus reactor no longer have packets on receive take the consensus lock. | ||
Consensus will now update the reactor's view after every relevant change through the existing | ||
synchronous event bus subscription. | ||
([\#3211](https://github.com/cometbft/cometbft/pull/3211)) |
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