Skip to content

Fix race in RST_STREAM_IncompleteRequest_AdditionalResetFrame test#65715

Merged
lewing merged 2 commits intomainfrom
fix-rst-stream-reset-frame-race
Mar 10, 2026
Merged

Fix race in RST_STREAM_IncompleteRequest_AdditionalResetFrame test#65715
lewing merged 2 commits intomainfrom
fix-rst-stream-reset-frame-race

Conversation

@lewing
Copy link
Copy Markdown
Member

@lewing lewing commented Mar 9, 2026

Summary

Fix race condition in RST_STREAM_IncompleteRequest_AdditionalResetFrame_IgnoreAdditionalReset test.

Problem

tcs.TrySetResult() was called before StopConnectionAsync, 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.

Example failure from PR #65713 CI:

Assert.Equal() Failure: Values differ
Expected: GOAWAY
Actual:   HEADERS

Fix

Move tcs.TrySetResult() after StopConnectionAsync so the response handler stays blocked until the connection has stopped and the GOAWAY frame has been sent and verified.

This is the same fix pattern applied in:

This was the last remaining test in the RST_STREAM_IncompleteRequest family with this race.

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 lewing requested a review from halter73 as a code owner March 9, 2026 21:51
Copilot AI review requested due to automatic review settings March 9, 2026 21:51
@lewing lewing added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Mar 9, 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

Adjusts an HTTP/2 functional test in Kestrel to eliminate a race where the request delegate could complete early and emit response HEADERS before the test observes the expected GOAWAY frame.

Changes:

  • Move tcs.TrySetResult() to after StopConnectionAsync(...) in RST_STREAM_IncompleteRequest_AdditionalResetFrame_IgnoreAdditionalReset to keep the request handler blocked until the connection stop/GOAWAY is observed.

@lewing
Copy link
Copy Markdown
Member Author

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)

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>
@lewing lewing merged commit cb2bd84 into main Mar 10, 2026
25 checks passed
@lewing lewing deleted the fix-rst-stream-reset-frame-race branch March 10, 2026 15:23
@dotnet-policy-service dotnet-policy-service bot added this to the 11.0-preview3 milestone Mar 10, 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.

4 participants