Skip to content

fix(s2n-quic-transport): close all streams after Endpoint drop (#3170) - #3171

Open
SanjoDeundiak wants to merge 1 commit into
aws:mainfrom
SanjoDeundiak:sanjo/drop_connections
Open

fix(s2n-quic-transport): close all streams after Endpoint drop (#3170)#3171
SanjoDeundiak wants to merge 1 commit into
aws:mainfrom
SanjoDeundiak:sanjo/drop_connections

Conversation

@SanjoDeundiak

Copy link
Copy Markdown

Release Summary:

Close all streams after Endpoint drop

Resolved issues:

#3170

Description of changes:

Currently, after dropping the Endpoint the following is observed:

  • tx operations succeed
  • rx operations never return from an .await

This is concerning because Endpoint drop can happen particularly
due to IO implementation returning an error, which makes the current
behaviour unexpected and hard to handle.

The expected behaviour is:

  • tx operations return an error
  • rx operations return an error

To achieve this behaviour I suggest closing all streams on Endpoint drop

Testing:

I added tests and made sure they do not pass before the change and pass after the change

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@SanjoDeundiak
SanjoDeundiak requested a review from a team as a code owner July 24, 2026 23:00
@SanjoDeundiak
SanjoDeundiak force-pushed the sanjo/drop_connections branch from 4c486a6 to d57ae59 Compare July 24, 2026 23:01
Comment thread quic/s2n-quic-transport/src/connection/connection_container.rs Outdated
use smallvec::SmallVec;

// There is no list with error codes, so let's use a value we like
const ENDPOINT_DROPPED_ERROR_CODE: VarInt = VarInt::from_u8(42);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think this is the right decision. Choosing a random error code sounds wrong in this scenario. I think it would be better if we can close the stream with a proper existing error code. I think you should look into connection::Error and find an appropriate one.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I agree that this error would be more appropriate, however application_close expects application::Error error type, so public API should change to make that happen. I chose to change the type to connection::Error for the application_close argument, since it's converted to that type anyways, but let me know if you have something different in mind

Comment thread quic/s2n-quic-tests/src/tests.rs Outdated
Comment thread quic/s2n-quic-tests/src/tests/issue_3170.rs Outdated
)

Currently, after dropping the Endpoint the following is observed:
 - tx operations succeed
 - rx operations never return from an .await

 This is concerning because Endpoint drop can happen particularly
 due to IO implementation returning an error, which makes the current
 behaviour unexpected and hard to handle.

 The expected behaviour is:
  - tx operations return an error
  - rx operations return an error
@SanjoDeundiak
SanjoDeundiak force-pushed the sanjo/drop_connections branch from d57ae59 to 8f63263 Compare August 7, 2026 19:18
@SanjoDeundiak

Copy link
Copy Markdown
Author

@boquan-fang thanks for the review! Could you please take another look?

@boquan-fang

Copy link
Copy Markdown
Contributor

Hi @SanjoDeundiak, Thanks for contributing! I will give your PR another review later on. In the meanwhile, can you work to fix those errors that this PR caused on the CI? Thanks!

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.

2 participants