fix: respawn panicked solver workers instead of losing them - #348
Draft
zizou0x wants to merge 1 commit into
Draft
Conversation
A panic while solving previously unwound through the worker thread and killed it silently; the pool only noticed at shutdown join(). Once every worker had hit a poison request, the pool answered 100% no_route until the pod was recreated. Each worker thread now runs sessions in a catch_unwind loop: a panic is logged at ERROR with the panic message, counted in the worker_pool_worker_panics_total metric, and the worker is respawned after a short backoff. Clean shutdowns still exit the thread, including shutdown signals arriving while a worker is mid-respawn. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
brunoguerios
self-requested a review
July 24, 2026 12:49
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
spawn_workers_genericnow runs each worker thread as a loop of sessions wrapped incatch_unwind:worker_pool_worker_panics_total{pool}counter, then the worker is respawned after a 100ms backoff (prevents a hot loop if initialization panics deterministically)Each session gets fresh event/derived/shutdown receivers and rebuilds the worker (including graph initialization), same as the existing lag-recovery path.
Why
Prod incident 2026-07-23: a quote request triggered a div-by-zero panic in pool math. Each occurrence silently killed one solver worker thread — the panic was only logged at shutdown
join(), ~100 minutes later. After all workers on both ethereum pods died, every quote returnedno_route_foundfor ~1.5h until the pods were recreated.Complements #347 (which stops that specific panic from escaping the simulation call); this PR makes the pool survive any panic that still gets through.
Tests
worker_respawns_after_panic_and_processes_next_task: a worker that panics on a poison order answers the next task, and the pool still shuts down cleanly🤖 Generated with Claude Code