Skip to content

fix: avoid native SIGPIPE handlers on HTTP disconnect - #215

Draft
gspark-etri wants to merge 2 commits into
fix/207-atom-hybrid-runtimefrom
fix/214-http-sigpipe
Draft

gspark-etri wants to merge 2 commits into
fix/207-atom-hybrid-runtimefrom
fix/214-http-sigpipe

Conversation

@gspark-etri

Copy link
Copy Markdown
Collaborator

Background

Closing an HTTP stream while the ATOM SDK is loaded invokes its native SIGPIPE handler, producing backtraces even though Python subsequently handles BrokenPipeError. The SDK changes the native disposition without updating Python's signal inspection state.

Changes

Use an unbuffered HTTP socket writer with MSG_NOSIGNAL per write. Preserve BrokenPipeError, byte count and file descriptor behavior; do not change process-global signal handlers. Add regression tests and hardware evidence. This PR is stacked on #210.

Verification

  • PYTHONPATH=opt_prime python3 -m pytest -q opt_prime/tests/test_http_sigpipe.py opt_prime/tests/test_serve_batched.py opt_prime/tests/test_pd_http_cancel.py: 14 passed.
  • Controlled stdlib-writer baseline fails the signal assertion; candidate passes.
  • ATOM Qwen3-0.6B device cache: native backtrace headers 6 → 0; 3 serial and 12 concurrent output sequences unchanged; cancellation/disconnect drain and reuse pass.
  • ATOM Qwen3-4B host cache: HTTP checks pass, 12/12 concurrent outputs match serial, prefix/host hits 33792/8064, no observed native backtrace headers.
  • Engine baseline 21f2c87, fix 9e442cd. ATOM, rebel0.11.0, optimum-rbln0.11.0.post1, torch2.11.0+cpu. B1/context9216, inputs128/2048/8192, output32, queued clients4/8. Reproduction and JSON evidence in opt_prime/docs/validation/http214/.
  • Sensitive-data and diff checks pass.

Compatibility and limits

Platforms without MSG_NOSIGNAL retain prior flags0 behavior. This is a disconnect robustness fix, not a performance or numerical-accuracy claim. Tests use fixed output length and do not establish semantic quality or hardware batching.

Related Issue

Closes #214. Related to #211 and #201. Full model/backend matrix remains ongoing.

AI-assisted implementation and verification with Codex; maintainer review and merge required.

gspark-etri added a commit that referenced this pull request Oct 30, 2026
…214, #229, #241) (#281)

- llmd: HTTP handler writes via MSG_NOSIGNAL so a client disconnect raises
  BrokenPipeError instead of hitting a vendor SIGPIPE handler (#215).
- serve_batched: add the tokenizer EOS to generation_config EOS ids (#230);
  --pd-prefill-chunk / --pd-prefill-no-prefix-cache for the Torch producer (#242).
- test that serve_stage's handler actually writes through the no-signal writer.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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