From dd80380df5e47c0d67466f7d509898a71e19abd0 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 7 Oct 2009 19:45:57 -0700 Subject: [PATCH] Another go at the deadlock: not locking TryGetValue, and just catch/ignore exceptions. --- .../LindenUDP/LLUDPClientCollection.cs | 46 +++++++++++++------ 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClientCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClientCollection.cs index 9be94809e0..36e1f497af 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClientCollection.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClientCollection.cs @@ -215,33 +215,49 @@ namespace OpenSim.Region.ClientStack.LindenUDP public bool TryGetValue(UUID key, out LLUDPClient value) { - //bool success; - //bool doLock = !rwLock.IsUpgradeableReadLockHeld; - //if (doLock) rwLock.EnterReadLock(); + ////bool success; + ////bool doLock = !rwLock.IsUpgradeableReadLockHeld; + ////if (doLock) rwLock.EnterReadLock(); - //try { success = Dictionary1.TryGetValue(key, out value); } - //finally { if (doLock) rwLock.ExitReadLock(); } + ////try { success = Dictionary1.TryGetValue(key, out value); } + ////finally { if (doLock) rwLock.ExitReadLock(); } - //return success; + ////return success; - lock (m_sync) - return Dictionary1.TryGetValue(key, out value); + //lock (m_sync) + // return Dictionary1.TryGetValue(key, out value); + try + { + return Dictionary1.TryGetValue(key, out value); + } + catch { } + value = null; + return false; } public bool TryGetValue(IPEndPoint key, out LLUDPClient value) { - //bool success; - //bool doLock = !rwLock.IsUpgradeableReadLockHeld; - //if (doLock) rwLock.EnterReadLock(); + ////bool success; + ////bool doLock = !rwLock.IsUpgradeableReadLockHeld; + ////if (doLock) rwLock.EnterReadLock(); - //try { success = Dictionary2.TryGetValue(key, out value); } - //finally { if (doLock) rwLock.ExitReadLock(); } + ////try { success = Dictionary2.TryGetValue(key, out value); } + ////finally { if (doLock) rwLock.ExitReadLock(); } - //return success; + ////return success; - lock (m_sync) + //lock (m_sync) + // return Dictionary2.TryGetValue(key, out value); + + try + { return Dictionary2.TryGetValue(key, out value); + } + catch { } + value = null; + return false; + } public void ForEach(Action action)