fix: swallow client-disconnect errors in JSON response writer#10
Merged
fix: swallow client-disconnect errors in JSON response writer#10
Conversation
Long-running endpoints like /api/delete can take 90+ seconds during Lidarr deletion workflows. If the browser times out or navigates away before the response is written, the wfile.write / end_headers calls raise ConnectionResetError / BrokenPipeError, producing a noisy traceback even though the server-side work completed successfully. Wrap the response write in a try/except for those two exceptions so the log stays clean when the client hangs up early. https://claude.ai/code/session_01CgFVz9atieqZfC5oiUnTKt
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
WebUIHandler._json_responseheader/body writes in atry/exceptforConnectionResetErrorandBrokenPipeError.[Errno 104] Connection reset by peertraceback that surfaced after long-running/api/deletecalls (Lidarr deletion workflows can take 90+ seconds, during which the browser often times out or navigates away).Lidarr delete complete: 18 files deleted across 12 albums); only the unsent reply was lost.Test plan
/api/auth-status,/api/login, etc.) still return their JSON bodies unchanged.https://claude.ai/code/session_01CgFVz9atieqZfC5oiUnTKt