-
Notifications
You must be signed in to change notification settings - Fork 12
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
Serious concerns about thread safety #38
Comments
Thanks for reporting it. I'll need to dive into it to see if you're right. |
You mean that the node created in |
The expression |
You're right. The documentation is inconsistent because the concrete |
@ivankoster in your opinion, would you expect |
I would expect it to never return null. That would make it consistent with the Base Class Library, for example ConcurrentDictionary.GetOrAdd |
Yeah, I agree. I need to carefully analyze that situation so to not cause any deadlocks (again). |
Hello,
I was interested using this cache and started reading the code to understand it.
I pretty quickly identified a scenario that is probably not threadsafe.
In the class Index<TKey, T>, method GetItem(..)
When the method RemoveFromCache() from class Node finishes between the if and return statement in the above snippet, null will be returned from this GetItem() method, because there are no read locks here. I don't think that is the intended behavior?
Also, the remarks for the class FluidCache says there are 2 locks, but I can easily spot 4, in:
The text was updated successfully, but these errors were encountered: