fix(sim): surface worker errors from the ParallelSimWrapper handshake - #35
Open
geng-haoran wants to merge 1 commit into
Open
fix(sim): surface worker errors from the ParallelSimWrapper handshake#35geng-haoran wants to merge 1 commit into
geng-haoran wants to merge 1 commit into
Conversation
A worker that died during handler construction or launch surfaced as a bare EOFError/ConnectionResetError from the handshake recv and left the other workers running. The handshake now reads through _recv_or_surface and raises the worker's own traceback, close() tolerates dead workers, and a failed constructor tears the pool down. Regression tests cover launch, close and an end-to-end constructor failure with real worker processes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017i6VtKoovBNed815mWFqxw
geng-haoran
force-pushed
the
fix/parallel-handshake-error
branch
from
September 3, 2026 04:56
6201594 to
bb0fea2
Compare
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.
Summary
ParallelSimWrapperread the constructor andlaunchhandshakes straight off the pipe. A worker that died while constructing its handler (asset missing, backend init failure) or insidelaunchtherefore surfaced as a bareEOFError/ConnectionResetErrorfromremote.recv(), the real traceback sat unread inerror_queue, and the surviving workers were left running._recv_or_surface, which drains the error queue (waiting briefly for the dying worker's queue feeder thread) and raisesRuntimeError("Parallel worker error (<type>): <msg>\n<traceback>")._terminate_workers: join with timeout, then terminate).close()and command sends tolerate a dead worker instead of raisingBrokenPipeErroron top of the real error.Tests
metasim/test/test_parallel_error_handling_general.py(+3, allgeneral): launch surfaces the queued error instead of EOF;close()on a dead worker; an end-to-end constructor failure with real worker processes whose handler raises in__init__— all three fail onmain(ConnectionResetError) and pass here. 10 passed.Review
Independently reviewed as part of the deep-optimization round (architecture review item: worker traceback lost before
_check_error). Backward compatible: successful paths are unchanged.🤖 Generated with Claude Code
https://claude.ai/code/session_017i6VtKoovBNed815mWFqxw