Skip to content

Conversation

@Lukasa
Copy link
Collaborator

@Lukasa Lukasa commented Jun 17, 2022

Motivation

If we receive an early HTTP response, the last action on a HTTP/1.1
connection is to send the .end message. While we had an error handling
path in the code, it wasn't tested, and when executed it would end up
leaking the connection by failing to close it or return it to the
pool.

This patch fixes the issue by appropriately terminating the connection
and adding a test.

Modifications

Add a test
Terminate the connection if sendEnd fails

Result

Fewer connection leaks

Motivation

If we receive an early HTTP response, the last action on a HTTP/1.1
connection is to send the .end message. While we had an error handling
path in the code, it wasn't tested, and when executed it would end up
leaking the connection by failing to close it _or_ return it to the
pool.

This patch fixes the issue by appropriately terminating the connection
and adding a test.

Modifications

Add a test
Terminate the connection if sendEnd fails

Result

Fewer connection leaks
@Lukasa Lukasa added the 🔨 semver/patch No public API change. label Jun 17, 2022
@Lukasa Lukasa requested review from dnadoba and glbrntt June 17, 2022 11:28
Copy link
Member

@fabianfett fabianfett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great fix. Thanks @Lukasa 🙏

@Lukasa Lukasa merged commit 9a8553e into swift-server:main Jun 17, 2022
@Lukasa Lukasa deleted the cb-close-on-send-end-failure branch June 17, 2022 16:09
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.

3 participants