fix: handle ECONNRESET from sysread on Windows#33
Merged
toddr merged 1 commit intocpan-authors:mainfrom Mar 21, 2026
Merged
Conversation
On Windows, Perl emulates socketpair(PF_UNIX) via TCP localhost
sockets. When the remote end calls close() without shutdown(),
a TCP RST is sent instead of FIN, causing sysread() to fail with
ECONNRESET ("An existing connection was forcibly closed by the
remote host") rather than returning 0 for EOF.
Treat ECONNRESET the same as ESPIPE (Solaris EOF) — both indicate
the remote end has disconnected, not a true read error.
Fixes cpan-authors#26
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
toddr-bot
added a commit
to toddr-bot/Net-Ident
that referenced
this pull request
Mar 22, 2026
cpanfile listed Fcntl and Config which are not used by Ident.pm (Fcntl was removed when PR cpan-authors#14 replaced fcntl() with blocking(0)). Errno is used but was missing from both cpanfile and PREREQ_PM. Also updates Changes with post-1.27 fixes that were merged but not recorded (PRs cpan-authors#25, cpan-authors#30, cpan-authors#31, cpan-authors#33). Co-Authored-By: Claude Opus 4.6 <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.
Summary
On Windows, Perl emulates
socketpair(PF_UNIX)via TCP localhost sockets. When the remote end callsclose()withoutshutdown(), a TCP RST is sent instead of FIN, causingsysread()to fail withECONNRESETrather than returning 0 for EOF. This makesready()report a read error instead of treating it as a normal disconnect.This fix treats
ECONNRESETthe same asESPIPE(the Solaris EOF equivalent) — both indicate the remote end has disconnected, not a true read error.Fixes #26
Changes
$!{ECONNRESET}check alongside existing$!{ESPIPE}inready()'s sysread error handlingTest plan
ready()handles abrupt disconnects gracefullyGenerated by Kōan /fix
Quality Report
Changes: 2 files changed, 41 insertions(+), 1 deletion(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline