Ensure that ActiveContextCache only enters a given combination of (activeCtx, localCtx) once in its internal FIFO#44
Closed
kacarstensen-shift wants to merge 1 commit intodigitalbazaar:masterfrom
Conversation
If we do this, then we'll try and fail to evict the same key combination multiple times, leading to KeyErrors.
|
I'm surprised this PR has been open for this long. I ran into the same issue, though I fixed it by changing So only remove an entry from cache if it's not anywhere in the deque, this way contexts don't get evicted from cache if they're still used somewhere else, but the deque itself is still limited to |
Collaborator
|
closing because this |
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.
If
ActiveContextCache.setis called multiple times during processing with a particular combination ofactiveCtxandlocalCtx,ActiveContextCache.ordergets out of sync withActiveContextCache.cache(i.e., multiple copies of a particular key combination can exist inordereven though only one copy can be cached at any given time). This causes issues later in the cache's lifecycle when it begins to evict previously set elements. The first instance of a given (activeCtx,localCtx) found inActiveContextCache.orderwill be evicted fromActiveContextCache.cachesuccessfully, but subsequent copies will cause in aKeyError. To resolve this, I made inclusion inActiveContextCache.orderconditional on the (activeCtx,localCtx) combination not already existing inActiveContextCache.cache. This keeps the two data structures are in sync and prevents theKeyErrors.