Skip to content

Commit b81fac2

Browse files
authored
Reduce DefaultPooledConnectionIdleTimeout default (#52687)
* Reduce DefaultPooledConnectionIdleTimeout default - Change DefaultPooledConnectionIdleTimeout from 120 seconds to 60 seconds - This should reduce the occurrence of socket errors when connected to IIS or Kestrel
1 parent 57bdb95 commit b81fac2

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/libraries/Common/src/System/Net/Http/HttpHandlerDefaults.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ internal static partial class HttpHandlerDefaults
2525
public const bool DefaultUseDefaultCredentials = false;
2626
public const bool DefaultCheckCertificateRevocationList = false;
2727
public static readonly TimeSpan DefaultPooledConnectionLifetime = Timeout.InfiniteTimeSpan;
28-
public static readonly TimeSpan DefaultPooledConnectionIdleTimeout = TimeSpan.FromMinutes(2);
28+
public static readonly TimeSpan DefaultPooledConnectionIdleTimeout = TimeSpan.FromMinutes(1);
2929
public static readonly TimeSpan DefaultExpect100ContinueTimeout = TimeSpan.FromSeconds(1);
3030
public static readonly TimeSpan DefaultConnectTimeout = Timeout.InfiniteTimeSpan;
3131
}

src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,7 +1774,7 @@ public void PooledConnectionIdleTimeout_GetSet_Roundtrips()
17741774
{
17751775
using (var handler = new SocketsHttpHandler())
17761776
{
1777-
Assert.Equal(TimeSpan.FromMinutes(2), handler.PooledConnectionIdleTimeout);
1777+
Assert.Equal(TimeSpan.FromMinutes(1), handler.PooledConnectionIdleTimeout);
17781778

17791779
handler.PooledConnectionIdleTimeout = Timeout.InfiniteTimeSpan;
17801780
Assert.Equal(Timeout.InfiniteTimeSpan, handler.PooledConnectionIdleTimeout);
@@ -1957,7 +1957,7 @@ await Assert.ThrowsAnyAsync<Exception>(() =>
19571957
Assert.Equal(int.MaxValue, handler.MaxConnectionsPerServer);
19581958
Assert.Equal(64, handler.MaxResponseHeadersLength);
19591959
Assert.False(handler.PreAuthenticate);
1960-
Assert.Equal(TimeSpan.FromMinutes(2), handler.PooledConnectionIdleTimeout);
1960+
Assert.Equal(TimeSpan.FromMinutes(1), handler.PooledConnectionIdleTimeout);
19611961
Assert.Equal(Timeout.InfiniteTimeSpan, handler.PooledConnectionLifetime);
19621962
Assert.NotNull(handler.Properties);
19631963
Assert.Null(handler.Proxy);

0 commit comments

Comments
 (0)