Skip to content

fix(serve): catch BrokenPipeError/ConnectionResetError in _json_response - #81

Open
wycfirezdog wants to merge 1 commit into
adrida:mainfrom
wycfirezdog:fix/issue-64-broken-pipe-error
Open

wycfirezdog wants to merge 1 commit into
adrida:mainfrom
wycfirezdog:fix/issue-64-broken-pipe-error

Conversation

@wycfirezdog

Copy link
Copy Markdown

serve.py crashed with BrokenPipeError when an HTTP client disconnected before the server finished writing the response. The _json_response() method wrote to self.wfile with no exception handling.

Changes:

  • Wrap entire response-writing block in try/except
  • Catch (BrokenPipeError, ConnectionResetError) silently
  • Client disconnects no longer produce noisy tracebacks

Fixes adrida#64: serve.py crashed with BrokenPipeError when an HTTP client
disconnected before the server finished writing the response. The
_json_response() method wrote to self.wfile with no exception handling.

Changes:
- Wrap entire response-writing block in try/except
- Catch (BrokenPipeError, ConnectionResetError) silently
- Client disconnects no longer produce noisy tracebacks
@wycfirezdog
wycfirezdog requested a review from adrida as a code owner August 20, 2026 20:48

This branch has not been deployed

No deployments
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