-
Notifications
You must be signed in to change notification settings - Fork 815
Fix race in cache eviction #18528
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
base: main
Are you sure you want to change the base?
Fix race in cache eviction #18528
Conversation
❗ Release notes requiredCaution No release notes found for the changed paths (see table below). Please make sure to add an entry with an informative description of the change as well as link to this pull request, issue and language suggestion if applicable. Release notes for this repository are based on Keep A Changelog format. The following format is recommended for this repository:
If you believe that release notes are not necessary for this PR, please add NO_RELEASE_NOTES label to the pull request. You can open this PR in browser to add release notes: open in github.dev
|
// Store updates are not synchronized. It is possible the entity is no longer in the queue. | ||
| EvictionQueueMessage.Update entity when isNull entity.Node.List -> () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bugfix. We obviously don't want to lock the ConcurrentDictionary for eviction queue updates.
This makes a race possible where an Update is posted just as the item was being evicted.
In effect Node.List was null, and the mailbox processor silently crashes.
This would happen during intensive cache use with evictions going on, for example when switching branches or solutions in the IDE.
The symptom of this would be excessive allocations. Or lack of eviction if you take a look at the metrics.
This is tested manually in the IDE and confirmed that no longer reproduces.
I spotted a bug in the recently merged general purpose cache.
Let's fix it before folks start complaining.