gh-84532: Reopen the socket in SocketHandler.send() when sending fails#154540
Open
serhiy-storchaka wants to merge 2 commits into
Open
gh-84532: Reopen the socket in SocketHandler.send() when sending fails#154540serhiy-storchaka wants to merge 2 commits into
serhiy-storchaka wants to merge 2 commits into
Conversation
…g fails It dropped the record whose send failed and reconnected only on the next record. Now it reopens the socket and sends the record again. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The test left the server-side connections unclosed, which regrtest reported as an altered environment (ResourceWarning: unclosed socket). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
SocketHandler.send()dropped the record whose sending failed and reconnected only on the next record, so after the connection was closed (for example after an idle timeout) it lost more records than necessary.It now reopens the socket and sends the record again, like
SysLogHandler.emit()has done for the Unix socket since 2.5.This does not make
SocketHandlerlossless over TCP: the first record sent after the connection is closed still succeeds locally and is lost when the reset arrives, which cannot be detected. But it stops dropping the following record, whose send actually fails.🤖 Generated with Claude Code