IdentityServer / IdentityServer3.AccessTokenValidation

OWIN Middleware to validate access tokens from IdentityServer3
Apache License 2.0
91 stars 149 forks source link

AccessTokenValidation - HTTPClient Socket connection timeouts #163

Closed bubblyrose070 closed 6 years ago

bubblyrose070 commented 6 years ago

I am currently using IdentityServer3.AccessTokenValidation for authenticating my WebApi with IdentityServer3 2.6.0. In the regular Load, I dont see any issues however when the load is heavy and I keep getting socket connection errors (when Access Token Validation is trying to connect to Identity Server 3 using HttpClient)

Upon further investigating Access Token Validation code, I found that a new instance of HttpClient is initiated for every call and this is causing to open a new TCP connection in the server and even this client is never disposed. As per windows, even if the HttpClient is disposed it takes 240 sec to remove the TCP Connection and in between we are getting http client connection pool threshold issues which is causing socket timeouts. This issues also exists in IdentityModel.client where a new client is created.

Does any body faced similar kind of problem. If so please share your thoughts.

Here is the link which explains about the HttpClient issue: https://aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/

bubblyrose070 commented 6 years ago

This issue is only applicable for OAuth2Client and once I have used my own client to connect to Idp, the socket issue is resolved. Hence closing this issue.