gabriel / muse public
fix minor transport fix/sigpipe-large-push #1 / 1
gabriel · 149 days ago · Apr 10, 2026 · Diff

fix(transport): ignore SIGPIPE during HTTP I/O to survive early server close on large pushes

app.py sets SIGPIPE=SIG_DFL at startup so that piping 'muse log | head' exits cleanly. This same disposition kills the process (exit 141) when the server closes the connection while the client is still uploading a large request body — e.g. a 60+ MB push bundle that triggers a 409 conflict or a 401 auth failure.

Fix: _open_url() now temporarily sets SIGPIPE=SIG_IGN for the duration of the HTTP call via the new _ignore_sigpipe() context manager. Broken- pipe conditions surface as TransportError('Connection reset by peer' or 'Broken pipe') instead of killing the process.

Tests: 3 regression tests in TestSigpipeRegression spin a minimal TCP server that sends a 4xx response after headers and closes immediately, then verify TransportError is raised regardless of SIGPIPE disposition.

sha256:a34925bfdd33f1794a68ad51c89caa321e39bdea34e0c8cef5aea8e20e1cb28e sha
+14 ~1 symbols
sha256:ed24ce3115fe6677287b4e32494ea19802bbf8839ebcb29343199eebd958d196 snapshot
+14
symbols added
~1
symbol modified
0
dead code introduced
Semantic Changes 15 symbols
~ muse/core/transport.py .py 4 symbols added, 1 symbol modified
+ _ignore_sigpipe function function _ignore_sigpipe L373–396
+ abc import import collections.abc L98–98
+ contextlib import import contextlib L99–99
+ signal import import signal L105–105
~ tests/test_core_transport.py .py 10 symbols added
+ TestSigpipeRegression class class TestSigpipeRegression L517–571
+ _run_early_close_scenario method method _run_early_close_scenario L526–559
+ test_sigpipe_not_fatal_401_large_body method method test_sigpipe_not_fatal_401_large_body L565–567
+ test_sigpipe_not_fatal_409_large_body method method test_sigpipe_not_fatal_409_large_body L561–563
+ test_sigpipe_not_fatal_500_large_body method method test_sigpipe_not_fatal_500_large_body L569–571
+ _early_close_server function function _early_close_server L474–514
+ signal import import signal L6–6
+ socket import import socket L7–7
+ threading import import threading L8–8
+ time import import time L9–9
← Older Oldest on fix/sigpipe-large-push
All commits
Newer → Latest on fix/sigpipe-large-push

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:a34925bfdd33f1794a68ad51c89caa321e39bdea34e0c8cef5aea8e20e1cb28e --body "your comment"