From 640f3f30745f77d411698739543d0eea82c44468 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 21 Sep 2014 19:24:15 +0200 Subject: [PATCH] A stab at brute force fixing the locking - one, make m_itemLock volatile, two, reset the lock even if the write lock is not apparently held. --- OpenSim/Framework/TaskInventoryDictionary.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs index 62ecbd1018..2c20ef7719 100644 --- a/OpenSim/Framework/TaskInventoryDictionary.cs +++ b/OpenSim/Framework/TaskInventoryDictionary.cs @@ -62,7 +62,7 @@ namespace OpenSim.Framework /// /// An advanced lock for inventory data /// - private System.Threading.ReaderWriterLockSlim m_itemLock = new System.Threading.ReaderWriterLockSlim(); + private volatile System.Threading.ReaderWriterLockSlim m_itemLock = new System.Threading.ReaderWriterLockSlim(); /// /// Are we readlocked by the calling thread? @@ -143,8 +143,8 @@ namespace OpenSim.Framework while (!m_itemLock.TryEnterReadLock(60000)) { m_log.Error("Thread lock detected while trying to aquire READ lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed."); - if (m_itemLock.IsWriteLockHeld) - { + //if (m_itemLock.IsWriteLockHeld) + //{ m_itemLock = new System.Threading.ReaderWriterLockSlim(); // System.Console.WriteLine("------------------------------------------"); // System.Console.WriteLine("My call stack:\n" + Environment.StackTrace); @@ -153,7 +153,7 @@ namespace OpenSim.Framework // System.Console.WriteLine("------------------------------------------"); // LockedByThread = null; // ReadLockers.Clear(); - } + //} } // ReadLockers[Thread.CurrentThread] = Environment.StackTrace; }