Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need a thread-safe/scalable credential cache for use in System.Net.Http #25447

Closed
stephentoub opened this issue Mar 14, 2018 · 5 comments
Closed
Labels
area-System.Net.Http enhancement Product code improvement that does NOT require public API changes/additions tenet-performance Performance related issue tenet-reliability Reliability/stability related issue (stress, load problems, etc.)
Milestone

Comments

@stephentoub
Copy link
Member

HttpClientHandler implementations supporting preauthenticate currently use a CredentialCache to store credentials, but CredentialCache is not thread-safe, and since requests might be modifying the cache, all access to it needs to be locked. That means when preauthenticate is enabled, every request needs to take the same lock while accessing the cache to see if it contains credentials for use in that request.

@stephentoub stephentoub changed the title Need a thread-safe credential cache for use in System.Net.Http Need a thread-safe/scalable credential cache for use in System.Net.Http Mar 14, 2018
@stephentoub
Copy link
Member Author

There are other inefficiencies that can be addressed by replacing our usage of CredentialCache, e.g. storing rather than recomputing the basic auth token for the cached credentials.

@stephentoub
Copy link
Member Author

Whatever we do here, we should also look at including a max size, so that it doesn't grow unbounded.

@karelz
Copy link
Member

karelz commented Mar 21, 2018

Does not seem to be critical for 2.1 - we already have this in place in 2.0 and earlier.
Still would be good to implement for large-scale scenarios (esp. reliability).

@geoffkizer
Copy link
Contributor

There are other inefficiencies that can be addressed by replacing our usage of CredentialCache, e.g. storing rather than recomputing the basic auth token for the cached credentials.

Agreed. Also, if we add digest support to this cache, then (a) we need to cache the token, not just the credentials, and (b) we need to cache the auth type (basic vs digest) so we know which one to use for pre-auth.

@stephentoub
Copy link
Member Author

I'm going to close this. If we see it causing real issues, we can address it then.

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 3.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net.Http enhancement Product code improvement that does NOT require public API changes/additions tenet-performance Performance related issue tenet-reliability Reliability/stability related issue (stress, load problems, etc.)
Projects
None yet
Development

No branches or pull requests

4 participants