From d90b68c2a637b822b826a0cf3c52991aa9ee2c97 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 26 May 2017 00:05:35 +0100
Subject: change wrong watchdog stopped thread check code, and don't log it
---
OpenSim/Framework/Monitoring/Watchdog.cs | 13 ++++++++++---
OpenSim/Region/Application/OpenSim.cs | 2 --
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs
index 8a4894e..5fb725c 100644
--- a/OpenSim/Framework/Monitoring/Watchdog.cs
+++ b/OpenSim/Framework/Monitoring/Watchdog.cs
@@ -193,7 +193,7 @@ namespace OpenSim.Framework.Monitoring
m_watchdogTimer.Dispose();
m_watchdogTimer = null;
}
-
+
foreach(ThreadWatchdogInfo twi in m_threads.Values)
{
Thread t = twi.Thread;
@@ -341,6 +341,8 @@ namespace OpenSim.Framework.Monitoring
///
private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
{
+ if(!m_enabled)
+ return;
int now = Environment.TickCount & Int32.MaxValue;
int msElapsed = now - LastWatchdogThreadTick;
@@ -358,21 +360,26 @@ namespace OpenSim.Framework.Monitoring
List callbackInfos = null;
List threadsToRemove = null;
+ const ThreadState thgone = ThreadState.Stopped | ThreadState.Aborted | ThreadState.AbortRequested;
+
lock (m_threads)
{
foreach(ThreadWatchdogInfo threadInfo in m_threads.Values)
{
- if(threadInfo.Thread.ThreadState == ThreadState.Stopped)
+ if(!m_enabled)
+ return;
+ if(!threadInfo.Thread.IsAlive || (threadInfo.Thread.ThreadState & thgone) != 0)
{
if(threadsToRemove == null)
threadsToRemove = new List();
threadsToRemove.Add(threadInfo);
-
+/*
if(callbackInfos == null)
callbackInfos = new List();
callbackInfos.Add(threadInfo);
+*/
}
else if(!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout)
{
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 5977f40..fcc8717 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -511,8 +511,6 @@ namespace OpenSim
private void WatchdogTimeoutHandler(Watchdog.ThreadWatchdogInfo twi)
{
int now = Environment.TickCount & Int32.MaxValue;
- if(twi.Thread.ThreadState == System.Threading.ThreadState.Stopped)
- return;
m_log.ErrorFormat(
"[WATCHDOG]: Timeout detected for thread \"{0}\". ThreadState={1}. Last tick was {2}ms ago. {3}",
twi.Thread.Name,
--
cgit v1.1
From 8d8236cfb245eaa25f81f2840175b8fe676febbd Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 26 May 2017 00:34:04 +0100
Subject: missing file change.. actually use watchdog threads on
assetsconnector and avoid null refs on JobEngine
---
OpenSim/Framework/Monitoring/JobEngine.cs | 7 +++++--
OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | 11 ++++++++---
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/OpenSim/Framework/Monitoring/JobEngine.cs b/OpenSim/Framework/Monitoring/JobEngine.cs
index 0a39e4b..a6a059d 100644
--- a/OpenSim/Framework/Monitoring/JobEngine.cs
+++ b/OpenSim/Framework/Monitoring/JobEngine.cs
@@ -136,12 +136,15 @@ namespace OpenSim.Framework.Monitoring
if(m_jobQueue.Count <= 0)
m_cancelSource.Cancel();
- if(m_finishedProcessingAfterStop.WaitOne(RequestProcessTimeoutOnStop))
+ m_finishedProcessingAfterStop.WaitOne(RequestProcessTimeoutOnStop);
m_finishedProcessingAfterStop.Close();
}
finally
{
- m_cancelSource.Dispose();
+ if(m_cancelSource != null)
+ m_cancelSource.Dispose();
+ if(m_finishedProcessingAfterStop != null)
+ m_finishedProcessingAfterStop.Dispose();
}
}
}
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
index 2deb2d1..7e81be7 100644
--- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
@@ -34,7 +34,7 @@ using System.Reflection;
using System.Timers;
using Nini.Config;
using OpenSim.Framework;
-using OpenSim.Framework.Console;
+using OpenSim.Framework.Monitoring;
using OpenSim.Services.Interfaces;
using OpenMetaverse;
@@ -135,7 +135,11 @@ namespace OpenSim.Services.Connectors
for (int i = 0 ; i < 2 ; i++)
{
- Util.FireAndForget(delegate { AssetRequestProcessor();});
+ m_fetchThreads[i] = WorkManager.StartThread(AssetRequestProcessor,
+ String.Format("GetTextureWorker{0}", i),
+ ThreadPriority.Normal,
+ true,
+ false);
}
}
@@ -357,7 +361,8 @@ namespace OpenSim.Services.Connectors
while (true)
{
- r = m_requestQueue.Dequeue(2000);
+ r = m_requestQueue.Dequeue(4500);
+ Watchdog.UpdateThread();
if(r== null)
continue;
string uri = r.uri;
--
cgit v1.1
From 7a82c7c5b2a897ba1bd64c2badb71fe93c674246 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 26 May 2017 00:47:08 +0100
Subject: make BlockingQueue.Dequeue timeouts more coerent (just less than
watchdog timeout)
---
OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | 4 ++--
OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 4 ++--
OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | 3 +--
OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 8 ++++----
4 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
index 03f0a04..a721454 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
@@ -204,10 +204,10 @@ namespace OpenSim.Region.ClientStack.Linden
{
while(true)
{
- aPollRequest poolreq = m_queue.Dequeue(1000);
+ aPollRequest poolreq = m_queue.Dequeue(4500);
+ Watchdog.UpdateThread();
if(m_NumberScenes <= 0)
return;
- Watchdog.UpdateThread();
if(poolreq.reqID != UUID.Zero)
poolreq.thepoll.Process(poolreq);
}
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
index 8ef943c..ce9798b 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
@@ -415,10 +415,10 @@ namespace OpenSim.Region.ClientStack.Linden
{
while (true)
{
- aPollRequest poolreq = m_queue.Dequeue(2000);
+ aPollRequest poolreq = m_queue.Dequeue(4500);
+ Watchdog.UpdateThread();
if(m_NumberScenes <= 0)
return;
- Watchdog.UpdateThread();
if(poolreq.reqID != UUID.Zero)
poolreq.thepoll.Process(poolreq);
}
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
index 23ec141..a367426 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
@@ -443,10 +443,9 @@ namespace OpenSim.Region.ClientStack.Linden
{
while (true)
{
+ aPollRequest poolreq = m_queue.Dequeue(4500);
Watchdog.UpdateThread();
- aPollRequest poolreq = m_queue.Dequeue(5000);
-
if (poolreq != null && poolreq.thepoll != null)
{
try
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 00c8279..03a4d34 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -716,12 +716,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
{
while (true)
{
- Watchdog.UpdateThread();
-
av = null;
st = null;
- st = requests.Dequeue(4900); // timeout to make watchdog happy
+ st = requests.Dequeue(4500);
+ Watchdog.UpdateThread();
if (st == null || st.agentID == UUID.Zero)
continue;
@@ -1152,10 +1151,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
{
while(!m_mapBlockRequestEvent.WaitOne(4900))
{
+ Watchdog.UpdateThread();
if(m_scene == null)
return;
}
-
+ Watchdog.UpdateThread();
lock (m_mapBlockRequestEvent)
{
int total = 0;
--
cgit v1.1
From 5287489a3c0c8c0d5b6fe739d6c0a334a12eee6a Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 26 May 2017 00:53:21 +0100
Subject: avoid some wrong watchdog timeouts
---
OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs | 2 +-
.../ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
index aed1372..f68c5f8 100644
--- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
@@ -658,7 +658,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
public void Process()
{
_finished = false;
- httpThread = WorkManager.StartThread(SendRequest, "HttpRequestThread", ThreadPriority.BelowNormal, true, false);
+ httpThread = WorkManager.StartThread(SendRequest, "HttpRequestThread", ThreadPriority.BelowNormal, true, false, null, int.MaxValue);
}
/*
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
index 1688aa6..e01d2e4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
@@ -226,9 +226,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
try
{
Thread.Sleep(cmdHandlerThreadCycleSleepms);
-
+ Watchdog.UpdateThread();
DoOneCmdHandlerPass();
-
Watchdog.UpdateThread();
}
catch ( System.Threading.ThreadAbortException) { }
--
cgit v1.1
From 426f2130fcc865e95d76d0a7de9a1f4d4d104c51 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 26 May 2017 01:50:54 +0100
Subject: change opensim-ode.sh to use the ode engine defined on opensim.ini
---
bin/OpenSim.ini.example | 4 ++++
bin/opensim-ode.sh | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index 021e444..5d969ce 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -259,6 +259,10 @@
;; alternative OpenDynamicsEngine engine. ubODEMeshmerizer meshing above MUST be selected also
; physics = ubODE
+ ; ubODE and OpenDynamicsEngine does allocate a lot of memory on stack. On linux you may need to increase its limit
+ ; script opensim-ode-sh starts opensim setting that limit. You may need to increase it even more on large regions
+ ; edit the line ulimit -s 262144, and change this last value
+
;# {DefaultScriptEngine} {} {Default script engine} {XEngine} XEngine
;; Default script engine to use. Currently, we only have XEngine
; DefaultScriptEngine = "XEngine"
diff --git a/bin/opensim-ode.sh b/bin/opensim-ode.sh
index b901425..7c61571 100755
--- a/bin/opensim-ode.sh
+++ b/bin/opensim-ode.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-echo "Starting OpenSimulator with ODE. If you get an error saying limit: Operation not permitted. Then you will need to chmod 0600 /etc/limits"
+echo "Starting OpenSimulator with ODE or ubOde. If you get an error saying limit: Operation not permitted. Then you will need to chmod 0600 /etc/limits"
ulimit -s 262144
-mono OpenSim.exe -physics=OpenDynamicsEngine
+mono OpenSim.exe
--
cgit v1.1
From 8f10db0a6a4831cded816e6d08b09fe0e47c77b4 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 26 May 2017 05:32:59 +0100
Subject: mantis 8181: don't try to delete contents of a non exitent folder
---
OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 610e279..e5ac17d 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -646,7 +646,7 @@ namespace OpenSim.Region.CoreModules.Asset
if (m_LogLevel >= 2)
m_log.Debug("[FLOTSAM ASSET CACHE]: Clearing caches.");
- if (m_FileCacheEnabled)
+ if (m_FileCacheEnabled && Directory.Exists(m_CacheDirectory))
{
foreach (string dir in Directory.GetDirectories(m_CacheDirectory))
{
@@ -681,10 +681,10 @@ namespace OpenSim.Region.CoreModules.Asset
// before cleaning up expired files we must scan the objects in the scene to make sure that we retain
// such local assets if they have not been recently accessed.
TouchAllSceneAssets(false);
-
- foreach (string dir in Directory.GetDirectories(m_CacheDirectory))
+ if(Directory.Exists(m_CacheDirectory))
{
- CleanExpiredFiles(dir, purgeLine);
+ foreach (string dir in Directory.GetDirectories(m_CacheDirectory))
+ CleanExpiredFiles(dir, purgeLine);
}
lock(timerLock)
@@ -706,6 +706,9 @@ namespace OpenSim.Region.CoreModules.Asset
{
try
{
+ if(!Directory.Exists(dir))
+ return;
+
foreach (string file in Directory.GetFiles(dir))
{
if (File.GetLastAccessTime(file) < purgeLine)
@@ -869,6 +872,9 @@ namespace OpenSim.Region.CoreModules.Asset
///
private int GetFileCacheCount(string dir)
{
+ if(!Directory.Exists(dir))
+ return 0;
+
int count = Directory.GetFiles(dir).Length;
foreach (string subdir in Directory.GetDirectories(dir))
@@ -987,6 +993,9 @@ namespace OpenSim.Region.CoreModules.Asset
///
private void ClearFileCache()
{
+ if(!Directory.Exists(m_CacheDirectory))
+ return;
+
foreach (string dir in Directory.GetDirectories(m_CacheDirectory))
{
try
--
cgit v1.1
From e7c2674dec2c9ea36313b51e7bc604753e16f24f Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 26 May 2017 21:26:51 +0100
Subject: cleanup (grid)region info endpoint; add log to try to find some xml
decode issues
---
OpenSim/Framework/RegionInfo.cs | 38 +------------------
OpenSim/Framework/Util.cs | 59 +++++++++++++++++++++++++++++
OpenSim/Server/Base/ServerUtils.cs | 21 ++++++----
OpenSim/Services/Interfaces/IGridService.cs | 45 +---------------------
4 files changed, 75 insertions(+), 88 deletions(-)
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 7de8c52..75ed999 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -420,6 +420,7 @@ namespace OpenSim.Framework
set { m_remotingPort = value; }
}
+
///
/// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw.
///
@@ -427,42 +428,7 @@ namespace OpenSim.Framework
///
public IPEndPoint ExternalEndPoint
{
- get
- {
- // Old one defaults to IPv6
- //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port);
-
- IPAddress ia = null;
- // If it is already an IP, don't resolve it - just return directly
- if (IPAddress.TryParse(m_externalHostName, out ia))
- return new IPEndPoint(ia, m_internalEndPoint.Port);
-
- // Reset for next check
- ia = null;
- try
- {
- foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName))
- {
- if (ia == null)
- ia = Adr;
-
- if (Adr.AddressFamily == AddressFamily.InterNetwork)
- {
- ia = Adr;
- break;
- }
- }
- }
- catch (SocketException e)
- {
- throw new Exception(
- "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" +
- e + "' attached to this exception", e);
- }
-
- return new IPEndPoint(ia, m_internalEndPoint.Port);
- }
-
+ get { return Util.getEndPoint(m_externalHostName, m_internalEndPoint.Port); }
set { m_externalHostName = value.ToString(); }
}
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 5eedd29..83d9df1 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -429,6 +429,65 @@ namespace OpenSim.Framework
return regionCoord << 8;
}
+ public static IPEndPoint getEndPoint(IPAddress ia, int port)
+ {
+ if(ia == null)
+ return null;
+
+ IPEndPoint newEP = null;
+ try
+ {
+ newEP = new IPEndPoint(ia, port);
+ }
+ catch
+ {
+ newEP = null;
+ }
+ return newEP;
+ }
+
+ public static IPEndPoint getEndPoint(string hostname, int port)
+ {
+ IPAddress ia = null;
+ // If it is already an IP, don't resolve it - just return directly
+ // we should not need this
+ if (IPAddress.TryParse(hostname, out ia))
+ {
+ if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any))
+ return null;
+ return getEndPoint(ia, port);
+ }
+
+ // Reset for next check
+ ia = null;
+ try
+ {
+ foreach (IPAddress Adr in Dns.GetHostAddresses(hostname))
+ {
+ if (ia == null)
+ ia = Adr;
+
+ if (Adr.AddressFamily == AddressFamily.InterNetwork)
+ {
+ ia = Adr;
+ break;
+ }
+ }
+ }
+ catch // (SocketException e)
+ {
+ /*throw new Exception(
+ "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" +
+ e + "' attached to this exception", e);*/
+ // Don't throw a fatal exception here, instead, return Null and handle it in the caller.
+ // Reason is, on systems such as OSgrid it has occured that known hostnames stop
+ // resolving and thus make surrounding regions crash out with this exception.
+ return null;
+ }
+
+ return getEndPoint(ia,port);
+ }
+
public static bool checkServiceURI(string uristr, out string serviceURI)
{
serviceURI = string.Empty;
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs
index b17d7ba..aff6b4f 100644
--- a/OpenSim/Server/Base/ServerUtils.cs
+++ b/OpenSim/Server/Base/ServerUtils.cs
@@ -478,17 +478,22 @@ namespace OpenSim.Server.Base
XmlDocument doc = new XmlDocument();
- doc.LoadXml(data);
-
- XmlNodeList rootL = doc.GetElementsByTagName("ServerResponse");
-
- if (rootL.Count != 1)
- return ret;
+ try
+ {
+ doc.LoadXml(data);
+ XmlNodeList rootL = doc.GetElementsByTagName("ServerResponse");
- XmlNode rootNode = rootL[0];
+ if (rootL.Count != 1)
+ return ret;
- ret = ParseElement(rootNode);
+ XmlNode rootNode = rootL[0];
+ ret = ParseElement(rootNode);
+ }
+ catch (Exception e)
+ {
+ m_log.DebugFormat("[serverUtils.ParseXmlResponse]: failed error: {0} \n --- string: {1} - ",e.Message, data);
+ }
return ret;
}
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index 8068ff5..ead5d3c 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -462,50 +462,7 @@ namespace OpenSim.Services.Interfaces
///
public IPEndPoint ExternalEndPoint
{
- get
- {
- IPAddress ia = null;
- // If it is already an IP, don't resolve it - just return directly
- // we should not need this
- if (IPAddress.TryParse(m_externalHostName, out ia))
- {
- if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any))
- return null;
- return new IPEndPoint(ia, m_internalEndPoint.Port);
- }
-
- // Reset for next check
- ia = null;
- try
- {
- foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName))
- {
- if (ia == null)
- ia = Adr;
-
- if (Adr.AddressFamily == AddressFamily.InterNetwork)
- {
- ia = Adr;
- break;
- }
- }
- }
- catch // (SocketException e)
- {
- /*throw new Exception(
- "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" +
- e + "' attached to this exception", e);*/
- // Don't throw a fatal exception here, instead, return Null and handle it in the caller.
- // Reason is, on systems such as OSgrid it has occured that known hostnames stop
- // resolving and thus make surrounding regions crash out with this exception.
- return null;
- }
-
- if(ia == null)
- return null;
-
- return new IPEndPoint(ia, m_internalEndPoint.Port);
- }
+ get { return Util.getEndPoint(m_externalHostName, m_internalEndPoint.Port); }
}
public string ExternalHostName
--
cgit v1.1
From 2be362bd6759bc1f6b87703ad32f235c27d97c9a Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 26 May 2017 21:30:06 +0100
Subject: lose a ref
---
.../ServiceConnectorsOut/Grid/RegionInfoCache.cs | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs
index 84e52f7..5d90b97 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs
@@ -385,7 +385,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
storage[handle] = region;
byname[region.RegionName] = handle;
byuuid[region.RegionID] = handle;
-
}
public void Remove(GridRegion region)
@@ -400,7 +399,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
ulong handle = region.RegionHandle & HANDLEMASK;
if(storage != null)
- storage.Remove(handle);
+ {
+ if(storage.ContainsKey(handle))
+ {
+ storage[handle] = null;
+ storage.Remove(handle);
+ }
+ }
removeFromInner(region);
if(expires != null)
{
@@ -610,8 +615,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
if(byuuid != null)
byuuid.Remove(r.RegionID);
removeFromInner(r);
+
+ storage[h] = null;
+ storage.Remove(h);
}
- storage.Remove(h);
}
if(expires != null)
expires.Remove(h);
@@ -693,7 +700,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
public class RegionsExpiringCache
{
- const double CACHE_PURGE_HZ = 60; // seconds
+ const double CACHE_PURGE_TIME = 60000; // milliseconds
const int MAX_LOCK_WAIT = 10000; // milliseconds
/// For thread safety
@@ -702,7 +709,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
object isPurging = new object();
Dictionary InfobyScope = new Dictionary();
- private System.Timers.Timer timer = new System.Timers.Timer(TimeSpan.FromSeconds(CACHE_PURGE_HZ).TotalMilliseconds);
+ private System.Timers.Timer timer = new System.Timers.Timer(CACHE_PURGE_TIME);
public RegionsExpiringCache()
{
--
cgit v1.1
From 289d4ca128d278aed49044b92411234d5f57b781 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 27 May 2017 05:41:40 +0100
Subject: minor cleanup
---
.../ServiceConnectorsOut/Grid/RegionInfoCache.cs | 34 +++++--
.../ScriptEngine/Shared/CodeTools/Compiler.cs | 101 ++++++---------------
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 7 +-
3 files changed, 56 insertions(+), 86 deletions(-)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs
index 5d90b97..f3c2900 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs
@@ -429,6 +429,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
if(byuuid != null)
byuuid.Remove(r.RegionID);
removeFromInner(r);
+ storage[handle] = null;
}
storage.Remove(handle);
}
@@ -586,27 +587,32 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
{
if(expires == null || expires.Count == 0)
return 0;
-
+
+ int expiresCount = expires.Count;
List toexpire = new List();
+
foreach(KeyValuePair kvp in expires)
{
if(kvp.Value < now)
toexpire.Add(kvp.Key);
}
- if(toexpire.Count == 0)
- return expires.Count;
+ int toexpireCount = toexpire.Count;
+ if(toexpireCount == 0)
+ return expiresCount;
- if(toexpire.Count == expires.Count)
+ if(toexpireCount == expiresCount)
{
Clear();
return 0;
}
- foreach(ulong h in toexpire)
+ if(storage != null)
{
- if(storage != null)
+ ulong h;
+ for(int i = 0; i < toexpireCount; i++)
{
+ h = toexpire[i];
if(storage.ContainsKey(h))
{
GridRegion r = storage[h];
@@ -619,12 +625,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
storage[h] = null;
storage.Remove(h);
}
+ if(expires != null)
+ expires.Remove(h);
}
- if(expires != null)
- expires.Remove(h);
+ }
+ else
+ {
+ Clear();
+ return 0;
}
- if(expires.Count == 0)
+ if(expiresCount == 0)
{
byname = null;
byuuid = null;
@@ -633,7 +644,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
return 0;
}
- return expires.Count;
+ return expiresCount;
}
public int Count()
@@ -972,7 +983,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
if (expiredscopes.Count > 0)
{
foreach (UUID sid in expiredscopes)
+ {
+ InfobyScope[sid] = null;
InfobyScope.Remove(sid);
+ }
}
}
finally { Monitor.Exit(syncRoot); }
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index f3b8e1d..20f9770 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -79,12 +79,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
private List m_warnings = new List();
- // private object m_syncy = new object();
-
-// private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider();
-// private static VBCodeProvider VBcodeProvider = new VBCodeProvider();
-
- // private static int instanceID = new Random().Next(0, int.MaxValue); // Unique number to use on our compiled files
private static UInt64 scriptCompileCounter = 0; // And a counter
public IScriptEngine m_scriptEngine;
@@ -251,23 +245,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
}
}
- ////private ICodeCompiler icc = codeProvider.CreateCompiler();
- //public string CompileFromFile(string LSOFileName)
- //{
- // switch (Path.GetExtension(LSOFileName).ToLower())
- // {
- // case ".txt":
- // case ".lsl":
- // Common.ScriptEngineBase.Shared.SendToDebug("Source code is LSL, converting to CS");
- // return CompileFromLSLText(File.ReadAllText(LSOFileName));
- // case ".cs":
- // Common.ScriptEngineBase.Shared.SendToDebug("Source code is CS");
- // return CompileFromCSText(File.ReadAllText(LSOFileName));
- // default:
- // throw new Exception("Unknown script type.");
- // }
- //}
-
public string GetCompilerOutput(string assetID)
{
return Path.Combine(ScriptEnginesPath, Path.Combine(
@@ -578,8 +555,6 @@ namespace SecondLife
switch (lang)
{
case enumCompileType.vb:
-// results = VBcodeProvider.CompileAssemblyFromSource(
-// parameters, Script);
provider = CodeDomProvider.CreateProvider("VisualBasic");
break;
case enumCompileType.cs:
@@ -594,56 +569,36 @@ namespace SecondLife
if(provider == null)
throw new Exception("Compiler failed to load ");
+ bool complete = false;
+ bool retried = false;
- bool complete = false;
- bool retried = false;
-
- do
+ do
+ {
+ results = provider.CompileAssemblyFromSource(
+ parameters, Script);
+ // Deal with an occasional segv in the compiler.
+ // Rarely, if ever, occurs twice in succession.
+ // Line # == 0 and no file name are indications that
+ // this is a native stack trace rather than a normal
+ // error log.
+ if (results.Errors.Count > 0)
+ {
+ if (!retried && string.IsNullOrEmpty(results.Errors[0].FileName) &&
+ results.Errors[0].Line == 0)
{
-// lock (CScodeProvider)
-// {
-// results = CScodeProvider.CompileAssemblyFromSource(
-// parameters, Script);
-// }
-
- results = provider.CompileAssemblyFromSource(
- parameters, Script);
- // Deal with an occasional segv in the compiler.
- // Rarely, if ever, occurs twice in succession.
- // Line # == 0 and no file name are indications that
- // this is a native stack trace rather than a normal
- // error log.
- if (results.Errors.Count > 0)
- {
- if (!retried && string.IsNullOrEmpty(results.Errors[0].FileName) &&
- results.Errors[0].Line == 0)
- {
- // System.Console.WriteLine("retrying failed compilation");
- retried = true;
- }
- else
- {
- complete = true;
- }
- }
- else
- {
- complete = true;
- }
- } while (!complete);
-// break;
-// default:
-// throw new Exception("Compiler is not able to recongnize " +
-// "language type \"" + lang.ToString() + "\"");
-// }
-
-// foreach (Type type in results.CompiledAssembly.GetTypes())
-// {
-// foreach (MethodInfo method in type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static))
-// {
-// m_log.DebugFormat("[COMPILER]: {0}.{1}", type.FullName, method.Name);
-// }
-// }
+ // System.Console.WriteLine("retrying failed compilation");
+ retried = true;
+ }
+ else
+ {
+ complete = true;
+ }
+ }
+ else
+ {
+ complete = true;
+ }
+ } while (!complete);
//
// WARNINGS AND ERRORS
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index c1abba2..870957b 100755
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -2149,10 +2149,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
string fn = Path.GetFileName(assemName);
string assem = String.Empty;
+ string assemNameText = assemName + ".text";
- if (File.Exists(assemName + ".text"))
+ if (File.Exists(assemNameText))
{
- FileInfo tfi = new FileInfo(assemName + ".text");
+ FileInfo tfi = new FileInfo(assemNameText);
if (tfi != null)
{
@@ -2160,7 +2161,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
try
{
- using (FileStream tfs = File.Open(assemName + ".text",
+ using (FileStream tfs = File.Open(assemNameText,
FileMode.Open, FileAccess.Read))
{
tfs.Read(tdata, 0, tdata.Length);
--
cgit v1.1
From f7ae87a0d5d124ef900e65400767258de57c4003 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 27 May 2017 05:44:50 +0100
Subject: minor cleanup
---
OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs
index f3c2900..f6fff58 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs
@@ -635,6 +635,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
return 0;
}
+ expiresCount = expires.Count;
if(expiresCount == 0)
{
byname = null;
--
cgit v1.1