Repository navigation
Serve /node/state without blocking on NodeState::lock during snapshot installation - #8889
Open
Amaury Chamayou (achamayou) wants to merge 2 commits into
Open
Amaury Chamayou (achamayou) wants to merge 2 commits into
Amaury Chamayou (achamayou) wants to merge 2 commits into
Conversation
Amaury Chamayou (achamayou)
force-pushed
the
achamayou-legendary-tribble
branch
from
December 2, 2026 11:23
7c34100 to
7ac9df3
Compare
Amaury Chamayou (achamayou)
force-pushed
the
achamayou-legendary-tribble
branch
from
December 2, 2026 11:24
7ac9df3 to
1e61b49
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A state-publication race can overwrite newer private-recovery state and clear its fields, causing /node/state to hide recovery progress until recovery finishes.
1 open issue
What changed in this PR
Builds on #8490 to keep /node/state responsive during snapshot installation and ledger recovery.
Changes:
- Publishes progress behind a dedicated mutex instead of
NodeState::lock. - Adds regression coverage for non-blocking queries and recovery progress.
- Documents endpoint availability during snapshot installation.
Custom instructions used
.github/instructions/reviewing.instructions.md
| File | Description |
|---|---|
src/node/rpc/test/node_frontend_test.cpp |
Tests responsiveness and recovery progress reporting. |
src/node/recovery_decision_protocol.cpp |
Reads recovered progress through its accessor. |
src/node/node_state.h |
Publishes state and progress under a dedicated mutex. |
doc/releases/migration_7_x_to_8_x.rst |
Clarifies availability during snapshot installation. |
doc/operations/recovery.rst |
Updates recovery-monitoring guidance. |
Review effort: Balanced
Amaury Chamayou (achamayou)
force-pushed
the
achamayou-legendary-tribble
branch
from
December 2, 2026 13:05
1e61b49 to
54d128a
Compare
Base automatically changed from
achamayou-issue-6188-check-snapshot-isolation-of-signature-tr-33860f
to
main
December 3, 2026 15:11
…snapshot install Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Amaury Chamayou (achamayou)
force-pushed
the
achamayou-legendary-tribble
branch
from
December 3, 2026 15:11
54d128a to
964f34f
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Critical issues remain: a test helper omits index publication, causing exceptions, and unsynchronized state transitions can overwrite recovery state and make /node/state report incorrectly.
4 open issues
Review effort: Balanced
Serialize sm.advance() and published_progress updates under a dedicated state_transition_lock so concurrent transitions (e.g. a public-only join completing while a global commit hook starts private recovery) cannot overwrite newer published progress, while keeping progress_lock a strict data-only leaf lock. Replace duplicated startup_seqno and last_recovered_signed_idx fields with single std::atomic members on NodeState so internal writers, friend helpers, and non-blocking getters always share one source of truth. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 047a18894fd2487bb74f63dfd52b95b3
This branch has not been deployed
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.


GET /node/statewas converted into a non-transactionalCommandendpoint in #8490 so operators can monitor node progress before the KV store becomes ready. However,NodeState::state(),NodeState::get_startup_snapshot_seqno(), andNodeState::get_last_recovered_signed_idx()all acquiredNodeState::lock, whichcomplete_join_unsafe()andinstall_recovery_snapshot_and_start_unsafe()hold for the entire duration of snapshot deserialisation (StoreReadiness::InstallingSnapshot). On large snapshots,/node/statetherefore stalled until deserialisation completed.This PR separates the read-only progress fields polled by
/node/statefromNodeState::lock:state,recovery_target_seqno, andlast_recovered_private_seqno) are published into aPublishedProgresssnapshot guarded by a leaf mutex (progress_lock), withstate_transition_lockserialisingsm.advance(...)and publication across transition helpers.startup_seqnoandlast_recovered_signed_idx) are stored as singlestd::atomicmembers onNodeState, avoiding duplicate copies across internal writers, friend helpers, and non-blocking getters.All state transitions and recovery/rollback progress updates publish promptly without holding
progress_lockacross snapshot deserialisation, ledger replay, KV operations, logging, orNodeState::lockacquisition, allowing/node/stateto respond throughout both public ledger recovery and snapshot installation.Safety and compatibility
progress_lockis strictly a data-only leaf lock: callers compute any KV/store values before acquiring it and perform only trivial field copies while holding it, preventing lock-order inversions withNodeState::lockor KV locks.state_transition_lockserialisessm.advance(...)andpublished_progressupdates in bothadvance_state()andadvance_to_reading_private_ledger(), preventing a concurrent transition (such ascomplete_join_unsafe()vs.on_secrets_global_commit()->begin_private_recovery()) from overwriting newer published state while preserving the ordering thatsmadvances before/node/stateobserves the new state.NodeState::state()reads the published private-recovery target and last-recovered version atomically underprogress_lockwithout dereferencingrecovery_store, avoiding races acrossbegin_private_recovery(), rollback, andrecovery_store.reset()inrecover_private_ledger_end_unsafe().