Skip to content

[HTTP/3] Handle all QUIC exceptions in H/3 stream #116851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 20, 2025

Conversation

ManickaP
Copy link
Member

Fixes #116845

@Copilot Copilot AI review requested due to automatic review settings June 20, 2025 09:55
Copy link
Contributor

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@ManickaP
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ManickaP ManickaP requested a review from a team June 20, 2025 09:57
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances HTTP/3 error handling by catching all QUIC transport exceptions and surfacing them as HttpRequestException to clients.

  • Added a functional test to verify that client observes a propagated QUIC error when the server aborts the connection.
  • Introduced a catch (QuicException) block in Http3RequestStream to abort the connection and throw a specific HttpRequestException.
  • Added a new resource string net_http_http3_connection_quic_error for QUIC transport failures.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http3.cs New test ServerKillsQuicConnection_ClientPropagatesException for QUIC exception propagation
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http3RequestStream.cs Catch QuicException, abort connection, and throw HttpRequestException
src/libraries/System.Net.Http/src/Resources/Strings.resx Added net_http_http3_connection_quic_error resource string
Comments suppressed due to low confidence (1)

src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http3RequestStream.cs:326

  • Using HttpRequestError.Unknown is generic for QUIC transport failures. Consider defining and using a more specific enum value (e.g., QuicTransportError) so consumers can distinguish QUIC errors from other failures.
                throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_http3_connection_quic_error, ex);

{
// Any other QuicException means transport error, and should be treated as a connection failure.
_connection.Abort(ex);
throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_http3_connection_quic_error, ex);
Copy link
Member

Choose a reason for hiding this comment

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

If this is a transport error, shouldn't we use HttpRequestError.ConnectionError instead? Moreover, are we sure we don't have an ApplicationErrorCode here?

Copy link
Member Author

Choose a reason for hiding this comment

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

shouldn't we use HttpRequestError.ConnectionError instead?

I didn't use ConnectionError because of this in the docs:

while connecting to the remote endpoint

But I'm not oppose to using it and maybe tweaking the docs to not to be exclusive to connection establishment.


Moreover, are we sure we don't have an ApplicationErrorCode here?

Yes, it's present only in case of ConnectionAborted / StreamAborted, which are handled above. The application code has to be explicitly sent by the peer, which is specified by QUIC RFC, so there's no chance we would have it in any other cases (meaning QuicError).

Copy link
Member

Choose a reason for hiding this comment

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

Ok, all makes sense now, I'm good with the current handling then.

maybe tweaking the docs

This leads too far, e.g. it should be then used in other cases or maybe we should rather consider adding a new enum member.

@ManickaP
Copy link
Member Author

@ManickaP ManickaP merged commit cd1eb06 into dotnet:main Jun 20, 2025
81 of 95 checks passed
@ManickaP ManickaP deleted the quic-assert branch June 20, 2025 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failed QUIC assert in CI
2 participants