execution/execmodule: reserve execution during startup - #23342
Draft
yperbasis wants to merge 2 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Reserves execution capacity during startup to prevent pre-catch-up state-cache access.
Changes:
- Holds the execution semaphore until startup completes.
- Releases the reservation for legacy and test paths without initial sync.
- Adds readiness and pre-start validation regression tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
node/eth/backend.go |
Completes startup reservation across lifecycle paths. |
execution/execmodule/execmoduletester/exec_module_tester.go |
Preserves test harness behavior. |
execution/execmodule/exec_module.go |
Implements startup semaphore ownership. |
execution/execmodule/exec_module_internal_test.go |
Tests readiness and pre-start rejection. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Closes #22925.
Problem
The execution semaphore was available as soon as
NewExecModulereturned. Engine and embedded RPC servers can start before the lifecycle callsExecModule.Start, so a stateful engine request could run first. Payload validation could attachStateCacheto aSharedDomainsand start read-ahead from the pre-catch-up snapshot.Frozen-block startup then advances durable state through cacheless
SharedDomains. A pre-start reader could therefore leave or refill stale cache entries after catch-up.End state
NewExecModulenow reserves the existing execution permit before the module is exposed.ExecModule.Startowns that reservation throughProcessFrozenBlocksand releases it when startup returns. Try-acquire operations reportBusy, while blocking operations wait.Paths that do not run frozen-block initial sync explicitly finish startup. This keeps the test harness and legacy sync behavior unchanged.
No cache-populating execution path can now begin before or during frozen-block processing.
ProcessFrozenBlocksremains cacheless, with no catch-up write-set copying, cache publication, or per-batch cache work.Tests
The readiness regression test was written first and failed on
mainbecause a newly constructed module reported ready. Coverage also verifies that payload validation returnsBusybefore startup.Validation on the final tree:
go test ./execution/execmodule/... -count=1go test -race ./execution/execmodule/... -count=1 -timeout=10mmake test-shortmake erigonmake integrationmake lintwas run twice on the final tree. Both runs reported no issue in the changed code and stopped only on the existing macOS unused-field report forresidencyOnceindb/seg/decompress.go:199, which this PR does not modify.