Avoid unobserved ReadAheadTask exceptions in HttpConnection#80214
Avoid unobserved ReadAheadTask exceptions in HttpConnection#80214MihaZupan merged 6 commits intodotnet:mainfrom
Conversation
|
Tagging subscribers to this area: @dotnet/ncl Issue DetailsThis changes the To address #60729, we also issue the read-ahead once a connection becomes idle (gets returned to the pool with no remaining requests). If we don't want to do this it's a matter of deleting this.
|
c52af6a to
ab437e3
Compare
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs
Outdated
Show resolved
Hide resolved
ab437e3 to
47948da
Compare
|
Removed the proactive-EOF-reaction part of the PR now |
|
@stephentoub @ManickaP please take another look at this one when you get a chance, the change is smaller now. |
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs
Outdated
Show resolved
Hide resolved
| #pragma warning disable CA2012 // we're very careful to ensure the ValueTask is only consumed once, even though it's stored into a field | ||
| _readAheadTask ??= ReadAheadWithZeroByteReadAsync(); | ||
| #pragma warning restore CA2012 | ||
| EnsureReadAheadTaskHasStarted(); |
There was a problem hiding this comment.
Is it possible scavenges could end up overlapping such that two threads concurrently try to initialize the read-ahead? (Your PR wouldn't make that worse.)
There was a problem hiding this comment.
Shouldn't be as all the scavenging logic runs while holding the connection pool lock
Closes #61256
This change adds synchronization between the read-ahead task and SendAsync to avoid a scenario where we don't observe the task's exception.