Skip to content

[QUIC] Do not allocate exception if it might not be used#127526

Open
ManickaP wants to merge 1 commit intodotnet:mainfrom
ManickaP:quic-exception-alloc
Open

[QUIC] Do not allocate exception if it might not be used#127526
ManickaP wants to merge 1 commit intodotnet:mainfrom
ManickaP:quic-exception-alloc

Conversation

@ManickaP
Copy link
Copy Markdown
Member

Fixes #127455
Validation manual on the repro code, before:
before
after (no more QuicException):
after

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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

@ManickaP ManickaP requested a review from a team April 28, 2026 19:03
@MihaZupan MihaZupan added this to the 11.0.0 milestone Apr 28, 2026
Copy link
Copy Markdown
Contributor

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

Reduces avoidable allocations on the QUIC stream shutdown path by preventing creation of an OperationAborted QuicException when it cannot be observed (because the stream start task source is already completed). This aligns with the perf investigation in #127455 and targets the high-frequency shutdown event path for HTTP/3 server scenarios.

Changes:

  • Guard _startedTcs.TrySetException(ThrowHelper.GetOperationAbortedException()) behind _startedTcs.IsCompleted to avoid allocating an exception that would be ignored.
  • Preserve existing shutdown completion semantics while reducing handled exception churn.

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.

Too many (handled?) QuicException instances on HTTP/3 server side

5 participants