Race condition in MemoryCacheMethod #3
Labels
Area: Web cache
Related to the web API caching
Duration: Short
Less than 2 hours of estimated work
Priority: Medium
Medium priority
Resolution: Fixed
The issue has been fixed
Type: Bug
Something isn't working
I overlooked the possible race condition in the garbage collector in
MemoryCacheMethod
that might happen if it wants to delete at least 2 of the same keys from the ConcurrentDictionary at the same time. While.TryRemove(...)
is thread-safe, the code around it is not. Meaning that if the key is already deleted, the other thread will fall in an infinite loop because it fails to delete it (because it doesn't exist anymore).The text was updated successfully, but these errors were encountered: