Skip to content

Fix race in RST_STREAM_IncompleteRequest HTTP/2 tests#65454

Merged
adityamandaleeka merged 1 commit intodotnet:mainfrom
adityamandaleeka:fix_h2race
Feb 18, 2026
Merged

Fix race in RST_STREAM_IncompleteRequest HTTP/2 tests#65454
adityamandaleeka merged 1 commit intodotnet:mainfrom
adityamandaleeka:fix_h2race

Conversation

@adityamandaleeka
Copy link
Copy Markdown
Member

Summary

Fix race condition in RST_STREAM_IncompleteRequest_AdditionalDataFrames_ConnectionAborted and RST_STREAM_IncompleteRequest_AdditionalTrailerFrames_ConnectionAborted tests.

Problem

tcs.TrySetResult() was called before WaitForConnectionErrorAsync, allowing the request handler to complete and write response HEADERS into the output pipe before the GOAWAY frame. Since ignoreNonGoAwayFrames: false, the test fails when it reads HEADERS instead of GOAWAY.

Fix

Move tcs.TrySetResult() after WaitForConnectionErrorAsync so the response handler stays blocked until the GOAWAY has been sent and verified. This is the same fix pattern applied in #57450 for the analogous AdditionalWindowUpdateFrame test.

Move tcs.TrySetResult() after WaitForConnectionErrorAsync to prevent
the response HEADERS from racing with the GOAWAY frame. Same fix
pattern as dotnet#57450 applied to AdditionalDataFrames and
AdditionalTrailerFrames variants.
Copilot AI review requested due to automatic review settings February 17, 2026 21:51
@github-actions github-actions Bot added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Feb 17, 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

This PR fixes a race condition in two HTTP/2 test methods where response headers could be written before the GOAWAY frame, causing test failures. The fix moves tcs.TrySetResult() to occur after WaitForConnectionErrorAsync, ensuring the response handler remains blocked until the connection error has been properly validated.

Changes:

  • Move tcs.TrySetResult() after WaitForConnectionErrorAsync in RST_STREAM_IncompleteRequest_AdditionalDataFrames_ConnectionAborted
  • Move tcs.TrySetResult() after WaitForConnectionErrorAsync in RST_STREAM_IncompleteRequest_AdditionalTrailerFrames_ConnectionAborted
  • Add clarifying comments explaining the timing requirement

@adityamandaleeka adityamandaleeka merged commit 637a267 into dotnet:main Feb 18, 2026
33 checks passed
@dotnet-policy-service dotnet-policy-service Bot added this to the 11.0-preview2 milestone Feb 18, 2026
@wtgodbe wtgodbe modified the milestones: 11.0-preview2, 11.0-preview3 Feb 27, 2026
lewing added a commit that referenced this pull request Mar 9, 2026
Move tcs.TrySetResult() after StopConnectionAsync so the response
handler stays blocked until the connection has stopped. This prevents
response HEADERS from being written before the GOAWAY frame, which
caused the test to intermittently fail with 'Expected: GOAWAY,
Actual: HEADERS'.

This is the same fix pattern applied in #65454 for the sibling
AdditionalDataFrames and AdditionalTrailerFrames tests, and in #57450
for the AdditionalWindowUpdateFrame test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lewing
Copy link
Copy Markdown
Member

lewing commented Mar 9, 2026

/backport to release/10.0

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 9, 2026

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

github-actions Bot pushed a commit that referenced this pull request Mar 9, 2026
Move tcs.TrySetResult() after StopConnectionAsync so the response
handler stays blocked until the connection has stopped. This prevents
response HEADERS from being written before the GOAWAY frame, which
caused the test to intermittently fail with 'Expected: GOAWAY,
Actual: HEADERS'.

This is the same fix pattern applied in #65454 for the sibling
AdditionalDataFrames and AdditionalTrailerFrames tests, and in #57450
for the AdditionalWindowUpdateFrame test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
lewing added a commit that referenced this pull request Mar 10, 2026
…65715)

* Fix race in RST_STREAM_IncompleteRequest_AdditionalResetFrame test

Move tcs.TrySetResult() after StopConnectionAsync so the response
handler stays blocked until the connection has stopped. This prevents
response HEADERS from being written before the GOAWAY frame, which
caused the test to intermittently fail with 'Expected: GOAWAY,
Actual: HEADERS'.

This is the same fix pattern applied in #65454 for the sibling
AdditionalDataFrames and AdditionalTrailerFrames tests, and in #57450
for the AdditionalWindowUpdateFrame test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix RST_STREAM additional reset test ordering

Wait for the request to be aborted before releasing the application delegate gate in RST_STREAM_IncompleteRequest_AdditionalResetFrame_IgnoreAdditionalReset. This preserves the test intent while avoiding both the HEADERS-vs-GOAWAY race and the shutdown timeout.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
wtgodbe pushed a commit that referenced this pull request Mar 10, 2026
…etFrame test (#65718)

* Fix race in RST_STREAM_IncompleteRequest_AdditionalResetFrame test

Move tcs.TrySetResult() after StopConnectionAsync so the response
handler stays blocked until the connection has stopped. This prevents
response HEADERS from being written before the GOAWAY frame, which
caused the test to intermittently fail with 'Expected: GOAWAY,
Actual: HEADERS'.

This is the same fix pattern applied in #65454 for the sibling
AdditionalDataFrames and AdditionalTrailerFrames tests, and in #57450
for the AdditionalWindowUpdateFrame test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix RST_STREAM additional reset test ordering

Wait for the request to be aborted before releasing the application delegate gate in RST_STREAM_IncompleteRequest_AdditionalResetFrame_IgnoreAdditionalReset. This preserves the test intent while avoiding both the HEADERS-vs-GOAWAY race and the shutdown timeout.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Larry Ewing <lewing@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
lewing added a commit that referenced this pull request Mar 16, 2026
…ersion pinning (#65781)

* Fix race in RST_STREAM_IncompleteRequest_AdditionalResetFrame test

Move tcs.TrySetResult() after StopConnectionAsync so the response
handler stays blocked until the connection has stopped. This prevents
response HEADERS from being written before the GOAWAY frame, which
caused the test to intermittently fail with 'Expected: GOAWAY,
Actual: HEADERS'.

This is the same fix pattern applied in #65454 for the sibling
AdditionalDataFrames and AdditionalTrailerFrames tests, and in #57450
for the AdditionalWindowUpdateFrame test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix RST_STREAM additional reset test ordering

Wait for the request to be aborted before releasing the application delegate gate in RST_STREAM_IncompleteRequest_AdditionalResetFrame_IgnoreAdditionalReset. This preserves the test intent while avoiding both the HEADERS-vs-GOAWAY race and the shutdown timeout.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix Blazor WASM template tests NU1603 with DevServer version pinning

Pin the DevServer package to the exact locally-built version in the
template test infrastructure so that stable versions from darc feeds
(which outrank prerelease versions in SemVer) don't cause NU1603.

With TreatWarningsAsErrors enabled, NU1603 becomes fatal, breaking
BlazorWasmStandaloneTemplate_Works and related tests whenever a VMR
official build publishes a stable DevServer to a darc feed.

The fix pipes MicrosoftAspNetCoreComponentsWebAssemblyDevServerVersion
through PrepareForTest.targets into Directory.Build.props.in, which
adds a PackageReference Update with an exact version range [x.y.z-ci].
This ensures the locally-built package is always used during tests.
The shipped template continues using >= semantics for customers.

Fixes #65701

* Move PackageReference Update to .targets.in (imported after project)

PackageReference Update in Directory.Build.props runs before the
project file, so it cannot affect items declared in the project.
Move to Directory.Build.targets.in which is imported after, and
pipe the version variable to the targets template instead.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants