Disposal of HttpClient instances in OidcClient #273
-
I'm using the Duende.IdentityModel.OidcClient v6.0.1 package in a solution I'm working on and have seen some issues on my local machine that would indicate http socket exhaustion when executing the solution. After reading the stack traces and looking through the code, I noticed that instaces of HttpClient created within OidcClient and also AuthorizeClient are not being disposed after use. Is this something I can push a PR for? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Do you happen to have a repo we can look at to reproduce the exhaustion issue locally? In the mean time, there is a way you can configure the While we would welcome a PR, HttpClient has been known to cause a variety of issues related to lifetime management. In general, our advice to solve this is to configure a custom HttpClientFactory as mentioned earlier. |
Beta Was this translation helpful? Give feedback.
Do you happen to have a repo we can look at to reproduce the exhaustion issue locally?
In the mean time, there is a way you can configure the
OidcClientOptions
to use a customHttpClientFactory
expression to share anHttpClient
instance, which is probably fine in most scenario's.While we would welcome a PR, HttpClient has been known to cause a variety of issues related to lifetime management. In general, our advice to solve this is to configure a custom HttpClientFactory as mentioned earlier.