Skip to content

fix(sim): surface worker errors from the ParallelSimWrapper handshake - #35

Open
geng-haoran wants to merge 1 commit into
mainfrom
fix/parallel-handshake-error
Open

fix(sim): surface worker errors from the ParallelSimWrapper handshake#35
geng-haoran wants to merge 1 commit into
mainfrom
fix/parallel-handshake-error

Conversation

@geng-haoran

@geng-haoran geng-haoran commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

ParallelSimWrapper read the constructor and launch handshakes straight off the pipe. A worker that died while constructing its handler (asset missing, backend init failure) or inside launch therefore surfaced as a bare EOFError / ConnectionResetError from remote.recv(), the real traceback sat unread in error_queue, and the surviving workers were left running.

  • Both handshakes now go through _recv_or_surface, which drains the error queue (waiting briefly for the dying worker's queue feeder thread) and raises RuntimeError("Parallel worker error (<type>): <msg>\n<traceback>").
  • A constructor failure tears the pool down (_terminate_workers: join with timeout, then terminate).
  • close() and command sends tolerate a dead worker instead of raising BrokenPipeError on top of the real error.

Tests

metasim/test/test_parallel_error_handling_general.py (+3, all general): 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 on main (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

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
geng-haoran force-pushed the fix/parallel-handshake-error branch from 6201594 to bb0fea2 Compare September 3, 2026 04:56
@geng-haoran geng-haoran changed the title chore(release): development & release protocol, PR-time CI, release workflow, distribution rename fix(sim): surface worker errors from the ParallelSimWrapper handshake Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant