Skip to content

Fix QuicStream send buffer leak - #135591

Merged
ManickaP merged 2 commits into
dotnet:mainfrom
asad24-dev:fix-quic-send-buffer-leak
Oct 13, 2026
Merged

ManickaP merged 2 commits into
dotnet:mainfrom
asad24-dev:fix-quic-send-buffer-leak

Conversation

@asad24-dev

@asad24-dev asad24-dev commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Fix QuicStream send buffer leak

Fixes #135583

MsQuicBuffers is currently a struct. When _sendBuffers is assigned to
MsQuicContextSafeHandle.Disposable, the handle receives a boxed copy before
the first send allocates its native QUIC_BUFFER array. When the handle is
released, it disposes that stale copy rather than the live buffer owner.

Make MsQuicBuffers a sealed class so the stream and safe handle share the
same buffer owner. The existing safe-handle disposal path is unchanged: native
buffers are still released only when the stream handle is actually released.

Validation:

  • Regression reproduces the issue before the fix (Expected: 0, Actual: 1).
  • Regression passes with the fix (1 test, 0 failures).
  • System.Net.Quic product build passed with analyzers.

@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Oct 11, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@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.

@asad24-dev
asad24-dev force-pushed the fix-quic-send-buffer-leak branch from cefad4f to ff728b9 Compare October 11, 2026 15:46
@ManickaP ManickaP self-assigned this Oct 12, 2026
@ManickaP

Copy link
Copy Markdown
Member

Product code change looks OK. But we rarely use reflection for tests, so if you cannot come up with any other way to test this, I'd rather not introduce the test. Provided that you've validated this with your repro manually.

@asad24-dev
asad24-dev force-pushed the fix-quic-send-buffer-leak branch from ff728b9 to 0930869 Compare October 12, 2026 12:49
@asad24-dev

Copy link
Copy Markdown
Contributor Author

Thanks for the review! I've removed the reflection-based test from the PR.

I validated the fix using that test before removing it: the original implementation failed, while the fixed implementation passed both locally and in CI. The full System.Net.Quic.Functional.Tests suite also passed in CI with the test included.

The PR now contains only the two production changes.

@ManickaP
ManickaP merged commit cba3c1d into dotnet:main Oct 13, 2026
86 of 88 checks passed
WilliamSmithEdward added a commit to WilliamSmithEdward/embedio-neo that referenced this pull request Oct 13, 2026
.NET 10.0.13 (13 October 2026) is a security release with 44 CVEs,
including CVE-2026-105016, a remote code execution vulnerability in
Microsoft QUIC that MSRC rates Critical for .NET installed on Windows.
Runtime 10.0.13 bundles msquic.dll 2.5.11; 10.0.12 bundled 2.5.10. The
one-week cooldown is skipped for this release.

global.json and the workflows' dotnet-version pins move to SDK 10.0.402.
The MAUI workload set stays at 10.0.401: a workload set belongs to the
10.0.400 feature band, and none was published for 10.0.402.

The shipped dependency minimums move from 10.0.12 to 10.0.13:
System.Threading.RateLimiting (core), System.Text.Json (core .NET Standard
2.0 asset), and Microsoft.Extensions.DependencyInjection and
Microsoft.Extensions.Hosting.Abstractions (DI package). Every lock file is
regenerated with SDK 10.0.402, and each change is a 10.0.12 to 10.0.13
move, including the implicit Microsoft.NET.ILLink.Tasks and ILCompiler
references. The MAUI locks need the workload to regenerate, so they mirror
the same two entries with the hashes NuGet recorded in the core lock.
coverlet.MTP's Microsoft.Extensions.Configuration dependencies stay at the
10.0.12 it requests.

The test probes that pin an exact runtime (RuntimeCloseProbe,
AppContainerSmoke and the native dependency probe template) move to
10.0.13, so they exercise the runtime the repository now builds with.

The docs record what the release contains. The macOS accept fix for
dotnet/runtime#121848 (backport #133567) ships in 10.0.13; EmbedIO keeps
its IPv6 accept worker. The System.Net.Quic send-buffer fix
(dotnet/runtime#135591) is not in 10.0.13. CONTRIBUTING, SECURITY, the
MAUI validation guide and the changelog describe the new pins.
WilliamSmithEdward added a commit to WilliamSmithEdward/embedio-neo that referenced this pull request Oct 13, 2026
.NET 10.0.13 (13 October 2026) is a security release with 44 CVEs,
including CVE-2026-105016, a remote code execution vulnerability in
Microsoft QUIC that MSRC rates Critical for .NET installed on Windows.
Runtime 10.0.13 bundles msquic.dll 2.5.11; 10.0.12 bundled 2.5.10. The
one-week cooldown is skipped for this release.

global.json and the workflows' dotnet-version pins move to SDK 10.0.402.
The MAUI workload set stays at 10.0.401, a set of the 10.0.400 feature
band, so the MAUI apps keep the 10.0.12 Mono runtime. Workload set 10.0.402
carries 10.0.13 but moves the Apple packs to the Xcode 27.0 release; that
move is a separate change.

The shipped dependency minimums move from 10.0.12 to 10.0.13:
System.Threading.RateLimiting (core), System.Text.Json (core .NET Standard
2.0 asset), and Microsoft.Extensions.DependencyInjection and
Microsoft.Extensions.Hosting.Abstractions (DI package). Every lock file is
regenerated with SDK 10.0.402. Each resolved version change is 10.0.12 to
10.0.13, including the implicit Microsoft.NET.ILLink.Tasks and ILCompiler
references; the dependency-free HttpsCertificates lock also moves from
format version 1 to 2. The MAUI locks need the workload to regenerate, so
they mirror the same two entries with the hashes NuGet recorded in the core
lock. coverlet.MTP's Microsoft.Extensions.Configuration dependencies stay
at the 10.0.12 it requests.

The test probes that pin an exact runtime (RuntimeCloseProbe,
AppContainerSmoke and the native dependency probe template) move to
10.0.13, so they exercise the runtime the repository now builds with.

The docs record what the release contains. The macOS accept fix for
dotnet/runtime#121848 (backport dotnet/runtime#133567) ships in
10.0.13; EmbedIO keeps its IPv6 accept worker. The System.Net.Quic
send-buffer fix (dotnet/runtime#135591) is not in 10.0.13. CONTRIBUTING,
SECURITY, the MAUI validation guide and the changelog describe the new
pins.
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 14, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Net.Quic community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QuicStream leaks its native QUIC_BUFFER array for every stream that sends data

3 participants