Question

I have hit a very annoying problem. I am trying to write a simple WinForm application to display the contents of an Oracle Coherence cache.

For some reason a LockRecursionException gets thrown when I call CacheFactory.GetCache("cacheName").

Write lock may not be acquired with read lock held. This pattern is prone to deadlocks. Please ensure that read locks are released before taking a write lock. If an upgrade is necessary, use an upgrade lock in place of the read lock.

The stack trace is:

at System.Threading.ReaderWriterLockSlim.TryEnterWriteLockCore(Int32 millisecondsTimeout)   
at System.Threading.ReaderWriterLockSlim.TryEnterWriteLock(Int32 millisecondsTimeout)  
at Tangosol.Util.ThreadGateSlim.Close(Int64 millis) in c:\hudson\workspace\Coh-NET-3.7.1\dev\release.net\coherence-net-v3.7.1\src\Coherence\Util\ThreadGateSlim.cs:line 26

I have placed the following code in the forms constructor, as well as a button click event handler, but still the exception gets thrown. Nothing else is called before:

using (var cache = CacheFactory.GetCache("cacheName"))
{
    ...get data from cache
}

Has anyone come across this before? I am using .Net 4.0 and Coherence 3.7.1.5. The same code works fine in a separate (far more complex project) so I'm a bit unsure about what is going wrong.

Was it helpful?

Solution

I'd suggest taking a look at all of the threads when this occurs. I'm wondering if there is something calling into Coherence deeper down in the thread that is calling the form constructor, for example.

-- Update --

From Patrick Fry (lead engineer on this feature area):

This Coherence + .NET 4.0 issue was addressed in Coherence for .NET 3.7.1.7 by the fix for COH-8044 The JIRA doesn't mention the locking issue specifically but there was a bug filed specifically about this problem and it was made a duplicate of COH-8044.

https://bug.oraclecorp.com/pls/bug/webbug_print.show?c_rptno=14732333

We should have mentioned in the patch readme for 3.7.1.7 that this particular issue was fixed as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top