Affected component
Duende.AccessTokenManagement
Version
6.3.0
Describe the bug
Consider two requests with the same token. The first request, R1, takes a "lock" on IntrospectionDictionary and goes to the server to validate the token. The second request, R2, waits for R1 to bring the server response. If R1 throws an exception (e.g. request timeout), R2 also gets this exception.
Steps to reproduce
- Configure a timeout on
OAuth2IntrospectionDefaults.BackChannelHttpClientName client
- Start an introspection request
- Hang the server response longer than the timeout
- Start another request with the same token
- Observe that the second request is aborted with a timeout error immediately when the first request is aborted
Expected behavior
The second request should get an opportunity to proceed to the server.
Additional context
There are multiple problems with the current solution:
There might be exceptions that make sense to share with concurrent requests (like can't resolve the address, for example), but it also might not be trivial to choose what to share and what not to.
Affected component
Duende.AccessTokenManagement
Version
6.3.0
Describe the bug
Consider two requests with the same token. The first request, R1, takes a "lock" on
IntrospectionDictionaryand goes to the server to validate the token. The second request, R2, waits for R1 to bring the server response. If R1 throws an exception (e.g. request timeout), R2 also gets this exception.Steps to reproduce
OAuth2IntrospectionDefaults.BackChannelHttpClientNameclientExpected behavior
The second request should get an opportunity to proceed to the server.
Additional context
There are multiple problems with the current solution:
HttpContext.RequestAbortedcancellation token, as cancelling it also aborts R2. Check out this issue: Issue with adding Request Cancelation Token to Introspection Request DuendeArchive/IdentityModel.AspNetCore.OAuth2Introspection#177. You can, however, cancel R2 withTask.WaitAsync(token).There might be exceptions that make sense to share with concurrent requests (like can't resolve the address, for example), but it also might not be trivial to choose what to share and what not to.