gh-145030: Fix asyncio write pipe transport for named FIFOs on macOS#154222
Open
bhuvi27 wants to merge 3 commits into
Open
gh-145030: Fix asyncio write pipe transport for named FIFOs on macOS#154222bhuvi27 wants to merge 3 commits into
bhuvi27 wants to merge 3 commits into
Conversation
…macOS On macOS the write end of a named FIFO polls as readable whenever unread data sits in the FIFO, so the reader trick used to detect the peer closing misfired and closed the transport. The trick also cannot detect a genuine hangup there: closing the read end delivers no event and kqueue's EV_EOF tracks writers, not readers. Skip registering the reader for named FIFOs on macOS, like the existing AIX carve-out; a closed peer is still detected on the next write via EPIPE. Anonymous os.pipe() pipes (st_nlink == 0) keep the current behaviour.
bhuvi27
requested review from
1st1,
asvetlov,
kumaraditya303 and
willingc
as code owners
July 20, 2026 07:09
sys.platform is "ios" (etc.) on Apple mobile, not "darwin", so the named-FIFO carve-out never applied there and the new regression test failed on the iOS CI job. Match all Apple platforms.
Rename the carve-out variable and wording back to macOS; keep the platform set covering ios/tvos/watchos so the same xnu FIFO behaviour is handled there.
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.
Fixes #145030
On macOS, the write end of a named FIFO polls as readable whenever unread data sits in the FIFO (the kernel does not check the fd's access mode,unlike Linux), so the "reader trick" _UnixWritePipeTransport uses to detect
the peer closing misfired and closed the transport, making the next drain() raise ConnectionResetError. The trick also cannot detect a genuine hangup for named FIFOs on macOS: closing the read end produces no event, and
kqueue's EV_EOF tracks writers rather than readers.
Skip registering the reader for named FIFOs on macOS, matching the existing AIX carve-out; a closed peer is still detected on the next write via EPIPE. Anonymous os.pipe() pipes are unaffected (st_nlink == 0) and keep the
current behaviour. Adds a regression test that keeps unread data in a FIFO while iterating the loop, which fails without the fix on macOS.