Skip to content

Fix HTTP/2 response write timing after flow-control waits - #70298

Open
hoyosjs wants to merge 1 commit into
dotnet:mainfrom
hoyosjs:fix-http2-response-write-timing
Open

hoyosjs wants to merge 1 commit into
dotnet:mainfrom
hoyosjs:fix-http2-response-write-timing

Conversation

@hoyosjs

@hoyosjs hoyosjs commented Nov 4, 2026

Copy link
Copy Markdown
Member

Fix HTTP/2 response write timing after flow-control waits

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • There's an open issue for the PR that you are making. If you'd like to propose a new feature or change, please open an issue to discuss the change or find an existing issue.

Reset HTTP/2 write timing after flow-control waits.

Description

Clear IsTimingWrite after StopTimingWrite() so subsequent writes cannot decrement the counter again and suppress MinResponseDataRate timeouts.

Adds a regression test for resumed writes followed by another flow-control stall. It fails before the fix and passes afterward. All 24 HTTP/2 timeout tests pass.

Fixes #70297

Copilot AI balanced review requested due to automatic review settings November 4, 2026 09:58
@github-actions github-actions Bot added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Nov 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The test has a race where WINDOW_UPDATE can be processed before the first StartTimingWrite(), skipping a callback and causing secondWriteBlocked to time out even with the fix.

1 open issue
What changed in this PR

Fixes Kestrel’s HTTP/2 response-write timing bookkeeping so repeated writes after a flow-control wait do not suppress MinResponseDataRate timeouts, addressing #70297.

Changes:

  • Clears IsTimingWrite after stopping write timing.
  • Adds regression coverage for resumed writes followed by another flow-control stall and timeout.
File Description
src/​Servers/​Kestrel/​test/​InMemory.FunctionalTests/​Http2/​Http2TimeoutTests.cs Adds a regression test for timeout enforcement after flow control resumes.
src/​Servers/​Kestrel/​Core/​src/​Internal/​Http2/​Http2FrameWriter.cs Resets the timing flag to prevent repeated timing-counter decrements.

Review effort: Balanced

withFlags: (byte)Http2DataFrameFlags.NONE,
withStreamId: 1);

await SendWindowUpdateAsync(1, 100);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hoyosjs The AI comment seems probable.

@PureWeen

PureWeen commented Nov 6, 2026

Copy link
Copy Markdown
Member

/review

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime.
To make sure no conflicting changes have occurred, please rerun validation before merging. You can do this by leaving an /azp run comment here (requires commit rights), or by simply closing and reopening.

@dotnet-policy-service dotnet-policy-service Bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Nov 17, 2026

This branch has not been deployed

No deployments
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 pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTP/2 response write timing counter can become negative and suppress MinResponseDataRate timeouts

4 participants