Open MihaZupan opened 1 year ago
Tagging subscribers to this area: @dotnet/ncl See info in area-owners.md if you want to be subscribed.
Author: | MihaZupan |
---|---|
Assignees: | - |
Labels: | `bug`, `area-System.Net.Http` |
Milestone: | - |
Triage: This should be easy to fix, moving to 8.0.
Judging by the code, we have the same issue with HTTP/3 as well.
We capture the ExecutionContext of the original request in these tasks inside Http3Connection
's ctor:
https://github.com/dotnet/runtime/blob/6ede02b93ce17925158486729be53cad34010c4f/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http3Connection.cs#L102-L106
As part of setting up the
Http2Connection
we spin up two background tasks for the read/write channel and in doing so we capture the execution context of the request that initiated the new connection.We should do the
SuppressFlow
/RestoreFlow
dance somewhere aroundHttp2Connection.SetupAsync
. This could also keep it alive.Repro (note that the finalizer doesn't run until you dispose the client):