Skip to content
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

Interrupt block validation on new best head #1047

Merged
merged 26 commits into from
Dec 5, 2024

Conversation

heifner
Copy link
Member

@heifner heifner commented Nov 26, 2024

Provide a mechanism to auto recover from "poison" blocks. Poison blocks are blocks with transactions which take an unexpectedly long time to execute. Poison block validation will automatically be interrupted when a better block is received from the network.

If a BP node, always produce when scheduled to do so. Interrupting any block validation in progress. This restores the old behavior of "drop late blocks". When a producer is scheduled to produce it will interrupt any validation in progress and produce on top of the previous block.

  • For BP nodes, interrupt block validation when scheduled to produce
    • Moved producer_plugin timer off the main thread executor and onto its own thread.
  • Interrupt block validation when a new best head* is received from the network.
    • Do not apply blocks from the fork database on startup. Blocks in the fork database have not been validated. If one of them would happen to be a poison block then a node would be stuck attempting to validate the block. By allowing network blocks to begin flowing into the node immediately on startup, a new best head can be received and interrupt block validation of blocks being processed out of the fork database.
  • Ctrl-c/signal interrupt now leaves block in the fork database instead of purging it and its descendants.
    • The block and its descendants can be left in the fork database because a node now auto recovers when a new block is received from the network. Or is interrupted if a BP and is scheduled to produce.
  • New best head means that a fork switch is required. If the new best head is a descendant of the current block being validated then validation is not interrupted. Only when the new block is on an alternative fork is validation be interrupted.

Resolves #1039
Resolves #1040

@ericpassmore
Copy link
Contributor

Note:start
category: System Stability
component: Internal
summary: Interrupt block validation on new best head, enables auto recovery from poison blocks.
Note:end

libraries/chain/controller.cpp Outdated Show resolved Hide resolved
libraries/chain/fork_database.cpp Show resolved Hide resolved
libraries/chain/include/eosio/chain/fork_database.hpp Outdated Show resolved Hide resolved
plugins/producer_plugin/producer_plugin.cpp Show resolved Hide resolved
Base automatically changed from GH-986-retry-with-oc to main December 4, 2024 22:20
@heifner heifner merged commit 631fed0 into main Dec 5, 2024
36 checks passed
@heifner heifner deleted the GH-1039-interrupt-block-validation branch December 5, 2024 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCI Work exclusive to OCI team
Projects
None yet
4 participants