From 18f1ea10860f8ffbde87b01222705f2290591868 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 28 May 2017 01:11:53 +0100 Subject: [PATCH 01/25] make LSL_list a CLASS again. Now we need to it allover again. Scripts need to be recompiled ( delete contents of bin/ScriptEngines) --- OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index f16fd0146b..bf47f1f656 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -525,7 +525,7 @@ namespace OpenSim.Region.ScriptEngine.Shared } [Serializable] - public struct list + public class list { private object[] m_data; From 572e84c8225493c5ff2d7799ac132ba608442d90 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 28 May 2017 01:56:52 +0100 Subject: [PATCH 02/25] make use of a rare thing called StringBuilder on LSL_List. LSL_List uses may need a revision to make sure they are passed by ref and not by value, with necessary adjustments. This does not have much impact on AppDomains, since if they cross, they are always serialized. Since lists are important parts of LSL, the AppDomainLoading option needs to be replaced by something else --- .../Region/ScriptEngine/Shared/LSL_Types.cs | 69 +++++++++++-------- 1 file changed, 39 insertions(+), 30 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index bf47f1f656..4d7a6988bd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -28,6 +28,7 @@ using System; using System.Collections; using System.Globalization; +using System.Text; using System.Text.RegularExpressions; using OpenSim.Framework; @@ -1152,34 +1153,35 @@ namespace OpenSim.Region.ScriptEngine.Shared public string ToCSV() { - string ret = ""; - foreach (object o in this.Data) + if(m_data == null || m_data.Length == 0) + return String.Empty; + + Object o = m_data[0]; + int len = m_data.Length; + if(len == 1) + return o.ToString(); + + StringBuilder sb = new StringBuilder(1024); + sb.Append(o.ToString()); + for(int i = 1 ; i < len; i++) { - if (ret == "") - { - ret = o.ToString(); - } - else - { - ret = ret + ", " + o.ToString(); - } + sb.Append(","); + sb.Append(o.ToString()); } - return ret; + return sb.ToString(); } private string ToSoup() { - string output; - output = String.Empty; - if (Data.Length == 0) - { + if(m_data == null || m_data.Length == 0) return String.Empty; - } - foreach (object o in Data) + + StringBuilder sb = new StringBuilder(1024); + foreach (object o in m_data) { - output = output + o.ToString(); + sb.Append(o.ToString()); } - return output; + return sb.ToString(); } public static explicit operator String(list l) @@ -1369,26 +1371,33 @@ namespace OpenSim.Region.ScriptEngine.Shared public string ToPrettyString() { - string output; - if (Data.Length == 0) - { + if(m_data == null || m_data.Length == 0) return "[]"; - } - output = "["; - foreach (object o in Data) + + StringBuilder sb = new StringBuilder(1024); + int len = m_data.Length; + int last = len - 1; + object o; + + sb.Append("["); + for(int i = 0; i < len; i++ ) { + o = m_data[i]; if (o is String) { - output = output + "\"" + o + "\", "; + sb.Append("\""); + sb.Append((String)o); + sb.Append("\""); } else { - output = output + o.ToString() + ", "; + sb.Append(o.ToString()); } + if(i < last) + sb.Append(","); } - output = output.Substring(0, output.Length - 2); - output = output + "]"; - return output; + sb.Append("]"); + return sb.ToString(); } public class AlphaCompare : IComparer From d1306c8976c17999337cbe1eba68f2d6dcb24e8c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 28 May 2017 02:11:40 +0100 Subject: [PATCH 03/25] a null ref check left behind on previus commits --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 92be3a38a5..7f56b6f4a4 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -2017,7 +2017,8 @@ namespace OpenSim.Framework.Servers.HttpServer try { - PollServiceRequestManager.Stop(); + if(PollServiceRequestManager != null) + PollServiceRequestManager.Stop(); m_httpListener2.ExceptionThrown -= httpServerException; //m_httpListener2.DisconnectHandler = null; From 687c01b29e0af99b770a111478516fa6634e9594 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 28 May 2017 03:17:34 +0100 Subject: [PATCH 04/25] need to delay even more agent close after teleport to compensate for slow machines and user connections. This one of current tp teleport protocol flaws --- .../Framework/EntityTransfer/EntityTransferModule.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index ca2060439a..6b8d597bb3 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -417,12 +417,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } catch (Exception e) { + m_log.ErrorFormat( "[ENTITY TRANSFER MODULE]: Exception on teleport of {0} from {1}@{2} to {3}@{4}: {5}{6}", sp.Name, sp.AbsolutePosition, sp.Scene.RegionInfo.RegionName, position, destinationRegionName, e.Message, e.StackTrace); - - sp.ControllingClient.SendTeleportFailed("Internal error"); + if(sp != null && sp.ControllingClient != null && !sp.IsDeleted) + sp.ControllingClient.SendTeleportFailed("Internal error"); } finally { @@ -1216,7 +1217,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // DECREASING THE WAIT TIME HERE WILL EITHER RESULT IN A VIEWER CRASH OR // IN THE AVIE BEING PLACED IN INFINITY FOR A COUPLE OF SECONDS. - Thread.Sleep(15000); + Thread.Sleep(25000); // if (m_eqModule != null && !sp.DoNotCloseAfterTeleport) // m_eqModule.DisableSimulator(sourceRegionHandle,sp.UUID); // Thread.Sleep(1000); From 99111e50520860477a84620b3033b4d5d6a2c750 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 28 May 2017 23:51:13 +0100 Subject: [PATCH 05/25] enclose GetRequestStream on try/catch --- OpenSim/Framework/RestClient.cs | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/OpenSim/Framework/RestClient.cs b/OpenSim/Framework/RestClient.cs index 0166d9d37e..ac394fb735 100644 --- a/OpenSim/Framework/RestClient.cs +++ b/OpenSim/Framework/RestClient.cs @@ -428,22 +428,23 @@ namespace OpenSim.Framework if (WebUtil.DebugLevel >= 5) WebUtil.LogOutgoingDetail(string.Format("SEND {0}: ", reqnum), src); - using (Stream dst = _request.GetRequestStream()) - { - m_log.Debug("[REST]: GetRequestStream is ok"); - - byte[] buf = new byte[1024]; - int length = src.Read(buf, 0, 1024); - m_log.Debug("[REST]: First Read is ok"); - while (length > 0) - { - dst.Write(buf, 0, length); - length = src.Read(buf, 0, 1024); - } - } - + try { + using (Stream dst = _request.GetRequestStream()) + { + m_log.Debug("[REST]: GetRequestStream is ok"); + + byte[] buf = new byte[1024]; + int length = src.Read(buf, 0, 1024); + m_log.Debug("[REST]: First Read is ok"); + while (length > 0) + { + dst.Write(buf, 0, length); + length = src.Read(buf, 0, 1024); + } + } + _response = (HttpWebResponse)_request.GetResponse(); } catch (WebException e) From 5274a3181ee2b3bb0668c3bd6a1b14b3109567b2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 28 May 2017 23:54:43 +0100 Subject: [PATCH 06/25] enclose GetRequestStream on try/catch --- .../Avatar/UserProfiles/UserProfileModule.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 89e30206f1..e02ca497ed 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -1839,12 +1839,12 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles webRequest.ContentType = "application/json-rpc"; webRequest.Method = "POST"; - using(Stream dataStream = webRequest.GetRequestStream()) - dataStream.Write(content,0,content.Length); - WebResponse webResponse = null; try { + using(Stream dataStream = webRequest.GetRequestStream()) + dataStream.Write(content,0,content.Length); + webResponse = webRequest.GetResponse(); } catch (WebException e) @@ -1920,12 +1920,12 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles webRequest.ContentType = "application/json-rpc"; webRequest.Method = "POST"; - using(Stream dataStream = webRequest.GetRequestStream()) - dataStream.Write(content,0,content.Length); - WebResponse webResponse = null; try { + using(Stream dataStream = webRequest.GetRequestStream()) + dataStream.Write(content,0,content.Length); + webResponse = webRequest.GetResponse(); } catch (WebException e) From d94b2e6f6d07176b995882c9033d6d9c9152f7e1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 May 2017 00:19:51 +0100 Subject: [PATCH 07/25] remove a now anoying message.. --- .../Region/CoreModules/Framework/Caps/CapabilitiesModule.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs index 292099d864..c0afe7c49d 100644 --- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs @@ -142,9 +142,9 @@ namespace OpenSim.Region.CoreModules.Framework if (capsObjectPath == oldCaps.CapsObjectPath) { - m_log.WarnFormat( - "[CAPS]: Reusing caps for agent {0} in region {1}. Old caps path {2}, new caps path {3}. ", - agentId, m_scene.RegionInfo.RegionName, oldCaps.CapsObjectPath, capsObjectPath); +// m_log.WarnFormat( +// "[CAPS]: Reusing caps for agent {0} in region {1}. Old caps path {2}, new caps path {3}. ", +// agentId, m_scene.RegionInfo.RegionName, oldCaps.CapsObjectPath, capsObjectPath); return; } else From 6d23e0bc314e90a7de9b6e077f46c358912b16fb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 May 2017 01:27:02 +0100 Subject: [PATCH 08/25] add temporary debug msgs --- .../Linden/Caps/EventQueue/EventQueueGetModule.cs | 5 +++++ .../Framework/EntityTransfer/EntityTransferModule.cs | 3 +++ 2 files changed, 8 insertions(+) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 1feece1f70..c6499cdbe8 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -512,6 +512,11 @@ namespace OpenSim.Region.ClientStack.Linden if (DebugLevel > 0) m_log.DebugFormat("{0} EnableSimulator. handle={1}, endPoint={2}, avatarID={3}", LogHeader, handle, endPoint, avatarID, regionSizeX, regionSizeY); +//debug + if(endPoint == null) + m_log.DebugFormat("EnableSimulator null endpoint"); + if(endPoint.Address == null) + m_log.DebugFormat("EnableSimulator null endpoint"); OSD item = EventQueueHelper.EnableSimulator(handle, endPoint, regionSizeX, regionSizeY); Enqueue(item, avatarID); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 6b8d597bb3..b6e9a656b7 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1489,10 +1489,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (neighbourRegion == null) { + failureReason = "no region found"; // debug -> to remove return null; } if (m_bannedRegionCache.IfBanned(neighbourRegion.RegionHandle, agentID)) { + failureReason = "Access Denied"; return null; } @@ -1511,6 +1513,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer { // remember the fail m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); + failureReason = "Access Denied"; return null; } From 2c19d084481e6a710d47ce72c357b1c1a6340531 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 May 2017 02:07:53 +0100 Subject: [PATCH 09/25] cleanup util.cs get dns --- OpenSim/Framework/Util.cs | 169 +++++++++--------- .../Caps/EventQueue/EventQueueGetModule.cs | 2 +- 2 files changed, 87 insertions(+), 84 deletions(-) diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 83d9df19bb..e3d89dc059 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -429,64 +429,6 @@ 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) { @@ -1066,38 +1008,99 @@ namespace OpenSim.Framework /// An IP address, or null public static IPAddress GetHostFromDNS(string dnsAddress) { - // Is it already a valid IP? No need to look it up. - IPAddress ipa; - if (IPAddress.TryParse(dnsAddress, out ipa)) - return ipa; - - IPAddress[] hosts = null; - - // Not an IP, lookup required + // If it is already an IP, avoid possible broken mono from seeing it + IPAddress ia = null; + if (IPAddress.TryParse(dnsAddress, out ia) && ia != null) + { + if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any)) + return null; + return ia; + } + // Reset for next check + ia = null; try { - hosts = Dns.GetHostEntry(dnsAddress).AddressList; - } - catch (Exception e) - { - m_log.WarnFormat("[UTIL]: An error occurred while resolving host name {0}, {1}", dnsAddress, e); - - // Still going to throw the exception on for now, since this was what was happening in the first place - throw e; - } - - foreach (IPAddress host in hosts) - { - if (host.AddressFamily == AddressFamily.InterNetwork) + foreach (IPAddress Adr in Dns.GetHostAddresses(dnsAddress)) { - return host; + 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 ia; + } - if (hosts.Length > 0) - return hosts[0]; + public static IPEndPoint getEndPoint(IPAddress ia, int port) + { + if(ia == null) + return 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, avoid possible broken mono from seeing it + if (IPAddress.TryParse(hostname, out ia) && ia != null) + { + 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 Uri GetURI(string protocol, string hostname, int port, string path) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index c6499cdbe8..50543269c2 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -516,7 +516,7 @@ namespace OpenSim.Region.ClientStack.Linden if(endPoint == null) m_log.DebugFormat("EnableSimulator null endpoint"); if(endPoint.Address == null) - m_log.DebugFormat("EnableSimulator null endpoint"); + m_log.DebugFormat("EnableSimulator null endpoint address"); OSD item = EventQueueHelper.EnableSimulator(handle, endPoint, regionSizeX, regionSizeY); Enqueue(item, avatarID); From 27afe136d4ef1cf700802cc4d719156f0445f2b4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 May 2017 03:13:56 +0100 Subject: [PATCH 10/25] mono is a total crap --- OpenSim/Framework/Util.cs | 41 ++++++++++--------- .../Caps/EventQueue/EventQueueGetModule.cs | 5 --- .../EntityTransfer/EntityTransferModule.cs | 10 ++++- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index e3d89dc059..3ddeafbb4f 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1064,6 +1064,9 @@ namespace OpenSim.Framework public static IPEndPoint getEndPoint(string hostname, int port) { + if(String.IsNullOrWhiteSpace(hostname)) + return null; + IPAddress ia = null; // If it is already an IP, avoid possible broken mono from seeing it if (IPAddress.TryParse(hostname, out ia) && ia != null) @@ -1075,31 +1078,31 @@ namespace OpenSim.Framework // Reset for next check ia = null; - try +#if (_MONO) + // mono is a TOTAL CRAP + int retry = 3; + while(ia == null && retry-- >= 0) +#endif { - foreach (IPAddress Adr in Dns.GetHostAddresses(hostname)) + try { - if (ia == null) - ia = Adr; - - if (Adr.AddressFamily == AddressFamily.InterNetwork) + foreach (IPAddress Adr in Dns.GetHostAddresses(hostname)) { - ia = Adr; - break; + if (ia == null) + ia = Adr; + + if (Adr.AddressFamily == AddressFamily.InterNetwork) + { + ia = Adr; + break; + } } } + catch // (SocketException e) + { + ia = null; + } } - 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); } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 50543269c2..1feece1f70 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs @@ -512,11 +512,6 @@ namespace OpenSim.Region.ClientStack.Linden if (DebugLevel > 0) m_log.DebugFormat("{0} EnableSimulator. handle={1}, endPoint={2}, avatarID={3}", LogHeader, handle, endPoint, avatarID, regionSizeX, regionSizeY); -//debug - if(endPoint == null) - m_log.DebugFormat("EnableSimulator null endpoint"); - if(endPoint.Address == null) - m_log.DebugFormat("EnableSimulator null endpoint address"); OSD item = EventQueueHelper.EnableSimulator(handle, endPoint, regionSizeX, regionSizeY); Enqueue(item, avatarID); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index b6e9a656b7..0505e586a7 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -2157,6 +2157,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer { Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start int count = 0; + IPEndPoint ipe; foreach (GridRegion neighbour in neighbours) { @@ -2165,8 +2166,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer { if (newneighbours.Contains(handler)) { - InformClientOfNeighbourAsync(sp, cagents[count], neighbour, - neighbour.ExternalEndPoint, true); + ipe = neighbour.ExternalEndPoint; + if (ipe != null) + InformClientOfNeighbourAsync(sp, cagents[count], neighbour, ipe, true); + else + { + m_log.Debug("[ENTITY TRANSFER MODULE]: DNS for neighbour lost"); + } count++; } else if (!previousRegionNeighbourHandles.Contains(handler)) From 7be6e16555a25177128f6767661387cdffe084cc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 May 2017 03:41:09 +0100 Subject: [PATCH 11/25] no.. still a fail --- OpenSim/Framework/Util.cs | 32 ++++++++----------- .../EntityTransfer/EntityTransferModule.cs | 2 +- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 3ddeafbb4f..fe8449884f 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1078,31 +1078,25 @@ namespace OpenSim.Framework // Reset for next check ia = null; -#if (_MONO) - // mono is a TOTAL CRAP - int retry = 3; - while(ia == null && retry-- >= 0) -#endif + try { - try + foreach (IPAddress Adr in Dns.GetHostAddresses(hostname)) { - foreach (IPAddress Adr in Dns.GetHostAddresses(hostname)) - { - if (ia == null) - ia = Adr; + if (ia == null) + ia = Adr; - if (Adr.AddressFamily == AddressFamily.InterNetwork) - { - ia = Adr; - break; - } + if (Adr.AddressFamily == AddressFamily.InterNetwork) + { + ia = Adr; + break; } } - catch // (SocketException e) - { - ia = null; - } } + catch // (SocketException e) + { + ia = null; + } + return getEndPoint(ia,port); } diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 0505e586a7..9959f6e606 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -2171,7 +2171,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer InformClientOfNeighbourAsync(sp, cagents[count], neighbour, ipe, true); else { - m_log.Debug("[ENTITY TRANSFER MODULE]: DNS for neighbour lost"); + m_log.DebugFormat("[ENTITY TRANSFER MODULE]: DNS for neighbour {0} lost", neighbour.ExternalHostName); } count++; } From 8f86de265c6187a61dde12fb122c1ae017b6ecf6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 May 2017 05:22:21 +0100 Subject: [PATCH 12/25] some cleanup and assume Linux/mono DNS is just broken... --- OpenSim/Framework/Util.cs | 76 ++++++++++--------- .../EntityTransfer/EntityTransferModule.cs | 15 ++-- .../Hypergrid/UserAgentServiceConnector.cs | 11 ++- 3 files changed, 57 insertions(+), 45 deletions(-) diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index fe8449884f..061743d1b6 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1009,6 +1009,9 @@ namespace OpenSim.Framework public static IPAddress GetHostFromDNS(string dnsAddress) { // If it is already an IP, avoid possible broken mono from seeing it + if(String.IsNullOrWhiteSpace(dnsAddress)) + return null; + IPAddress ia = null; if (IPAddress.TryParse(dnsAddress, out ia) && ia != null) { @@ -1016,31 +1019,31 @@ namespace OpenSim.Framework return null; return ia; } - // Reset for next check - ia = null; + + IPHostEntry IPH; try { - foreach (IPAddress Adr in Dns.GetHostAddresses(dnsAddress)) - { - if (ia == null) - ia = Adr; - - if (Adr.AddressFamily == AddressFamily.InterNetwork) - { - ia = Adr; - break; - } - } + IPH = Dns.GetHostEntry(dnsAddress); } 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(IPH == null || IPH.AddressList.Length == 0) return null; + + ia = null; + foreach (IPAddress Adr in IPH.AddressList) + { + if (ia == null) + ia = Adr; + + if (Adr.AddressFamily == AddressFamily.InterNetwork) + { + ia = Adr; + break; + } } return ia; } @@ -1075,26 +1078,31 @@ namespace OpenSim.Framework return null; return getEndPoint(ia, port); } - - // Reset for next check - ia = null; + + IPHostEntry IPH; try { - foreach (IPAddress Adr in Dns.GetHostAddresses(hostname)) - { - if (ia == null) - ia = Adr; - - if (Adr.AddressFamily == AddressFamily.InterNetwork) - { - ia = Adr; - break; - } - } + IPH = Dns.GetHostEntry(hostname); } catch // (SocketException e) { - ia = null; + return null; + } + + if(IPH == null || IPH.AddressList.Length == 0) + return null; + + ia = null; + foreach (IPAddress Adr in IPH.AddressList) + { + if (ia == null) + ia = Adr; + + if (Adr.AddressFamily == AddressFamily.InterNetwork) + { + ia = Adr; + break; + } } return getEndPoint(ia,port); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 9959f6e606..7214414b22 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -157,7 +157,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_idCache = new ExpiringCache(); m_bannedRegions.Add(pAgentID, m_idCache, TimeSpan.FromSeconds(newTime)); } - m_idCache.Add(pRegionHandle, DateTime.UtcNow + TimeSpan.FromSeconds(extendTime), TimeSpan.FromSeconds(extendTime)); + m_idCache.Add(pRegionHandle, DateTime.UtcNow + TimeSpan.FromSeconds(extendTime), extendTime); } // Remove the agent from the region's banned list @@ -1488,13 +1488,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer Math.Max(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY)); if (neighbourRegion == null) - { - failureReason = "no region found"; // debug -> to remove return null; - } + if (m_bannedRegionCache.IfBanned(neighbourRegion.RegionHandle, agentID)) { - failureReason = "Access Denied"; + failureReason = "Access Denied or Temporary not possible"; return null; } @@ -1506,14 +1504,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer pos.Z); string homeURI = scene.GetAgentHomeURI(agentID); - + if (!scene.SimulationService.QueryAccess( neighbourRegion, agentID, homeURI, false, newpos, scene.GetFormatsOffered(), ctx, out failureReason)) { // remember the fail m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); - failureReason = "Access Denied"; + if(String.IsNullOrWhiteSpace(failureReason)) + failureReason = "Access Denied"; return null; } @@ -2171,7 +2170,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer InformClientOfNeighbourAsync(sp, cagents[count], neighbour, ipe, true); else { - m_log.DebugFormat("[ENTITY TRANSFER MODULE]: DNS for neighbour {0} lost", neighbour.ExternalHostName); + m_log.DebugFormat("[ENTITY TRANSFER MODULE]: lost DNS resolution for neighbour {0}", neighbour.ExternalHostName); } count++; } diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index b261675572..f2bb52aa4d 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -70,9 +70,14 @@ namespace OpenSim.Services.Connectors.Hypergrid { Uri m_Uri = new Uri(m_ServerURL); IPAddress ip = Util.GetHostFromDNS(m_Uri.Host); - m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); - if (!m_ServerURL.EndsWith("/")) - m_ServerURL += "/"; + if(ip != null) + { + m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); + if (!m_ServerURL.EndsWith("/")) + m_ServerURL += "/"; + } + else + m_log.DebugFormat("[USER AGENT CONNECTOR]: Failed to resolv address of {0}", url); } catch (Exception e) { From 0f0673552c001cb7a47f77ea80377bd6464f1fac Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 May 2017 06:50:55 +0100 Subject: [PATCH 13/25] remove a unnecessary dns check --- .../Connectors/Simulation/SimulationServiceConnector.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 9f4d89ab6f..a4ca2d3ecb 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -295,9 +295,6 @@ namespace OpenSim.Services.Connectors.Simulation // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); - IPEndPoint ext = destination.ExternalEndPoint; - if (ext == null) return false; - // Eventually, we want to use a caps url instead of the agentID string uri = destination.ServerURI + AgentPath() + agentID + "/" + destination.RegionID.ToString() + "/"; From a317bba8cf4783b9f664c4b4bc9974eedbca6feb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 May 2017 07:11:13 +0100 Subject: [PATCH 14/25] cache endpoints (and other paths) dns requests for 5min, this delay should be acceptable in all cases ? --- OpenSim/Framework/Util.cs | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 061743d1b6..a3c77508d1 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -991,6 +991,8 @@ namespace OpenSim.Framework return output.ToString(); } + static ExpiringCache dnscache = new ExpiringCache(); + /// /// Converts a URL to a IPAddress /// @@ -1008,15 +1010,20 @@ namespace OpenSim.Framework /// An IP address, or null public static IPAddress GetHostFromDNS(string dnsAddress) { - // If it is already an IP, avoid possible broken mono from seeing it if(String.IsNullOrWhiteSpace(dnsAddress)) return null; IPAddress ia = null; + if(dnscache.TryGetValue(dnsAddress, out ia) && ia != null) + return ia; + + ia = null; + // If it is already an IP, don't let GetHostEntry see it if (IPAddress.TryParse(dnsAddress, out ia) && ia != null) { if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any)) return null; + dnscache.AddOrUpdate(dnsAddress, ia, 300); return ia; } @@ -1027,7 +1034,7 @@ namespace OpenSim.Framework } catch // (SocketException e) { - return null; + return null; } if(IPH == null || IPH.AddressList.Length == 0) @@ -1045,6 +1052,8 @@ namespace OpenSim.Framework break; } } + if(ia != null) + dnscache.AddOrUpdate(dnsAddress, ia, 300); return ia; } @@ -1071,14 +1080,22 @@ namespace OpenSim.Framework return null; IPAddress ia = null; - // If it is already an IP, avoid possible broken mono from seeing it + if(dnscache.TryGetValue(hostname, out ia) && ia != null) + return getEndPoint(ia, port); + + ia = null; + + // If it is already an IP, don't let GetHostEntry see it if (IPAddress.TryParse(hostname, out ia) && ia != null) { if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any)) return null; + + dnscache.AddOrUpdate(hostname, ia, 300); return getEndPoint(ia, port); } - + + IPHostEntry IPH; try { @@ -1086,7 +1103,7 @@ namespace OpenSim.Framework } catch // (SocketException e) { - return null; + return null; } if(IPH == null || IPH.AddressList.Length == 0) @@ -1105,6 +1122,9 @@ namespace OpenSim.Framework } } + if(ia != null) + dnscache.AddOrUpdate(hostname, ia, 300); + return getEndPoint(ia,port); } From 91caf98308e4a5f371f9a25adfb4084ff5bfbc34 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 May 2017 07:48:09 +0100 Subject: [PATCH 15/25] change servicePoint dns expire also to 5min, let the endpoints expire slide. This should reduce impact of absurd dns fails observed on my test ubuntu VM --- OpenSim/Framework/Util.cs | 8 +++++++- OpenSim/Region/Application/Application.cs | 3 +-- OpenSim/Server/ServerMain.cs | 3 +-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index a3c77508d1..f52a84c2e0 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -991,7 +991,7 @@ namespace OpenSim.Framework return output.ToString(); } - static ExpiringCache dnscache = new ExpiringCache(); + private static ExpiringCache dnscache = new ExpiringCache(); /// /// Converts a URL to a IPAddress @@ -1015,7 +1015,10 @@ namespace OpenSim.Framework IPAddress ia = null; if(dnscache.TryGetValue(dnsAddress, out ia) && ia != null) + { + dnscache.AddOrUpdate(dnsAddress, ia, 300); return ia; + } ia = null; // If it is already an IP, don't let GetHostEntry see it @@ -1081,7 +1084,10 @@ namespace OpenSim.Framework IPAddress ia = null; if(dnscache.TryGetValue(hostname, out ia) && ia != null) + { + dnscache.AddOrUpdate(hostname, ia, 300); return getEndPoint(ia, port); + } ia = null; diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index 447afb4654..66ce8e5e3d 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -79,10 +79,9 @@ namespace OpenSim else { ServicePointManager.DefaultConnectionLimit = 12; - try { ServicePointManager.DnsRefreshTimeout = 120000; } // just is case some crazy mono decides to have it infinity - catch { } } + try { ServicePointManager.DnsRefreshTimeout = 300000; } catch { } ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index accf9385ff..69d0b74d0d 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -59,8 +59,7 @@ namespace OpenSim.Server ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; - try { ServicePointManager.DnsRefreshTimeout = 120000; } // just is case some mono decides to have it infinity - catch { } + try { ServicePointManager.DnsRefreshTimeout = 300000; } catch { } m_Server = new HttpServerBase("R.O.B.U.S.T.", args); From e5bebe3a3215bac1d5d54602ded7859860470aa0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 May 2017 08:20:58 +0100 Subject: [PATCH 16/25] webrequests serialiazation per endpoint its now ServicePointManager job --- OpenSim/Framework/Servers/ServerBase.cs | 48 +-------------------- OpenSim/Framework/WebUtil.cs | 55 +------------------------ 2 files changed, 2 insertions(+), 101 deletions(-) diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index f627ae61ee..3bb2313023 100644 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs @@ -274,18 +274,6 @@ namespace OpenSim.Framework.Servers "Show thread status. Synonym for \"show threads\"", (string module, string[] args) => Notice(GetThreadsReport())); - m_console.Commands.AddCommand ( - "Debug", false, "debug comms set", - "debug comms set serialosdreq true|false", - "Set comms parameters. For debug purposes.", - HandleDebugCommsSet); - - m_console.Commands.AddCommand ( - "Debug", false, "debug comms status", - "debug comms status", - "Show current debug comms parameters.", - HandleDebugCommsStatus); - m_console.Commands.AddCommand ( "Debug", false, "debug threadpool set", "debug threadpool set worker|iocp min|max ", @@ -343,47 +331,13 @@ namespace OpenSim.Framework.Servers public void RegisterCommonComponents(IConfigSource configSource) { - IConfig networkConfig = configSource.Configs["Network"]; - - if (networkConfig != null) - { - WebUtil.SerializeOSDRequestsPerEndpoint = networkConfig.GetBoolean("SerializeOSDRequests", false); - } +// IConfig networkConfig = configSource.Configs["Network"]; m_serverStatsCollector = new ServerStatsCollector(); m_serverStatsCollector.Initialise(configSource); m_serverStatsCollector.Start(); } - private void HandleDebugCommsStatus(string module, string[] args) - { - Notice("serialosdreq is {0}", WebUtil.SerializeOSDRequestsPerEndpoint); - } - - private void HandleDebugCommsSet(string module, string[] args) - { - if (args.Length != 5) - { - Notice("Usage: debug comms set serialosdreq true|false"); - return; - } - - if (args[3] != "serialosdreq") - { - Notice("Usage: debug comms set serialosdreq true|false"); - return; - } - - bool setSerializeOsdRequests; - - if (!ConsoleUtil.TryParseConsoleBool(m_console, args[4], out setSerializeOsdRequests)) - return; - - WebUtil.SerializeOSDRequestsPerEndpoint = setSerializeOsdRequests; - - Notice("serialosdreq is now {0}", setSerializeOsdRequests); - } - private void HandleShowThreadpoolCallsActive(string module, string[] args) { List> calls = Util.GetFireAndForgetCallsInProgress().ToList(); diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 12f58feb79..7b085d0ac1 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -71,11 +71,6 @@ namespace OpenSim.Framework /// public static int RequestNumber { get; set; } - /// - /// Control where OSD requests should be serialized per endpoint. - /// - public static bool SerializeOSDRequestsPerEndpoint { get; set; } - /// /// this is the header field used to communicate the local request id /// used for performance and debugging @@ -98,31 +93,6 @@ namespace OpenSim.Framework /// public const int MaxRequestDiagLength = 200; - /// - /// Dictionary of end points - /// - private static Dictionary m_endpointSerializer = new Dictionary(); - - private static object EndPointLock(string url) - { - System.Uri uri = new System.Uri(url); - string endpoint = string.Format("{0}:{1}",uri.Host,uri.Port); - - lock (m_endpointSerializer) - { - object eplock = null; - - if (! m_endpointSerializer.TryGetValue(endpoint,out eplock)) - { - eplock = new object(); - m_endpointSerializer.Add(endpoint,eplock); - // m_log.WarnFormat("[WEB UTIL] add a new host to end point serializer {0}",endpoint); - } - - return eplock; - } - } - #region JSONRequest /// @@ -154,21 +124,6 @@ namespace OpenSim.Framework return ServiceOSDRequest(url, null, "GET", timeout, false, false); } - public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc) - { - if (SerializeOSDRequestsPerEndpoint) - { - lock (EndPointLock(url)) - { - return ServiceOSDRequestWorker(url, data, method, timeout, compressed, rpc); - } - } - else - { - return ServiceOSDRequestWorker(url, data, method, timeout, compressed, rpc); - } - } - public static void LogOutgoingDetail(Stream outputStream) { LogOutgoingDetail("", outputStream); @@ -222,7 +177,7 @@ namespace OpenSim.Framework LogOutgoingDetail(string.Format("RESPONSE {0}: ", reqnum), input); } - private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc) + public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc) { int reqnum = RequestNumber++; @@ -421,14 +376,6 @@ namespace OpenSim.Framework } public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) - { - lock (EndPointLock(url)) - { - return ServiceFormRequestWorker(url,data,timeout); - } - } - - private static OSDMap ServiceFormRequestWorker(string url, NameValueCollection data, int timeout) { int reqnum = RequestNumber++; string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown"; From 90da5280af1ade789e6a9d5c71f4d193dac59c33 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 May 2017 09:01:39 +0100 Subject: [PATCH 17/25] put back soft http close --- .../Servers/HttpServer/PollServiceRequestManager.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index bd1c040774..c6a3e65154 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -194,7 +194,6 @@ namespace OpenSim.Framework.Servers.HttpServer qu.Clear(); m_bycontext.Clear(); -/* try { foreach (PollServiceHttpRequest req in m_retryRequests) @@ -207,22 +206,21 @@ namespace OpenSim.Framework.Servers.HttpServer } PollServiceHttpRequest wreq; -*/ + m_retryRequests.Clear(); -/* + while (m_requests.Count() > 0) { try { wreq = m_requests.Dequeue(0); wreq.DoHTTPstop(m_server); - } catch { } } -*/ + m_requests.Clear(); } @@ -232,7 +230,7 @@ namespace OpenSim.Framework.Servers.HttpServer { while (m_running) { - PollServiceHttpRequest req = m_requests.Dequeue(5000); + PollServiceHttpRequest req = m_requests.Dequeue(4500); Watchdog.UpdateThread(); if (req != null) { From 79b2926ce116a714eca7609eb409f93c504f0b71 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 May 2017 15:34:22 +0100 Subject: [PATCH 18/25] do another dns request via new cache. My problems bf wheren't mono after all, but ubuntu systemd.resolver and google public dns, killing one and not using other did improve dns a lot --- .../Scripting/LSLHttp/UrlModule.cs | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 895020c791..11fc513e0d 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs @@ -35,6 +35,7 @@ using log4net; using Mono.Addins; using Nini.Config; using OpenMetaverse; +using OpenSim.Framework; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; @@ -146,23 +147,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp } IPAddress ia = null; - try - { - foreach (IPAddress Adr in Dns.GetHostAddresses(ExternalHostNameForLSL)) - { - if (Adr.AddressFamily == AddressFamily.InterNetwork || - Adr.AddressFamily == AddressFamily.InterNetworkV6) // ipv6 will most likely smoke - { - ia = Adr; - break; - } - } - } - catch - { - ia = null; - } - + ia = Util.GetHostFromDNS(ExternalHostNameForLSL); if (ia == null) { m_ErrorStr = "Could not resolve ExternalHostNameForLSL, HTTP listener for LSL disabled"; From 0fa3af96a421aa64480d97f103c4ca15c045c89b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 May 2017 16:51:49 +0100 Subject: [PATCH 19/25] remove anoying crossing messages on open borders --- .../Framework/EntityTransfer/EntityTransferModule.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 7214414b22..a1ada4c3a6 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1532,13 +1532,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer CrossAsyncDelegate icon = (CrossAsyncDelegate)iar.AsyncState; ScenePresence agent = icon.EndInvoke(iar); - m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); if(!agent.IsChildAgent) { // crossing failed agent.CrossToNewRegionFail(); } + else + m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); + agent.IsInTransit = false; } @@ -2287,9 +2289,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py, uint pSizeHint) { - m_log.DebugFormat("{0} GetRegionContainingWorldLocation: call, XY=<{1},{2}>", LogHeader, px, py); +// m_log.DebugFormat("{0} GetRegionContainingWorldLocation: call, XY=<{1},{2}>", LogHeader, px, py); GridRegion ret = null; - const double fudge = 2.0; if (m_notFoundLocationCache.Contains(px, py)) { From e5991124dda62bd5bc4bce2cc5b2241ea2ef65f0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 31 May 2017 01:29:38 +0100 Subject: [PATCH 20/25] merge LocalNeighbourServicesConnector and RemoteNeighbourServicesConnector in single NeighbourServicesOutConnector --- ...tor.cs => NeighbourServiceOutConnector.cs} | 79 ++++----- .../RemoteNeighourServiceConnector.cs | 157 ------------------ bin/config-include/Grid.ini | 2 +- bin/config-include/GridHypergrid.ini | 2 +- bin/config-include/HyperSimianGrid.ini | 2 +- bin/config-include/SimianGrid.ini | 2 +- bin/config-include/Standalone.ini | 2 +- bin/config-include/StandaloneHypergrid.ini | 2 +- 8 files changed, 40 insertions(+), 208 deletions(-) rename OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/{LocalNeighbourServiceConnector.cs => NeighbourServiceOutConnector.cs} (72%) delete mode 100644 OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/NeighbourServiceOutConnector.cs similarity index 72% rename from OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs rename to OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/NeighbourServiceOutConnector.cs index e8d01b01c1..60addec12c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/NeighbourServiceOutConnector.cs @@ -25,44 +25,32 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.Reflection; using log4net; using Mono.Addins; +using System; +using System.Reflection; +using System.Collections.Generic; using Nini.Config; -using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Server.Base; +using OpenSim.Services.Connectors; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; + namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalNeighbourServicesConnector")] - public class LocalNeighbourServicesConnector : - ISharedRegionModule, INeighbourService + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "NeighbourServicesOutConnector")] + public class NeighbourServicesOutConnector : + NeighbourServicesConnector, ISharedRegionModule, INeighbourService { private static readonly ILog m_log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); private List m_Scenes = new List(); - private bool m_Enabled = false; - public LocalNeighbourServicesConnector() - { - } - - public LocalNeighbourServicesConnector(List scenes) - { - m_Scenes = scenes; - } - - #region ISharedRegionModule - public Type ReplaceableInterface { get { return null; } @@ -70,7 +58,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour public string Name { - get { return "LocalNeighbourServicesConnector"; } + get { return "NeighbourServicesOutConnector"; } } public void Initialise(IConfigSource source) @@ -78,39 +66,32 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour IConfig moduleConfig = source.Configs["Modules"]; if (moduleConfig != null) { - string name = moduleConfig.GetString("NeighbourServices", this.Name); + string name = moduleConfig.GetString("NeighbourServices"); if (name == Name) { - // m_Enabled rules whether this module registers as INeighbourService or not m_Enabled = true; - m_log.Info("[NEIGHBOUR CONNECTOR]: Local neighbour connector enabled"); + m_log.Info("[NEIGHBOUR CONNECTOR]: Neighbour out connector enabled"); } } } + public void PostInitialise() + { + } + public void Close() { } public void AddRegion(Scene scene) { - m_Scenes.Add(scene); - if (!m_Enabled) return; + m_Scenes.Add(scene); scene.RegisterModuleInterface(this); } - public void RegionLoaded(Scene scene) - { - m_log.Info("[NEIGHBOUR CONNECTOR]: Local neighbour connector enabled for region " + scene.RegionInfo.RegionName); - } - - public void PostInitialise() - { - } - public void RemoveRegion(Scene scene) { // Always remove @@ -118,28 +99,36 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour m_Scenes.Remove(scene); } - #endregion ISharedRegionModule + public void RegionLoaded(Scene scene) + { + if (!m_Enabled) + return; + + m_GridService = scene.GridService; + m_log.InfoFormat("[NEIGHBOUR CONNECTOR]: Enabled out neighbours for region {0}", scene.RegionInfo.RegionName); + + } #region INeighbourService - public OpenSim.Services.Interfaces.GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) + public override GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) { - uint x, y; - Util.RegionHandleToRegionLoc(regionHandle, out x, out y); + if (!m_Enabled) + return null; foreach (Scene s in m_Scenes) { if (s.RegionInfo.RegionHandle == regionHandle) { - m_log.DebugFormat("[LOCAL NEIGHBOUR SERVICE CONNECTOR]: HelloNeighbour from region {0} to neighbour {1} at {2}-{3}", - thisRegion.RegionName, s.Name, x, y ); - - //m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour"); +// uint x, y; +// Util.RegionHandleToRegionLoc(regionHandle, out x, out y); +// m_log.DebugFormat("[NEIGHBOUR SERVICE OUT CONNECTOR]: HelloNeighbour from region {0} to neighbour {1} at {2}-{3}", +// thisRegion.RegionName, s.Name, x, y ); return s.IncomingHelloNeighbour(thisRegion); } } - //m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: region handle {0} not found", regionHandle); - return null; + + return base.HelloNeighbour(regionHandle, thisRegion); } #endregion INeighbourService diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs deleted file mode 100644 index fcb55216ec..0000000000 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using log4net; -using Mono.Addins; -using System; -using System.Collections.Generic; -using System.Reflection; -using Nini.Config; -using OpenSim.Framework; -using OpenSim.Services.Connectors; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Services.Interfaces; -using OpenSim.Server.Base; - -namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour -{ - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteNeighbourServicesConnector")] - public class RemoteNeighbourServicesConnector : - NeighbourServicesConnector, ISharedRegionModule, INeighbourService - { - private static readonly ILog m_log = - LogManager.GetLogger( - MethodBase.GetCurrentMethod().DeclaringType); - - private bool m_Enabled = false; - private LocalNeighbourServicesConnector m_LocalService; - //private string serviceDll; - //private List m_Scenes = new List(); - - public Type ReplaceableInterface - { - get { return null; } - } - - public string Name - { - get { return "RemoteNeighbourServicesConnector"; } - } - - public void Initialise(IConfigSource source) - { - IConfig moduleConfig = source.Configs["Modules"]; - if (moduleConfig != null) - { - string name = moduleConfig.GetString("NeighbourServices"); - if (name == Name) - { - m_LocalService = new LocalNeighbourServicesConnector(); - - //IConfig neighbourConfig = source.Configs["NeighbourService"]; - //if (neighbourConfig == null) - //{ - // m_log.Error("[NEIGHBOUR CONNECTOR]: NeighbourService missing from OpenSim.ini"); - // return; - //} - //serviceDll = neighbourConfig.GetString("LocalServiceModule", String.Empty); - //if (serviceDll == String.Empty) - //{ - // m_log.Error("[NEIGHBOUR CONNECTOR]: No LocalServiceModule named in section NeighbourService"); - // return; - //} - - m_Enabled = true; - - m_log.Info("[NEIGHBOUR CONNECTOR]: Remote Neighbour connector enabled"); - } - } - } - - public void PostInitialise() - { - //if (m_Enabled) - //{ - // Object[] args = new Object[] { m_Scenes }; - // m_LocalService = - // ServerUtils.LoadPlugin(serviceDll, - // args); - - // if (m_LocalService == null) - // { - // m_log.Error("[NEIGHBOUR CONNECTOR]: Can't load neighbour service"); - // Unregister(); - // return; - // } - //} - } - - public void Close() - { - } - - public void AddRegion(Scene scene) - { - if (!m_Enabled) - return; - - m_LocalService.AddRegion(scene); - scene.RegisterModuleInterface(this); - } - - public void RemoveRegion(Scene scene) - { - if (m_Enabled) - m_LocalService.RemoveRegion(scene); - } - - public void RegionLoaded(Scene scene) - { - if (!m_Enabled) - return; - - m_GridService = scene.GridService; - - m_log.InfoFormat("[NEIGHBOUR CONNECTOR]: Enabled remote neighbours for region {0}", scene.RegionInfo.RegionName); - - } - - #region INeighbourService - - public override GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) - { - GridRegion region = m_LocalService.HelloNeighbour(regionHandle, thisRegion); - if (region != null) - return region; - - return base.HelloNeighbour(regionHandle, thisRegion); - } - - #endregion INeighbourService - } -} diff --git a/bin/config-include/Grid.ini b/bin/config-include/Grid.ini index fc988792b4..988e681a00 100644 --- a/bin/config-include/Grid.ini +++ b/bin/config-include/Grid.ini @@ -12,7 +12,7 @@ InventoryServices = "RemoteXInventoryServicesConnector" GridServices = "RemoteGridServicesConnector" AvatarServices = "RemoteAvatarServicesConnector" - NeighbourServices = "RemoteNeighbourServicesConnector" + NeighbourServices = "NeighbourServicesOutConnector" AuthenticationServices = "RemoteAuthenticationServicesConnector" AuthorizationServices = "LocalAuthorizationServicesConnector" PresenceServices = "RemotePresenceServicesConnector" diff --git a/bin/config-include/GridHypergrid.ini b/bin/config-include/GridHypergrid.ini index f5f4c8755f..68f2eb1d41 100644 --- a/bin/config-include/GridHypergrid.ini +++ b/bin/config-include/GridHypergrid.ini @@ -15,7 +15,7 @@ InventoryServices = "HGInventoryBroker" GridServices = "RemoteGridServicesConnector" AvatarServices = "RemoteAvatarServicesConnector" - NeighbourServices = "RemoteNeighbourServicesConnector" + NeighbourServices = "NeighbourServicesOutConnector" AuthenticationServices = "RemoteAuthenticationServicesConnector" AuthorizationServices = "LocalAuthorizationServicesConnector" PresenceServices = "RemotePresenceServicesConnector" diff --git a/bin/config-include/HyperSimianGrid.ini b/bin/config-include/HyperSimianGrid.ini index efad5772a3..018c65e92c 100644 --- a/bin/config-include/HyperSimianGrid.ini +++ b/bin/config-include/HyperSimianGrid.ini @@ -29,7 +29,7 @@ InventoryServices = "HGInventoryBroker" AvatarServices = "SimianAvatarServiceConnector" - NeighbourServices = "RemoteNeighbourServicesConnector" + NeighbourServices = "NeighbourServicesOutConnector" SimulationServices = "RemoteSimulationConnectorModule" EntityTransferModule = "HGEntityTransferModule" InventoryAccessModule = "HGInventoryAccessModule" diff --git a/bin/config-include/SimianGrid.ini b/bin/config-include/SimianGrid.ini index 5749656231..b3db08a598 100644 --- a/bin/config-include/SimianGrid.ini +++ b/bin/config-include/SimianGrid.ini @@ -29,7 +29,7 @@ InventoryServices = "SimianInventoryServiceConnector" AvatarServices = "SimianAvatarServiceConnector" - NeighbourServices = "RemoteNeighbourServicesConnector" + NeighbourServices = "NeighbourServicesOutConnector" SimulationServices = "RemoteSimulationConnectorModule" EntityTransferModule = "BasicEntityTransferModule" InventoryAccessModule = "BasicInventoryAccessModule" diff --git a/bin/config-include/Standalone.ini b/bin/config-include/Standalone.ini index 78ada2b7c3..db7cb365cd 100644 --- a/bin/config-include/Standalone.ini +++ b/bin/config-include/Standalone.ini @@ -7,7 +7,7 @@ [Modules] AssetServices = "LocalAssetServicesConnector" InventoryServices = "LocalInventoryServicesConnector" - NeighbourServices = "LocalNeighbourServicesConnector" + NeighbourServices = "NeighbourServicesOutConnector" AuthenticationServices = "LocalAuthenticationServicesConnector" AuthorizationServices = "LocalAuthorizationServicesConnector" GridServices = "LocalGridServicesConnector" diff --git a/bin/config-include/StandaloneHypergrid.ini b/bin/config-include/StandaloneHypergrid.ini index eaacfff36a..84867a9a3c 100644 --- a/bin/config-include/StandaloneHypergrid.ini +++ b/bin/config-include/StandaloneHypergrid.ini @@ -10,7 +10,7 @@ [Modules] AssetServices = "HGAssetBroker" InventoryServices = "HGInventoryBroker" - NeighbourServices = "LocalNeighbourServicesConnector" + NeighbourServices = "NeighbourServicesOutConnector" AuthenticationServices = "LocalAuthenticationServicesConnector" AuthorizationServices = "LocalAuthorizationServicesConnector" GridServices = "LocalGridServicesConnector" From b1c585718c65b709f26fd7d7d55a1ff6223a3ec3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 31 May 2017 04:30:00 +0100 Subject: [PATCH 21/25] remove debug messages --- OpenSim/Framework/RestClient.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/RestClient.cs b/OpenSim/Framework/RestClient.cs index ac394fb735..4939cf7bfd 100644 --- a/OpenSim/Framework/RestClient.cs +++ b/OpenSim/Framework/RestClient.cs @@ -433,11 +433,11 @@ namespace OpenSim.Framework { using (Stream dst = _request.GetRequestStream()) { - m_log.Debug("[REST]: GetRequestStream is ok"); +// m_log.Debug("[REST]: GetRequestStream is ok"); byte[] buf = new byte[1024]; int length = src.Read(buf, 0, 1024); - m_log.Debug("[REST]: First Read is ok"); +// m_log.Debug("[REST]: First Read is ok"); while (length > 0) { dst.Write(buf, 0, length); From 720a69a49bf02208ea2763a043056aba00a676e5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 31 May 2017 04:47:59 +0100 Subject: [PATCH 22/25] remove the option to store baked textures on assets service, thats suicide use xbakes --- .../UploadBakedTextureHandler.cs | 21 +-- .../UploadBakedTextureServerConnector.cs | 2 +- .../Linden/Caps/UploadBakedTextureModule.cs | 155 +----------------- .../AvatarFactory/AvatarFactoryModule.cs | 38 ++--- 4 files changed, 24 insertions(+), 192 deletions(-) diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs index 80b83069e2..f90c7e7809 100644 --- a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs @@ -26,24 +26,12 @@ */ using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.Drawing; -using System.Drawing.Imaging; using System.Reflection; -using System.IO; -using System.Web; using log4net; -using Nini.Config; using OpenMetaverse; -using OpenMetaverse.StructuredData; -using OpenMetaverse.Imaging; using OpenSim.Framework; using OpenSim.Framework.Capabilities; -using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Region.Framework.Interfaces; using OpenSim.Services.Interfaces; using Caps = OpenSim.Framework.Capabilities.Caps; @@ -56,13 +44,11 @@ namespace OpenSim.Capabilities.Handlers private Caps m_HostCapsObj; private IAssetService m_assetService; - private bool m_persistBakedTextures; - public UploadBakedTextureHandler(Caps caps, IAssetService assetService, bool persistBakedTextures) + public UploadBakedTextureHandler(Caps caps, IAssetService assetService) { m_HostCapsObj = caps; m_assetService = assetService; - m_persistBakedTextures = persistBakedTextures; } /// @@ -125,9 +111,8 @@ namespace OpenSim.Capabilities.Handlers asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString()); asset.Data = data; asset.Temporary = true; - asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are + asset.Local = false; m_assetService.Store(asset); - } } @@ -151,8 +136,6 @@ namespace OpenSim.Capabilities.Handlers // m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID); } - - /// /// Handle raw uploaded baked texture data. /// diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs index 10ea8eefe6..fd484bad8e 100644 --- a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs +++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs @@ -67,7 +67,7 @@ namespace OpenSim.Capabilities.Handlers server.AddStreamHandler(new RestStreamHandler( "POST", "/CAPS/UploadBakedTexture/", - new UploadBakedTextureHandler(caps, m_AssetService, true).UploadBakedTexture, + new UploadBakedTextureHandler(caps, m_AssetService).UploadBakedTexture, "UploadBakedTexture", "Upload Baked Texture Capability")); diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index dfe097ef97..b406b3743a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs @@ -63,9 +63,7 @@ namespace OpenSim.Region.ClientStack.Linden private static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule. private Scene m_scene; - private bool m_persistBakedTextures; - private IBakedTextureModule m_BakedTextureModule; private string m_URL; public void Initialise(IConfigSource source) @@ -76,15 +74,12 @@ namespace OpenSim.Region.ClientStack.Linden m_URL = config.GetString("Cap_UploadBakedTexture", string.Empty); - IConfig appearanceConfig = source.Configs["Appearance"]; - if (appearanceConfig != null) - m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); +// IConfig appearanceConfig = source.Configs["Appearance"]; } public void AddRegion(Scene s) { m_scene = s; - } public void RemoveRegion(Scene s) @@ -92,7 +87,6 @@ namespace OpenSim.Region.ClientStack.Linden s.EventManager.OnRegisterCaps -= RegisterCaps; s.EventManager.OnNewPresence -= RegisterNewPresence; s.EventManager.OnRemovePresence -= DeRegisterPresence; - m_BakedTextureModule = null; m_scene = null; } @@ -101,7 +95,6 @@ namespace OpenSim.Region.ClientStack.Linden m_scene.EventManager.OnRegisterCaps += RegisterCaps; m_scene.EventManager.OnNewPresence += RegisterNewPresence; m_scene.EventManager.OnRemovePresence += DeRegisterPresence; - } private void DeRegisterPresence(UUID agentId) @@ -110,156 +103,12 @@ namespace OpenSim.Region.ClientStack.Linden private void RegisterNewPresence(ScenePresence presence) { -// presence.ControllingClient.OnSetAppearance += CaptureAppearanceSettings; } -/* not in use. work done in AvatarFactoryModule ValidateBakedTextureCache() and UpdateBakedTextureCache() - private void CaptureAppearanceSettings(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems) - { - // if cacheItems.Length > 0 viewer is giving us current textures information. - // baked ones should had been uploaded and in assets cache as local itens - - - if (cacheItems.Length == 0) - return; // no textures information, nothing to do - - ScenePresence p = null; - if (!m_scene.TryGetScenePresence(remoteClient.AgentId, out p)) - return; // what are we doing if there is no presence to cache for? - - if (p.IsDeleted) - return; // does this really work? - - int maxCacheitemsLoop = cacheItems.Length; - if (maxCacheitemsLoop > 20) - { - maxCacheitemsLoop = AvatarWearable.MAX_WEARABLES; - m_log.WarnFormat("[CACHEDBAKES]: Too Many Cache items Provided {0}, the max is {1}. Truncating!", cacheItems.Length, AvatarWearable.MAX_WEARABLES); - } - - m_BakedTextureModule = m_scene.RequestModuleInterface(); - - - // some nice debug - m_log.Debug("[Cacheitems]: " + cacheItems.Length); - for (int iter = 0; iter < maxCacheitemsLoop; iter++) - { - m_log.Debug("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" + - cacheItems[iter].TextureID); - } - - // p.Appearance.WearableCacheItems is in memory primary cashID to textures mapper - - WearableCacheItem[] existingitems = p.Appearance.WearableCacheItems; - - if (existingitems == null) - { - if (m_BakedTextureModule != null) - { - WearableCacheItem[] savedcache = null; - try - { - if (p.Appearance.WearableCacheItemsDirty) - { - savedcache = m_BakedTextureModule.Get(p.UUID); - p.Appearance.WearableCacheItems = savedcache; - p.Appearance.WearableCacheItemsDirty = false; - } - } - - catch (Exception) - { - // The service logs a sufficient error message. - } - - - if (savedcache != null) - existingitems = savedcache; - } - } - - // Existing items null means it's a fully new appearance - if (existingitems == null) - { - for (int i = 0; i < maxCacheitemsLoop; i++) - { - if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex) - { - Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex]; - if (face == null) - { - textureEntry.CreateFace(cacheItems[i].TextureIndex); - textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID = - AppearanceManager.DEFAULT_AVATAR_TEXTURE; - continue; - } - cacheItems[i].TextureID = face.TextureID; - if (m_scene.AssetService != null) - cacheItems[i].TextureAsset = - m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString()); - } - else - { - m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length); - } - } - } - else - { - for (int i = 0; i < maxCacheitemsLoop; i++) - { - if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex) - { - Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex]; - if (face == null) - { - textureEntry.CreateFace(cacheItems[i].TextureIndex); - textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID = - AppearanceManager.DEFAULT_AVATAR_TEXTURE; - continue; - } - cacheItems[i].TextureID = - face.TextureID; - } - else - { - m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length); - } - } - - for (int i = 0; i < maxCacheitemsLoop; i++) - { - if (cacheItems[i].TextureAsset == null) - { - cacheItems[i].TextureAsset = - m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString()); - } - } - } - p.Appearance.WearableCacheItems = cacheItems; - - if (m_BakedTextureModule != null) - { - m_BakedTextureModule.Store(remoteClient.AgentId, cacheItems); - p.Appearance.WearableCacheItemsDirty = true; - - } - else - p.Appearance.WearableCacheItemsDirty = false; - - for (int iter = 0; iter < maxCacheitemsLoop; iter++) - { - m_log.Debug("[CacheitemsLeaving] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" + - cacheItems[iter].TextureID); - } - } - */ public void PostInitialise() { } - - public void Close() { } public string Name { get { return "UploadBakedTextureModule"; } } @@ -275,7 +124,7 @@ namespace OpenSim.Region.ClientStack.Linden if (m_URL == "localhost") { UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler( - caps, m_scene.AssetService, m_persistBakedTextures); + caps, m_scene.AssetService); caps.RegisterHandler( "UploadBakedTexture", diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 535d946710..14607e9996 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -369,7 +369,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory return true; // uploaded baked textures will be in assets local cache - IAssetService cache = m_scene.AssetService; + IAssetCache cache = m_scene.RequestModuleInterface(); IBakedTextureModule m_BakedTextureModule = m_scene.RequestModuleInterface(); int validDirtyBakes = 0; @@ -436,7 +436,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory */ wearableCache[idx].TextureAsset = null; if (cache != null) - wearableCache[idx].TextureAsset = cache.GetCached(face.TextureID.ToString()); + { + AssetBase asb = null; + cache.Get(face.TextureID.ToString(), out asb); + wearableCache[idx].TextureAsset = asb; + } if (wearableCache[idx].TextureAsset != null) { @@ -481,15 +485,15 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // if we got a full set of baked textures save all in BakedTextureModule if (m_BakedTextureModule != null) { - m_log.Debug("[UpdateBakedCache] start async uploading to bakedModule cache"); + m_log.DebugFormat("[UpdateBakedCache] Uploading to Bakes Server: cache hits: {0} changed entries: {1} rebakes {2}", + hits.ToString(), validDirtyBakes.ToString(), missing.Count); m_BakedTextureModule.Store(sp.UUID, wearableCache); } } - - - // debug - m_log.Debug("[UpdateBakedCache] cache hits: " + hits.ToString() + " changed entries: " + validDirtyBakes.ToString() + " rebakes " + missing.Count); + else + m_log.DebugFormat("[UpdateBakedCache] cache hits: {0} changed entries: {1} rebakes {2}", + hits.ToString(), validDirtyBakes.ToString(), missing.Count); /* for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) { @@ -513,7 +517,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory lock (m_setAppearanceLock) { - IAssetService cache = m_scene.AssetService; + IAssetCache cache = m_scene.RequestModuleInterface(); IBakedTextureModule bakedModule = m_scene.RequestModuleInterface(); WearableCacheItem[] bakedModuleCache = null; @@ -553,6 +557,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } } */ + bool wearableCacheValid = false; if (wearableCache == null) { @@ -577,10 +582,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory hits++; wearableCache[idx].TextureAsset.Temporary = true; wearableCache[idx].TextureAsset.Local = true; - cache.Store(wearableCache[idx].TextureAsset); + cache.Cache(wearableCache[idx].TextureAsset); continue; } - if (cache.GetCached((wearableCache[idx].TextureID).ToString()) != null) + + if (cache.Check((wearableCache[idx].TextureID).ToString())) { hits++; continue; @@ -645,7 +651,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory wearableCache[j].TextureAsset = bakedModuleCache[i].TextureAsset; bakedModuleCache[i].TextureAsset.Temporary = true; bakedModuleCache[i].TextureAsset.Local = true; - cache.Store(bakedModuleCache[i].TextureAsset); + cache.Cache(bakedModuleCache[i].TextureAsset); } } gotbacked = true; @@ -706,7 +712,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory return 0; int texturesRebaked = 0; -// IAssetCache cache = m_scene.RequestModuleInterface(); + IAssetCache cache = m_scene.RequestModuleInterface(); for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) { @@ -722,18 +728,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory if (missingTexturesOnly) { - if (m_scene.AssetService.Get(face.TextureID.ToString()) != null) + if (cache != null && cache.Check(face.TextureID.ToString())) { continue; } else { - // On inter-simulator teleports, this occurs if baked textures are not being stored by the - // grid asset service (which means that they are not available to the new region and so have - // to be re-requested from the client). - // - // The only available core OpenSimulator behaviour right now - // is not to store these textures, temporarily or otherwise. m_log.DebugFormat( "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", face.TextureID, idx, sp.Name); From 74da81890c8e5ff9266ed0bbfa69185cee4163c3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 31 May 2017 06:04:59 +0100 Subject: [PATCH 23/25] oops.. --- .../Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs index f90c7e7809..48274c1ae5 100644 --- a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs @@ -111,7 +111,7 @@ namespace OpenSim.Capabilities.Handlers asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString()); asset.Data = data; asset.Temporary = true; - asset.Local = false; + asset.Local = true; m_assetService.Store(asset); } } From f5f0fa5d1fd30855073dbcad2455378cdf15b771 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 31 May 2017 06:18:05 +0100 Subject: [PATCH 24/25] we don't need to keep refs to baked textures assets --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 14607e9996..8fcb511663 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -494,16 +494,17 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory else m_log.DebugFormat("[UpdateBakedCache] cache hits: {0} changed entries: {1} rebakes {2}", hits.ToString(), validDirtyBakes.ToString(), missing.Count); -/* + for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++) { int j = AvatarAppearance.BAKE_INDICES[iter]; - m_log.Debug("[UpdateBCache] {" + iter + "/" + - sp.Appearance.WearableCacheItems[j].TextureIndex + "}: c-" + - sp.Appearance.WearableCacheItems[j].CacheId + ", t-" + - sp.Appearance.WearableCacheItems[j].TextureID); + sp.Appearance.WearableCacheItems[j].TextureAsset = null; +// m_log.Debug("[UpdateBCache] {" + iter + "/" + +// sp.Appearance.WearableCacheItems[j].TextureIndex + "}: c-" + +// sp.Appearance.WearableCacheItems[j].CacheId + ", t-" + +// sp.Appearance.WearableCacheItems[j].TextureID); } -*/ + return (hits == cacheItems.Length); } @@ -583,6 +584,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory wearableCache[idx].TextureAsset.Temporary = true; wearableCache[idx].TextureAsset.Local = true; cache.Cache(wearableCache[idx].TextureAsset); + wearableCache[idx].TextureAsset = null; continue; } @@ -683,6 +685,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory face.TextureID = wearableCache[idx].TextureID; hits++; + wearableCache[idx].TextureAsset = null; } } } From 7217c2029198855a465c7927659964ecedf422cc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 31 May 2017 07:12:03 +0100 Subject: [PATCH 25/25] we don't need to keep refs to baked textures assets --- .../CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 8fcb511663..9553f5b4b8 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -385,7 +385,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory List missing = new List(); - bool haveSkirt = (wearableCache[19].TextureAsset != null); + bool haveSkirt = (wearableCache[19].TextureID != UUID.Zero); bool haveNewSkirt = false; // Process received baked textures