beta7: crash-safety — graceful DB-flush failure + ThreadImport exception guard#121
Open
RhettCreighton wants to merge 1 commit into
Open
beta7: crash-safety — graceful DB-flush failure + ThreadImport exception guard#121RhettCreighton wants to merge 1 commit into
RhettCreighton wants to merge 1 commit into
Conversation
… exception guard Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author
|
✅ Build verification (maintainer): the merged Each PR was also independently peer-reviewed for correctness and consensus-safety (all changes confirmed non-consensus — no effect on block/tx validation, PoW, script, or serialization of any valid object). Marking ready for review. As usual, the full |
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.
What
Two NON-CONSENSUS robustness fixes that turn process-killing crashes into graceful handling.
1. Graceful coin-DB flush failure (
src/main.cpp)In
DisconnectTip()andConnectTip(),assert(view.Flush());aborted the process (and was a no-op in-DNDEBUGrelease builds) when the chainstate write failed. Replaced each with a graceful return that follows the existing error path:Both call sites have a
CValidationState& stateparam, andAbortNode(state, ...)is already used throughout these functions (and with this exact message at theFlushStateToDisksite), so the daemon now shuts down cleanly with a clear error instead ofassert-aborting / silently skipping the check.2.
ThreadImportexception guard (src/init.cpp)ThreadImport(reindex /LoadExternalBlockFile/ bootstrap.dat /-loadblock) is launched directly viaboost::bind(&ThreadImport, ...), NOT throughTraceThread, so it is the one worker thread with no surrounding try/catch — an uncaughtstd::exceptionwouldstd::terminatethe whole process. Wrapped the body in:Success path behavior is identical; this only catches what would otherwise crash the node. Mirrors the existing
catch (const std::exception& e)style already used elsewhere ininit.cpp.Why
Audit-verified: both are pre-existing crash/abort hazards on I/O or import failure. The fixes only convert a hard process kill into a logged, graceful node shutdown (DB flush) or a logged thread exit (import).
Files touched
src/main.cpp—DisconnectTip(),ConnectTip()src/init.cpp—ThreadImport()Consensus impact: none
No change to block/tx validation results, PoW/Equihash, the script interpreter, hashed/signed bytes, chainparams, or activation heights — only failure-path handling (graceful abort vs. assert; catching an otherwise-fatal exception).
DRAFT: pending maintainer integration build + gtest.