fix: perform best effort cleanup for concurrently created refresh tokens#4851
Open
Danil-Grigorev wants to merge 1 commit into
Open
fix: perform best effort cleanup for concurrently created refresh tokens#4851Danil-Grigorev wants to merge 1 commit into
Danil-Grigorev wants to merge 1 commit into
Conversation
8384bea to
5bba5d0
Compare
Signed-off-by: Danil Grigorev <daniil.grigorev.dev@gmail.com>
5bba5d0 to
ffc1931
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
In a highly concurrent environment, where a local caching of refresh tokens is not possible, current password grant handler logic consistently produces duplicate refresh token resources in etcd for the same client id.
What this PR does / why we need it
This PR attempts to address this issue, by performing a best effort cleanup for such cases, leaving the last successful concurrent requester win the race and clean the outdated ones from the storage backend during update handling.
With a local reproducer, no duplicate refresh tokens are created anymore, or getting cleaned up by garbage collection.
Without the change, from 10 concurrent uncached requests result in 7-8 refresh tokens created for a client in average.
Special notes for your reviewer