diff options
author | Natalia Kondratyeva <knatalia@microsoft.com> | 2022-04-13 18:48:34 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-13 18:48:34 +0300 |
commit | 78ea073704d2594bbf5c35f5a5a0f1685da69d80 (patch) | |
tree | c4418050911c39a41af5d54d4bb151590e095334 /src | |
parent | 3b018d663e622444e2366b7cb65a569e4c4dd3d2 (diff) |
Add additional trace to HttpConnectionPool (#66958)
Diffstat (limited to 'src')
-rw-r--r-- | src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs index b5e9778ab54..3456e440faf 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs @@ -478,6 +478,13 @@ namespace System.Net.Http return; } + if (NetEventSource.Log.IsEnabled()) + { + Trace($"Available HTTP/1.1 connections: {_availableHttp11Connections.Count}, Requests in the queue: {_http11RequestQueue.Count}, " + + $"Pending HTTP/1.1 connections: {_pendingHttp11ConnectionCount}, Total associated HTTP/1.1 connections: {_associatedHttp11ConnectionCount}, " + + $"Max HTTP/1.1 connection limit: {_maxHttp11Connections}."); + } + // Determine if we can and should add a new connection to the pool. if (_availableHttp11Connections.Count == 0 && // No available connections _http11RequestQueue.Count > _pendingHttp11ConnectionCount && // More requests queued than pending connections @@ -852,8 +859,10 @@ namespace System.Net.Http { quicConnection = await ConnectHelper.ConnectQuicAsync(request, Settings._quicImplementationProvider ?? QuicImplementationProviders.Default, new DnsEndPoint(authority.IdnHost, authority.Port), _sslOptionsHttp3!, cancellationToken).ConfigureAwait(false); } - catch + catch (Exception e) { + if (NetEventSource.Log.IsEnabled()) Trace($"QUIC connection failed: {e}"); + // Disables HTTP/3 until server announces it can handle it via Alt-Svc. BlocklistAuthority(authority); throw; @@ -1575,7 +1584,7 @@ namespace System.Net.Http private void HandleHttp11ConnectionFailure(Exception e) { - if (NetEventSource.Log.IsEnabled()) Trace("HTTP/1.1 connection failed"); + if (NetEventSource.Log.IsEnabled()) Trace($"HTTP/1.1 connection failed: {e}"); lock (SyncObj) { @@ -1594,7 +1603,7 @@ namespace System.Net.Http private void HandleHttp2ConnectionFailure(Exception e) { - if (NetEventSource.Log.IsEnabled()) Trace("HTTP2 connection failed"); + if (NetEventSource.Log.IsEnabled()) Trace($"HTTP2 connection failed: {e}"); lock (SyncObj) { |