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.
Description
Some clients reported an issue where consensus will halt from time to time when nodes are under heavy load.
What happened was that, round lasted longer, almost the same as the round timeout, because the nodes were under stress test, so round expired and insert proposal happened at the same time. Unfortunatelly, round expired channel got notified while proposal was being inserted into chain. This created a strange situation, where block was inserted to chain, but rounds kept changing (round change was happening after this), even though porposal got inserted. This caused consensus to halt, and stop producing blocks.
The solution was provided by @lazartravica, and the fix was quite easy. When the quorum for commit messages is hit, and the node is in
fin
state (meaning it accepted the proposal, and will now insert it to chain),roundDone
channel will be hit immediately, and porposal will be inserted after that. This means that round expired will not be hit while we are inserting proposal, since before this fixroundDone
was hit only after the block was inserted, so if InsertProposal lasts a bit longer there is a chance that round timeout can be hit while the node is inserting block.Changes include
Checklist