Skip to content

forwarder: close backend channel immediately if frontend closes - #2260

Merged
dkovba merged 1 commit into
apple:mainfrom
egernst:topic/forwarder-cleanup
Sep 11, 2026
Merged

forwarder: close backend channel immediately if frontend closes#2260
dkovba merged 1 commit into
apple:mainfrom
egernst:topic/forwarder-cleanup

Conversation

@egernst

@egernst egernst commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

When a peer closes their connection while we're establishing the backend connection, we must close the backend channel to release its file descriptors immediately. Previously, the code closed the peer channel (already closed anyway), leaving the backend channel orphaned until garbage collection.

Now we explicitly close the backend channel when the peer channel is no longer active, preventing delayed FD cleanup.

Fixes: #2261

Important

All commits must be signed and verified. Pull requests containing unsigned or unverified commits cannot be built or merged. See the GitHub documentation for instructions.

For all but trivial fixes, make sure to first create a GitHub issue that concisely describes the bug or desired enhancement as justification for the change. Large PRs with no justifying issue will be closed.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

[Why is this change needed?]

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

When a peer closes their connection while we're establishing the
backend connection, we must close the backend channel to release its
file descriptors immediately. Previously, the code closed the peer
channel (already closed anyway), leaving the backend channel orphaned
until garbage collection.

Now we explicitly close the backend channel when the peer channel is
no longer active, preventing delayed FD cleanup.

Fixes: apple#2261

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
@egernst
egernst force-pushed the topic/forwarder-cleanup branch from 8dfe10f to 56b95bc Compare September 11, 2026 15:53
@egernst
egernst requested a review from dkovba September 11, 2026 15:54
@github-actions

github-actions Bot commented Sep 11, 2026

Copy link
Copy Markdown

Code Coverage

Tier Line Coverage
Unit 24.78%
Integration 66.67%
Combined 76.07%

@dkovba
dkovba merged commit 33ebc8a into apple:main Sep 11, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: forwarder: File descriptors not released immediately when peer disconnects

2 participants