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

2 participants