ConcurrentCache throws NullReferenceException
See original GitHub issueWe are using the ConcurrentCache
class from DotNext.Runtime.Caching
in our project, with the LFU
eviction policy.
We access values using the TryGetValue
function, and assign values using the indexing operator.
// Initialize the cache
int capacity = 10000;
var cache = new ConcurrentCache<string, string>(capacity, CacheEvictionPolicy.LFU);
// Get value
bool success = cache.TryGetValue(key, out var value);
// Set value
cache[key] = newValue;
We used this in our project and ran it with multiple threads running simultaneously and after some time it crashed with a NullReferenceException
. There is no specific instance that it crashes on, every time we run it it crashes at a different point.
Below is the full error:
Object reference not set to an instance of an object.
at DotNext.Runtime.Caching.ConcurrentCache`2.DrainQueue()
at DotNext.Runtime.Caching.ConcurrentCache`2.EnqueueAndDrain(Func`2 invoker, KeyValuePair target)
at DotNext.Runtime.Caching.ConcurrentCache`2.TryGetValue(TKey key, IEqualityComparer`1 keyComparer, Int32 hashCode, TValue& value)
Any advice would be much appreciated!
Thank you
Issue Analytics
- State:
- Created 4 months ago
- Comments:10
Top Results From Across the Web
Concurrent cache using WeakReference's throws an NPE
After a couple of weeks of the code running successfully, I've received an NPE which originates from the extra null checks IntelliJ IDEA ......
Read more >OutputCacheMiddleware throws NullReferenceException ...
I saw in our logs occasional NullReferenceException s being thrown by OutputCacheMiddleware but wasn't able to replicate that error locally ...
Read more >[Solved]-System.Web.Caching.Cache throws null exception in ...
One instance of this class is created per application domain, and it remains valid as long as the application domain remains active.
Read more >RELEASE_NOTES.txt - ignite - Git at Google
* SQLRowCount now returns number of affected rows for non-batch queries. * SQLBindParameter do not unbind parameter if the ParameterValuePtr is NULL anymore....
Read more >2022.2.8377 vs. 2022.4.2898-hotfix.4574 - Release Notes
7778 - Fixed concurrent cache access; 7604 - In addition to SemVer, ... 7585 - Fix NullReferenceException being thrown when creating or viewing...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
A new version has been published.
Works perfectly! Thank you!