Skip to content

Don't expire infinite Kestrel timeouts on the next heartbeat - #70035

Open
Souheyl7Gouadria wants to merge 2 commits into
dotnet:mainfrom
Souheyl7Gouadria:kestrel-infinite-timeout-overflow
Open

Souheyl7Gouadria wants to merge 2 commits into
dotnet:mainfrom
Souheyl7Gouadria:kestrel-infinite-timeout-overflow

Conversation

@Souheyl7Gouadria

Copy link
Copy Markdown
Contributor

Don't expire infinite Kestrel timeouts on the next heartbeat

Make Timeout.InfiniteTimeSpan actually disable KeepAliveTimeout and RequestHeadersTimeout.

Description

KestrelServerLimits stores an infinite timeout as TimeSpan.MaxValue, which ToTicks turns into long.MaxValue. TimeoutControl.AssignTimeout then adds the last timestamp and the heartbeat interval to it. The sum wraps negative and the timeout fires on the next heartbeat. So an idle connection with an infinite keep-alive closes after about a second, and incomplete headers with an infinite header timeout get a 408. HTTP/2 goes through the same code.

The expiration is now clamped to long.MaxValue on overflow, the same way Http3Connection already handles its stream timeouts.

Added a TimeoutControl test and functional tests for both limits.

Fixes #69692

Copilot AI balanced review requested due to automatic review settings October 24, 2026 17:19

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@github-actions github-actions Bot added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Oct 24, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Oct 24, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Thanks for your PR, @Souheyl7Gouadria. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@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 1, 2026

This branch was previously deployed

1 inactive (outdated) deployment
copilot-pat-pool — 1bb44c75 Deployed Oct 24, 2026 by dotnet-policy-service[bot] via pat_pool #1967
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 community-contribution Indicates that the PR has been added by a community member 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/1.1 infinite KeepAliveTimeout and RequestHeadersTimeout expire on the next heartbeat due to deadline overflow

2 participants