fix(electrum): stop logging full response payload on client disconnect#223
Open
EddieHouston wants to merge 1 commit into
Open
fix(electrum): stop logging full response payload on client disconnect#223EddieHouston wants to merge 1 commit into
EddieHouston wants to merge 1 commit into
Conversation
Broken-pipe/reset errors during send embedded the entire JSON-RPC reply (e.g. a large get_history result) into the error context, which was then logged at ERROR and split across many Cloud Logging entries. Truncate the send-failure context to a byte count and route client disconnects to debug!.
Randy808
approved these changes
Jun 16, 2026
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.
Problem
A client that disconnects mid-response (broken pipe / connection reset) caused the entire JSON-RPC reply to be logged at
ERROR. For large replies — e.g. ablockchain.scripthash.get_historyresult for a very popular address — this dumped a multi-megabyte line to stderr, which Cloud Logging then split across many ERROR entries.Root cause chain in
src/electrum/server.rs:send_values()built its error context withformat!("failed to send {}", value), embedding the entire replyValueinto the error string.run()and was logged viaerror!(... e.display_chain() ...).stderrlogwrites to stderr, which GKE/Cloud Logging tags asERRORseverity by default.Fix
is_disconnect()helper that walks the errorsource()chain forBrokenPipe | ConnectionReset | ConnectionAborted | UnexpectedEof.run(), route client disconnects todebug!(expected, not actionable) while genuine failures still log aterror!.Result
No more multi-megabyte ERROR spam. A client disconnecting mid-response now produces a single concise
debug!line; real write/protocol failures remain aterror!without the payload.