mantis 8675: delay material delete (the reported log message may still happen, but less

master
UbitUmarov 2020-03-20 10:50:56 +00:00
parent 9864d1abfc
commit 010f091dd4
2 changed files with 20 additions and 22 deletions

View File

@ -77,12 +77,12 @@ namespace OpenSim
Culture.SetCurrentCulture(); Culture.SetCurrentCulture();
Culture.SetDefaultCurrentCulture(); Culture.SetDefaultCurrentCulture();
if(Util.IsWindows()) //if(Util.IsWindows())
ServicePointManager.DefaultConnectionLimit = 32; ServicePointManager.DefaultConnectionLimit = 32;
else //else
{ //{
ServicePointManager.DefaultConnectionLimit = 12; // ServicePointManager.DefaultConnectionLimit = 32;
} //}
try { ServicePointManager.DnsRefreshTimeout = 5000; } catch { } try { ServicePointManager.DnsRefreshTimeout = 5000; } catch { }
ServicePointManager.Expect100Continue = false; ServicePointManager.Expect100Continue = false;
@ -108,11 +108,13 @@ namespace OpenSim
m_log.InfoFormat( m_log.InfoFormat(
"[OPENSIM MAIN]: System Locale is {0}", System.Threading.Thread.CurrentThread.CurrentCulture); "[OPENSIM MAIN]: System Locale is {0}", System.Threading.Thread.CurrentThread.CurrentCulture);
if(!Util.IsWindows())
{
string monoThreadsPerCpu = System.Environment.GetEnvironmentVariable("MONO_THREADS_PER_CPU"); string monoThreadsPerCpu = System.Environment.GetEnvironmentVariable("MONO_THREADS_PER_CPU");
m_log.InfoFormat( m_log.InfoFormat(
"[OPENSIM MAIN]: Environment variable MONO_THREADS_PER_CPU is {0}", monoThreadsPerCpu ?? "unset"); "[OPENSIM MAIN]: Environment variable MONO_THREADS_PER_CPU is {0}", monoThreadsPerCpu ?? "unset");
}
// Verify the Threadpool allocates or uses enough worker and IO completion threads // Verify the Threadpool allocates or uses enough worker and IO completion threads
// .NET 2.0, workerthreads default to 50 * numcores // .NET 2.0, workerthreads default to 50 * numcores
@ -126,13 +128,11 @@ namespace OpenSim
int iocpThreadsMin = 1000; int iocpThreadsMin = 1000;
int iocpThreadsMax = 2000; // may need further adjustment to match other CLR int iocpThreadsMax = 2000; // may need further adjustment to match other CLR
{
int currentMinWorkerThreads, currentMinIocpThreads; int currentMinWorkerThreads, currentMinIocpThreads;
System.Threading.ThreadPool.GetMinThreads(out currentMinWorkerThreads, out currentMinIocpThreads); System.Threading.ThreadPool.GetMinThreads(out currentMinWorkerThreads, out currentMinIocpThreads);
m_log.InfoFormat( m_log.InfoFormat(
"[OPENSIM MAIN]: Runtime gave us {0} min worker threads and {1} min IOCP threads", "[OPENSIM MAIN]: Runtime gave us {0} min worker threads and {1} min IOCP threads",
currentMinWorkerThreads, currentMinIocpThreads); currentMinWorkerThreads, currentMinIocpThreads);
}
int workerThreads, iocpThreads; int workerThreads, iocpThreads;
System.Threading.ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads); System.Threading.ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads);

View File

@ -473,7 +473,7 @@ namespace OpenSim.Region.OptionalModules.Materials
if(m_Materials.ContainsKey(id)) if(m_Materials.ContainsKey(id))
{ {
m_MaterialsRefCount[id]--; m_MaterialsRefCount[id]--;
if (m_MaterialsRefCount[id] <= 0) if (m_MaterialsRefCount[id] == 0)
delayedDelete.Enqueue(id); delayedDelete.Enqueue(id);
} }
} }
@ -866,13 +866,11 @@ namespace OpenSim.Region.OptionalModules.Materials
if(m_Materials.ContainsKey(id)) if(m_Materials.ContainsKey(id))
{ {
m_MaterialsRefCount[id]--; m_MaterialsRefCount[id]--;
if(m_MaterialsRefCount[id] <= 0) if(m_MaterialsRefCount[id] == 0)
{ {
FaceMaterial fm = m_Materials[id]; FaceMaterial fm = m_Materials[id];
m_changed.Remove(fm); m_changed.Remove(fm);
m_Materials.Remove(id); delayedDelete.Enqueue(id);
m_MaterialsRefCount.Remove(id);
m_cache.Expire(id.ToString());
} }
} }
} }