fix: let anvil finish loading its state - #91
Merged
Merged
Conversation
#90 kills a boot that has not answered after 10s. Anvil replays its persisted state before it answers anything, and with --state-interval and preserved historical states that runs past 10s on a busy chain, so a stack whose state file grew large could no longer start: each request killed the load half way through and returned "Stack is taking too long to start". - a boot that is still loading is left alone and the stack reports :starting; later requests poll it instead of starting a second anvil - readiness polling watches the process, so a boot that exits reports its status immediately instead of after the full readiness budget - the readiness request has a timeout; it defaulted to infinity, which parked the whole GenServer whenever anvil accepted a connection and then did not answer - suspend gives anvil 30s to finish its state dump instead of muontrap's 500ms; a SIGKILL landing mid-dump leaves a truncated state.json that anvil then refuses to parse, exiting 2 - a state.json anvil cannot parse is moved aside so the stack boots clean instead of staying down - suspend waits for the port to be released before a resume rebinds it Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Holding one port per stack meant every resume raced the previous anvil's shutdown: it keeps the socket while it dumps state, so the boot either failed to bind or, worse, looked healthy because the old process answered the readiness probe. - each boot claims a fresh port and hands the old one back only once anvil has actually let go of it, from outside the GenServer so a shutdown never blocks requests to the stack - HttpPorts checks a port is bindable before handing it out, so a process that outlived its stack cannot poison a claim - the EXIT handler only reacts to anvil's own exit; it treated any linked process's exit as the chain dying - destroy waits for anvil instead of dropping its port immediately Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
angus3 could not start: every request killed the boot after 10s and returned "Stack is taking too long to start". Anvil replays its persisted state before it answers anything, and with
state_intervalplus preserved historical states that file grows past what a 10s readiness cap allows. #90 turned that cap into a kill, so the stack could never come back.startingand later requests poll it instead of killing it or starting a second anvil.state.jsonthat anvil then refuses to parse, exiting 2.state.jsonanvil cannot parse is moved tostate.json.corruptand the stack boots clean instead of staying down.HttpPortschecks a port binds before handing it out. Reusing a port raced anvil's shutdown, and a stale process answering the probe read as a healthy boot.Verification
mix test test/ethui/services/anvil_test.exs— 10 tests, 0 failures, including new coverage for the still-loading path, the unreadable state file, and serving again after a suspend.The full suite is flaky on this machine (docker is unavailable, so the graph and ipfs services flap). Measured over two runs each in the same environment:
main11 and 12 failures, this branch 15 and 1. The websocket proxy test fails on both.🤖 Generated with Claude Code