Skip to content

Correctly cleanup HTTP/2 connection channel#88

Merged
aryan-25 merged 7 commits into
swift-server:mainfrom
aryan-25:close-http2-connections-upon-cancellation
Jun 18, 2026
Merged

Correctly cleanup HTTP/2 connection channel#88
aryan-25 merged 7 commits into
swift-server:mainfrom
aryan-25:close-http2-connections-upon-cancellation

Conversation

@aryan-25

Copy link
Copy Markdown
Collaborator

Motivation:

The inbound HTTP/2 stream iterator can exit when the server task is cancelled, or when the stream multiplexer finishes or throws. However, when this happens, we currently do not close the connection channel. We should fix this.

Modifications:

  • Updated the serveHTTP2Connection method to also close the connection channel when the inbound stream iteration exits.
  • Added a regression test that checks the connection channel is closed when the server task is cancelled during an active connection. This test indefinitely stalls before this patch.

Result:

Active HTTP/2 connections are now cleaned up correctly when the inbound stream iteration exits.

@aryan-25 aryan-25 added the 🔨 semver/patch No public API change. label Jun 11, 2026
@aryan-25 aryan-25 requested a review from gjcairo June 17, 2026 16:20
@aryan-25 aryan-25 merged commit 173c655 into swift-server:main Jun 18, 2026
18 of 22 checks passed
@aryan-25 aryan-25 deleted the close-http2-connections-upon-cancellation branch June 18, 2026 23:31
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.

2 participants