Skip to content

Commit 3130ccb

Browse files
authored
Increase KestrelServerLimits.KeepAliveTimeout to 130 seconds (#32636)
* Increase KestrelServerLimits.KeepAliveTimeout to 130 seconds * Fix KeepAliveTimeoutDefault test
1 parent db4ef86 commit 3130ccb

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/Servers/Kestrel/Core/src/KestrelServerLimits.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ public class KestrelServerLimits
3333
// Matches the default LimitRequestFields in Apache httpd.
3434
private int _maxRequestHeaderCount = 100;
3535

36-
// Matches the default http.sys connectionTimeout.
37-
private TimeSpan _keepAliveTimeout = TimeSpan.FromMinutes(2);
36+
// Slightly more than SocketHttpHandler's old PooledConnectionIdleTimeout of 2 minutes.
37+
// https://github.com/dotnet/runtime/issues/52267
38+
private TimeSpan _keepAliveTimeout = TimeSpan.FromSeconds(130);
3839

3940
private TimeSpan _requestHeadersTimeout = TimeSpan.FromSeconds(30);
4041

@@ -169,7 +170,7 @@ public long? MaxRequestBodySize
169170

170171
/// <summary>
171172
/// Gets or sets the keep-alive timeout.
172-
/// Defaults to 2 minutes.
173+
/// Defaults to 130 seconds.
173174
/// </summary>
174175
/// <remarks>
175176
/// </remarks>

src/Servers/Kestrel/Core/test/KestrelServerLimitsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public void MaxRequestHeaderCountValid(int value)
150150
[Fact]
151151
public void KeepAliveTimeoutDefault()
152152
{
153-
Assert.Equal(TimeSpan.FromMinutes(2), new KestrelServerLimits().KeepAliveTimeout);
153+
Assert.Equal(TimeSpan.FromSeconds(130), new KestrelServerLimits().KeepAliveTimeout);
154154
}
155155

156156
[Theory]

0 commit comments

Comments
 (0)