execution, cmd, docs: make FcuBackgroundCommit consumers wait out the async commit - #22535
Draft
yperbasis wants to merge 1 commit into
Draft
execution, cmd, docs: make FcuBackgroundCommit consumers wait out the async commit#22535yperbasis wants to merge 1 commit into
yperbasis wants to merge 1 commit into
Conversation
… async commit Split out of #21293. execDownloadedBatch retries Busy while a background FCU commit holds the exec semaphore; import_cmd waits for the commit via WaitIdle before writing HeadBlockHash; the flag usage describes the actual contract.
This was referenced Jul 16, 2026
Draft
Open
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.
Split out of #21293 (
FcuBackgroundCommitgroundwork). Defaults unchanged — the flag staysfalse; the flip is #22269's.With the flag on,
UpdateForkChoicereturns before the MDBX flush+commit lands (the commit runs in a background goroutine holding the exec semaphore), and state-change notifications alone do not guarantee MDBX contains the head. This PR makes the flag's consumers robust to that:Engine: busy-tolerant batch execution
A background FCU commit briefly holds the exec semaphore, so
ValidateChain/UpdateForkChoicecan routinely returnBusy.execDownloadedBatchwaits it out viaretryBusy: a ctx-aware 50 ms poll with a periodic debug log so a stuck commit surfaces instead of hanging silently.import: wait for the commit
import_cmd.InsertChaincallsExecModule.WaitIdleafter driving forkchoice, soHeadBlockHashcan't land in MDBX ahead of the header it points to — the state-change stream only confirms the dispatcher fired, not that the commit landed.Flag documentation
--fcu.background.commitusage now states the actual contract: the FCU response returns before the MDBX flush+commit lands; remote rpcdaemon "latest" stays consistent but can lag for the commit duration. Same wording inethconfigand the docs site (llms files regenerated).Safety recap (with the flag enabled)
The bg goroutine releases the exec semaphore only after the commit completes and the overlay is unpublished, so FCU N+1 always reads FCU N's committed state;
engine_newPayload/engine_getPayloadserialize behind a pending commit (~commit-duration added latency; aSYNCINGresponse in a pipelined burst is spec-valid and self-heals).