Bug 18245

Summary: System.Runtime.MemoryCache.GetValues() throws LockRecursionException with expired items
Product: [Mono] Class Libraries Reporter: Craig Minihan <craig>
Component: System.WebAssignee: Bugzilla <bugzilla>
Severity: normal CC: mono-bugs+mono
Priority: ---    
Version: master   
Target Milestone: Untriaged   
Hardware: PC   
OS: Linux   
Tags: Is this bug a regression?: ---
Last known good build:

Description Craig Minihan 2014-03-07 07:12:31 UTC
System.Runtime.MemoryCache.GetValues(IEnumerable <string>) will cause a LockRecursionException if the cache contains expired items.

The scenario is:
* the polling interval is high, say 10s
* items are added with a short lifespan
* calling GetValues() results in a call to MemoryCacheContainer.GetEntry() which does an EnterReadLock() on the cache
* assuming the item is still in the cache then ExpireIfNeeded() is called which does an EnterWriteLock() - and we get an     exception

MemoryCacheContainer.Get() does an EnterUpgradeableReadLock() - and this is the fix in this case.
Comment 1 Craig Minihan 2014-03-07 07:53:51 UTC
Fix made in pull #938
Comment 2 Craig Minihan 2014-03-25 20:14:47 UTC
Merged into master in: a678a101ee746e0c8f89f8e67c4a668d2af45d14