From 010f091dd4c1176a3619d8185863d9faf0845826 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 20 Mar 2020 10:50:56 +0000 Subject: [PATCH] mantis 8675: delay material delete (the reported log message may still happen, but less --- OpenSim/Region/Application/Application.cs | 34 +++++++++---------- .../Materials/MaterialsModule.cs | 8 ++--- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index 7c3b6c5029..8a32c6bdde 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -77,12 +77,12 @@ namespace OpenSim Culture.SetCurrentCulture(); Culture.SetDefaultCurrentCulture(); - if(Util.IsWindows()) + //if(Util.IsWindows()) ServicePointManager.DefaultConnectionLimit = 32; - else - { - ServicePointManager.DefaultConnectionLimit = 12; - } + //else + //{ + // ServicePointManager.DefaultConnectionLimit = 32; + //} try { ServicePointManager.DnsRefreshTimeout = 5000; } catch { } ServicePointManager.Expect100Continue = false; @@ -108,12 +108,14 @@ namespace OpenSim m_log.InfoFormat( "[OPENSIM MAIN]: System Locale is {0}", System.Threading.Thread.CurrentThread.CurrentCulture); + if(!Util.IsWindows()) + { + string monoThreadsPerCpu = System.Environment.GetEnvironmentVariable("MONO_THREADS_PER_CPU"); + m_log.InfoFormat( + "[OPENSIM MAIN]: Environment variable MONO_THREADS_PER_CPU is {0}", monoThreadsPerCpu ?? "unset"); + } - string monoThreadsPerCpu = System.Environment.GetEnvironmentVariable("MONO_THREADS_PER_CPU"); - - m_log.InfoFormat( - "[OPENSIM MAIN]: Environment variable MONO_THREADS_PER_CPU is {0}", monoThreadsPerCpu ?? "unset"); - + // Verify the Threadpool allocates or uses enough worker and IO completion threads // .NET 2.0, workerthreads default to 50 * numcores // .NET 3.0, workerthreads defaults to 250 * numcores @@ -126,13 +128,11 @@ namespace OpenSim int iocpThreadsMin = 1000; int iocpThreadsMax = 2000; // may need further adjustment to match other CLR - { - int currentMinWorkerThreads, currentMinIocpThreads; - System.Threading.ThreadPool.GetMinThreads(out currentMinWorkerThreads, out currentMinIocpThreads); - m_log.InfoFormat( - "[OPENSIM MAIN]: Runtime gave us {0} min worker threads and {1} min IOCP threads", - currentMinWorkerThreads, currentMinIocpThreads); - } + int currentMinWorkerThreads, currentMinIocpThreads; + System.Threading.ThreadPool.GetMinThreads(out currentMinWorkerThreads, out currentMinIocpThreads); + m_log.InfoFormat( + "[OPENSIM MAIN]: Runtime gave us {0} min worker threads and {1} min IOCP threads", + currentMinWorkerThreads, currentMinIocpThreads); int workerThreads, iocpThreads; System.Threading.ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads); diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs index 166cb981fa..ff66fb3e2d 100644 --- a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs +++ b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs @@ -473,7 +473,7 @@ namespace OpenSim.Region.OptionalModules.Materials if(m_Materials.ContainsKey(id)) { m_MaterialsRefCount[id]--; - if (m_MaterialsRefCount[id] <= 0) + if (m_MaterialsRefCount[id] == 0) delayedDelete.Enqueue(id); } } @@ -866,13 +866,11 @@ namespace OpenSim.Region.OptionalModules.Materials if(m_Materials.ContainsKey(id)) { m_MaterialsRefCount[id]--; - if(m_MaterialsRefCount[id] <= 0) + if(m_MaterialsRefCount[id] == 0) { FaceMaterial fm = m_Materials[id]; m_changed.Remove(fm); - m_Materials.Remove(id); - m_MaterialsRefCount.Remove(id); - m_cache.Expire(id.ToString()); + delayedDelete.Enqueue(id); } } }