Skip to content

Preserve original failures in HTTP metrics and QUIC test diagnostics - #137472

Merged
akoeplinger merged 5 commits into
mainfrom
akoeplinger-networking-test-diagnostics
Nov 24, 2026
Merged

akoeplinger merged 5 commits into
mainfrom
akoeplinger-networking-test-diagnostics

Conversation

@akoeplinger

@akoeplinger akoeplinger commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Preserve original failures in networking tests uncovered while investigating #137416:

  • HTTP metrics: Enrichment runs from finally, including on failed requests where Response is legitimately null. Asserting inside the callback masks the original exception. Capture the response instead and assert Same after a successful send, keeping the original test flow.
  • QUIC diagnostics: MsQuicRemoteExecutorTests explicitly passes null as its output helper, so error-path logging can throw NullReferenceException and hide a connection failure. Make helper logging null-safe, but read serverTask.Exception independently so its fault remains observed even without logging.

Test-only changes: no product, MsQuic version, retry, or timeout changes. The underlying TLS/QUIC flakes remain unresolved.

Validation: The baseline build, 14 HTTP diagnostic-listener cases, and 6 focused QUIC cases passed on macOS ARM64 with locally built MsQuic 2.6.4/OpenSSL. Local cancellation and failed-handshake repros confirmed both masking bugs before the fixes; neither repro is in the final diff. Windows Schannel and full suites were not run.

Note

Generated with GitHub Copilot.

akoeplinger and others added 2 commits November 13, 2026 01:33
Add canceled-request metrics cases and preserve explicit successful-response checks. Add a deterministic QUIC connection-failure test with no output helper.

Co-authored-by: Copilot App <[email protected]>
Keep metrics callback assertions outside the request pipeline and tolerate absent test output in QUIC error paths. Observe completed server-task failures even when logging is unavailable.

Co-authored-by: Copilot App <[email protected]>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
11 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.

@ManickaP

Copy link
Copy Markdown
Member

Can you share the original errors and the new (properly preserved) errors?

I'm having hard time understanding the exact underlying problem from the description.

@akoeplinger

Copy link
Copy Markdown
Member Author

@ManickaP These failures came from build 1678292 while investigating #137416.

The goal is better diagnostics when these flaky tests fail, not to fix the underlying connection flakes. We haven’t reproduced those exact CI failures with the patch, so their original client-side exceptions remain unknown. This should let subsequent failures expose those exceptions rather than secondary assertion/logging failures.

HTTP metrics (original result):

System.AggregateException: One or more errors occurred.
(Assert.NotNull() Failure: Value is null)
(Authentication failed because the remote party sent a TLS alert: 'UserCanceled'.)

Xunit.Sdk.NotNullException: Assert.NotNull() Failure: Value is null
  ...MetricsTest.cs:line 561
  ...HttpMetricsEnrichmentContext.RecordDurationWithEnrichment
  ...MetricsHandler.RequestStop

The callback runs even when the request fails, when Response is legitimately null. Its assertion replaces the original client exception. The UserCanceled above is a separate server-side handshake exception—not the lost client exception.

QUIC (original result):

System.NullReferenceException: Object reference not set to an instance of an object.
  ...QuicTestBase.CreateConnectedQuicConnection(...) ...line 257
  ...MsQuicRemoteExecutorTests.<SslKeyLogFile_IsCreatedAndFilled>... ...line 45

Here the connection-failure cleanup dereferences a null output helper, replacing the connection exception before the key-log assertions run. The patch makes that logging null-safe.

Note

Drafted with GitHub Copilot.

@akoeplinger
akoeplinger requested a review from ManickaP November 19, 2026 09:40
@akoeplinger

Copy link
Copy Markdown
Member Author

/ba-g unrelated failures on iOS

@akoeplinger
akoeplinger merged commit a9ffa6f into main Nov 24, 2026
63 of 65 checks passed
@akoeplinger
akoeplinger deleted the akoeplinger-networking-test-diagnostics branch November 24, 2026 09:34
@lewing

lewing commented Nov 24, 2026

Copy link
Copy Markdown
Member

/backport to release/11.0

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0 (link to workflow run)

lewing pushed a commit that referenced this pull request Nov 24, 2026
…st diagnostics (#138213)

Backport of #137472 to release/11.0. Test-only; no product code changes.

/cc @lewing @akoeplinger

Captures the enrichment callback's response and asserts after the send
instead of inside the callback, and makes QUIC test helper logging
null-safe while still surfacing the server task's exception, so the
original test failures are no longer masked by secondary assertion
failures or NREs.

# Customer Impact
None; test-only.

# Regression
No.

# Testing
Clean cherry-pick of test-only changes; PR CI runs the tests.

# Risk
Low; test-only.

Co-authored-by: Alexander Köplinger <[email protected]>
Co-authored-by: Copilot App <[email protected]>
lewing added a commit that referenced this pull request Nov 24, 2026
…st diagnostics (#138216)

Backport of #137472 to release/10.0. Test-only; no product code changes.

The HTTP metrics test now captures the enrichment response and asserts
it after the send, instead of asserting inside the callback, which
masked the original exception on failed requests. QUIC test helpers now
log null-safely, because MsQuicRemoteExecutorTests passes a null output
helper and a NullReferenceException could hide connection failures.

# Customer Impact
None; test-only.

# Regression
No.

# Testing
Compiled System.Net.Http.Functional.Tests and
System.Net.Quic.Functional.Tests with SDK 10.0.115; PR CI runs the
tests.

# Risk
Low; test-only.

Co-authored-by: Copilot App <[email protected]>
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 25, 2026
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.

3 participants