Skip to content

Conversation

@Lukasa
Copy link
Contributor

@Lukasa Lukasa commented Oct 14, 2025

Motivation

In rare cases where the inbound side of a pipe channel is already closed (either because it was never open or because it was closed during use), we can get into trouble if the reader drops the read side of our write pipe. In that context, the Linux kernel will deliver an EPOLLHUP, but while we'll close the FD we'll let the channel hang out as a zombie. This is, obviously, suboptimal.

Modifications

In writeEOF, we check whether the read side is already closed. If it is, we trigger a close internally to shut the channel down. Added a test for this as needed, and modified an existing test that would now trip over this behaviour. Also added a new test for the reverse case to ensure we don't end up with zombies there (we don't).

Results

No zombie channels.

Motivation

In rare cases where the inbound side of a pipe channel is already
closed (either because it was never open or because it was closed
during use), we can get into trouble if the reader drops the
read side of our write pipe. In that context, the Linux kernel
will deliver an EPOLLHUP, but while we'll close the FD we'll let
the channel hang out as a zombie. This is, obviously, suboptimal.

Modifications

In writeEOF, we check whether the read side is already closed. If
it is, we trigger a close internally to shut the channel down.
Added a test for this as needed, and modified an existing test
that would now trip over this behaviour. Also added a new test
for the reverse case to ensure we don't end up with zombies
there (we don't).

Results

No zombie channels.
@Lukasa Lukasa merged commit cdf721f into apple:main Oct 15, 2025
58 of 63 checks passed
@Lukasa Lukasa deleted the cb-fix-zombie-pipe-channels branch October 15, 2025 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Having a channel receive writeEOF makes it become a zombie channel -- writes don't fail, channel doesn't close

2 participants