From 7c3200b393a0ec9bb324dc0f862206987974cd74 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 21 May 2017 05:16:18 +0100 Subject: cross avatar group info also if title is empty string --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 474378d..55ccb0a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -4687,7 +4687,10 @@ namespace OpenSim.Region.Framework.Scenes cAgent.agentCOF = COF; cAgent.ActiveGroupID = ControllingClient.ActiveGroupId; cAgent.ActiveGroupName = ControllingClient.ActiveGroupName; - cAgent.ActiveGroupTitle = Grouptitle; + if(Grouptitle == null) + cAgent.ActiveGroupTitle = String.Empty; + else + cAgent.ActiveGroupTitle = Grouptitle; } } -- cgit v1.1 From bad00670a93aaa09faddaa48c326e53f519ff138 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 22 May 2017 05:02:42 +0100 Subject: disable keepalive on llHttpRequest --- OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index ae5e175..dabff60 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -538,6 +538,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest { Request = (HttpWebRequest)WebRequest.Create(Url); Request.AllowAutoRedirect = false; + Request.KeepAlive = false; //This works around some buggy HTTP Servers like Lighttpd Request.ServicePoint.Expect100Continue = false; -- cgit v1.1 From fcb435deb4f45511071c7bdb8c4e2290fdc9977f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 22 May 2017 05:53:59 +0100 Subject: make sure we drop requests if DoHTTPGruntWork fails --- .../Servers/HttpServer/PollServiceRequestManager.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 314719c..8bf98da 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -244,11 +244,13 @@ namespace OpenSim.Framework.Servers.HttpServer try { req.DoHTTPGruntWork(m_server, responsedata); - byContextDequeue(req); } - catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream + catch (ObjectDisposedException) { - // Ignore it, no need to reply + } + finally + { + byContextDequeue(req); } return null; }, null); @@ -263,12 +265,15 @@ namespace OpenSim.Framework.Servers.HttpServer { req.DoHTTPGruntWork(m_server, req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); - byContextDequeue(req); } catch (ObjectDisposedException) { // Ignore it, no need to reply } + finally + { + byContextDequeue(req); + } return null; }, null); } -- cgit v1.1 From 8f9256ea1c379c313ec4ddf1393d8448ccd74b4d Mon Sep 17 00:00:00 2001 From: Geir Nøklebye Date: Mon, 22 May 2017 15:31:39 +0200 Subject: PGSQL: Another missing cast in XInventoryData Signed-off-by: UbitUmarov --- OpenSim/Data/PGSQL/PGSQLXInventoryData.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/PGSQL/PGSQLXInventoryData.cs b/OpenSim/Data/PGSQL/PGSQLXInventoryData.cs index 55a1996..4c10ac9 100644 --- a/OpenSim/Data/PGSQL/PGSQLXInventoryData.cs +++ b/OpenSim/Data/PGSQL/PGSQLXInventoryData.cs @@ -206,7 +206,7 @@ namespace OpenSim.Data.PGSQL cmd.CommandText = String.Format(@"select bit_or(""inventoryCurrentPermissions"") as ""inventoryCurrentPermissions"" from inventoryitems where ""avatarID""::uuid = :PrincipalID - and ""assetID"" = :AssetID + and ""assetID""::uuid = :AssetID group by ""assetID"" "); cmd.Parameters.Add(m_database.CreateParameter("PrincipalID", principalID)); -- cgit v1.1 From 73222e4dd4e735225845184de22e245c454b40db Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 22 May 2017 19:14:19 +0100 Subject: fix IClientIPEndpoint broken by justin long ago.. but stop using it except on SceneBanner, later it my be also removed from there and everywhere --- OpenSim/Framework/Client/IClientIPEndpoint.cs | 2 +- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- .../Region/CoreModules/Agent/IPBan/SceneBanner.cs | 4 ++-- .../EntityTransfer/EntityTransferModule.cs | 27 +++++++++------------- 4 files changed, 15 insertions(+), 20 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Client/IClientIPEndpoint.cs b/OpenSim/Framework/Client/IClientIPEndpoint.cs index 2b99bf0..2194616 100644 --- a/OpenSim/Framework/Client/IClientIPEndpoint.cs +++ b/OpenSim/Framework/Client/IClientIPEndpoint.cs @@ -34,6 +34,6 @@ namespace OpenSim.Framework.Client { public interface IClientIPEndpoint { - IPAddress EndPoint { get; } + IPEndPoint RemoteEndPoint { get; } } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 298c933..f658a70 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -62,7 +62,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Handles new client connections /// Constructor takes a single Packet and authenticates everything /// - public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientInventory, IStatsCollector + public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientInventory, IStatsCollector, IClientIPEndpoint { /// /// Debug packet level. See OpenSim.RegisterConsoleCommands() for more details. diff --git a/OpenSim/Region/CoreModules/Agent/IPBan/SceneBanner.cs b/OpenSim/Region/CoreModules/Agent/IPBan/SceneBanner.cs index 8502006..b4c68e2 100644 --- a/OpenSim/Region/CoreModules/Agent/IPBan/SceneBanner.cs +++ b/OpenSim/Region/CoreModules/Agent/IPBan/SceneBanner.cs @@ -53,9 +53,9 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan if (bans.Count > 0) { IClientIPEndpoint ipEndpoint; - if (client.TryGet(out ipEndpoint)) + if (client.TryGet(out ipEndpoint) && ipEndpoint.RemoteEndPoint != null) { - IPAddress end = ipEndpoint.EndPoint; + IPAddress end = ipEndpoint.RemoteEndPoint.Address; try { diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 87b76dc..3564f7f 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -813,8 +813,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agentCircuit.Id0 = currentAgentCircuit.Id0; } - IClientIPEndpoint ipepClient; - uint newRegionX, newRegionY, oldRegionX, oldRegionY; Util.RegionHandleToRegionLoc(destinationHandle, out newRegionX, out newRegionY); Util.RegionHandleToRegionLoc(sourceRegion.RegionHandle, out oldRegionX, out oldRegionY); @@ -834,11 +832,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); #region IP Translation for NAT - // Uses ipepClient above - if (sp.ClientView.TryGet(out ipepClient)) - { - endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); - } + IPEndPoint clientEP = sp.ControllingClient.RemoteEndPoint; + if (clientEP != null && clientEP.Address != null) + endPoint.Address = NetworkUtil.GetIPFor(clientEP.Address, endPoint.Address); + #endregion agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); } @@ -1746,10 +1743,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (m_eqModule != null) { #region IP Translation for NAT - IClientIPEndpoint ipepClient; - if (agent.ClientView.TryGet(out ipepClient)) - endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); - + IPEndPoint clientEP = agent.ControllingClient.RemoteEndPoint; + if (clientEP != null && clientEP.Address != null) + endPoint.Address = NetworkUtil.GetIPFor(clientEP.Address, endPoint.Address); + m_log.DebugFormat("{0} {1} is sending {2} EnableSimulator for neighbour region {3}(loc=<{4},{5}>,siz=<{6},{7}>) " + "and EstablishAgentCommunication with seed cap {8}", LogHeader, source.RegionName, agent.Name, @@ -2402,11 +2399,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if(sp == null || sp.IsDeleted || sp.ClientView == null) // something bad already happened return; - IClientIPEndpoint ipepClient; - if (sp.ClientView.TryGet(out ipepClient)) - { - endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); - } + IPEndPoint clientEP = sp.ControllingClient.RemoteEndPoint; + if (clientEP != null && clientEP.Address != null) + endPoint.Address = NetworkUtil.GetIPFor(clientEP.Address, endPoint.Address); #endregion m_log.DebugFormat("{0} {1} is sending {2} EnableSimulator for neighbour region {3}(loc=<{4},{5}>,siz=<{6},{7}>) " + -- cgit v1.1 From ea88927a65c54cf06c347c5f107deb4fcf45929d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 22 May 2017 20:15:02 +0100 Subject: remove some code for NAT that was disabled by its author Adam Frisby since 2009, and i don't see how to mk work with current viewers at that point at least --- .../Framework/EntityTransfer/EntityTransferModule.cs | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 3564f7f..4b846f5 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -831,12 +831,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer finalDestination.RegionName, newRegionX, newRegionY,newSizeX, newSizeY, sp.Name, Scene.Name); //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); - #region IP Translation for NAT - IPEndPoint clientEP = sp.ControllingClient.RemoteEndPoint; - if (clientEP != null && clientEP.Address != null) - endPoint.Address = NetworkUtil.GetIPFor(clientEP.Address, endPoint.Address); - - #endregion agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); } else @@ -949,7 +943,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.Position = agentCircuit.startpos; SetCallbackURL(agent, sp.Scene.RegionInfo); - // We will check for an abort before UpdateAgent since UpdateAgent will require an active viewer to // establish th econnection to the destination which makes it return true. if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) @@ -1742,11 +1735,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (m_eqModule != null) { - #region IP Translation for NAT - IPEndPoint clientEP = agent.ControllingClient.RemoteEndPoint; - if (clientEP != null && clientEP.Address != null) - endPoint.Address = NetworkUtil.GetIPFor(clientEP.Address, endPoint.Address); - m_log.DebugFormat("{0} {1} is sending {2} EnableSimulator for neighbour region {3}(loc=<{4},{5}>,siz=<{6},{7}>) " + "and EstablishAgentCommunication with seed cap {8}", LogHeader, source.RegionName, agent.Name, @@ -2278,6 +2266,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } #endregion // NotFoundLocationCache class + #region getregions private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache(); protected GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py) @@ -2395,15 +2384,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (m_eqModule != null) { - #region IP Translation for NAT if(sp == null || sp.IsDeleted || sp.ClientView == null) // something bad already happened return; - IPEndPoint clientEP = sp.ControllingClient.RemoteEndPoint; - if (clientEP != null && clientEP.Address != null) - endPoint.Address = NetworkUtil.GetIPFor(clientEP.Address, endPoint.Address); - #endregion - m_log.DebugFormat("{0} {1} is sending {2} EnableSimulator for neighbour region {3}(loc=<{4},{5}>,siz=<{6},{7}>) " + "and EstablishAgentCommunication with seed cap {8}", LogHeader, scene.RegionInfo.RegionName, sp.Name, -- cgit v1.1 From 4da5d249d8c92705b16a06641f6ddd93d1bfbfa3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 22 May 2017 21:22:04 +0100 Subject: receivers can't tell if there where proxies on path unless they look --- OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 2 +- .../Server/Handlers/Simulation/AgentHandlers.cs | 40 ++++++++++------------ 2 files changed, 20 insertions(+), 22 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index 072429a..4e7ab00 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -64,7 +64,7 @@ namespace OpenSim.Server.Handlers.Login public XmlRpcResponse HandleXMLRPCLogin(XmlRpcRequest request, IPEndPoint remoteClient) { Hashtable requestData = (Hashtable)request.Params[0]; - if (m_Proxy && request.Params[3] != null) + if (request.Params[3] != null) { IPEndPoint ep = Util.GetClientIPFromXFF((string)request.Params[3]); if (ep != null) diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 4e1f72e..bb524e6 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -517,32 +517,30 @@ namespace OpenSim.Server.Handlers.Simulation protected string GetCallerIP(Hashtable request) { - if (!m_Proxy) - return Util.GetCallerIP(request); - - // We're behind a proxy - Hashtable headers = (Hashtable)request["headers"]; - - //// DEBUG - //foreach (object o in headers.Keys) - // m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString())); + if (request.ContainsKey("headers")) + { + Hashtable headers = (Hashtable)request["headers"]; - string xff = "X-Forwarded-For"; - if (headers.ContainsKey(xff.ToLower())) - xff = xff.ToLower(); + //// DEBUG + //foreach (object o in headers.Keys) + // m_log.DebugFormat("XXX {0} = {1}", o.ToString(), (headers[o] == null? "null" : headers[o].ToString())); - if (!headers.ContainsKey(xff) || headers[xff] == null) - { - m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); - return Util.GetCallerIP(request); - } + string xff = "X-Forwarded-For"; + if (!headers.ContainsKey(xff)) + xff = xff.ToLower(); - m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]); + if (!headers.ContainsKey(xff) || headers[xff] == null) + { + m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); + return Util.GetCallerIP(request); + } - IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]); - if (ep != null) - return ep.Address.ToString(); + m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]); + IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]); + if (ep != null) + return ep.Address.ToString(); + } // Oops return Util.GetCallerIP(request); } -- cgit v1.1 From 24885819fccbecafb83cec81000416843d86a593 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 22 May 2017 22:04:20 +0100 Subject: check XFF headers of caller, but be quiet about them --- OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | 6 +++--- OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs | 6 +++--- OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index bfd73a2..331dabf 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs @@ -225,8 +225,8 @@ namespace OpenSim.Server.Handlers.MapImage private System.Net.IPAddress GetCallerIP(IOSHttpRequest request) { - if (!m_Proxy) - return request.RemoteIPEndPoint.Address; +// if (!m_Proxy) +// return request.RemoteIPEndPoint.Address; // We're behind a proxy string xff = "X-Forwarded-For"; @@ -236,7 +236,7 @@ namespace OpenSim.Server.Handlers.MapImage if (xffValue == null || (xffValue != null && xffValue == string.Empty)) { - m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header"); +// m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header"); return request.RemoteIPEndPoint.Address; } diff --git a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs index 8a3875d..9daeb73 100644 --- a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs @@ -229,8 +229,8 @@ namespace OpenSim.Server.Handlers.MapImage private System.Net.IPAddress GetCallerIP(IOSHttpRequest request) { - if (!m_Proxy) - return request.RemoteIPEndPoint.Address; +// if (!m_Proxy) +// return request.RemoteIPEndPoint.Address; // We're behind a proxy string xff = "X-Forwarded-For"; @@ -240,7 +240,7 @@ namespace OpenSim.Server.Handlers.MapImage if (xffValue == null || (xffValue != null && xffValue == string.Empty)) { - m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header"); +// m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header"); return request.RemoteIPEndPoint.Address; } diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index bb524e6..c52a1ab 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -531,11 +531,11 @@ namespace OpenSim.Server.Handlers.Simulation if (!headers.ContainsKey(xff) || headers[xff] == null) { - m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); +// m_log.WarnFormat("[AGENT HANDLER]: No XFF header"); return Util.GetCallerIP(request); } - m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]); +// m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers[xff]); IPEndPoint ep = Util.GetClientIPFromXFF((string)headers[xff]); if (ep != null) -- cgit v1.1 From c080d9fa23775dc89262db4ea2abbfa11f2c0c77 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 23 May 2017 00:10:11 +0100 Subject: remember mono about the default for DnsRefreshTimeout --- OpenSim/Region/Application/Application.cs | 3 +++ OpenSim/Server/ServerMain.cs | 1 + 2 files changed, 4 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index bc6d7b3..2fea8d1 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -77,7 +77,10 @@ namespace OpenSim if(Util.IsWindows()) ServicePointManager.DefaultConnectionLimit = 32; else + { ServicePointManager.DefaultConnectionLimit = 12; + ServicePointManager.DnsRefreshTimeout = 120000; // just is case crazy mono decides to have it infinity + } ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 96b0a82..2f2eb28 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -55,6 +55,7 @@ namespace OpenSim.Server public static int Main(string[] args) { ServicePointManager.DefaultConnectionLimit = 64; + ServicePointManager.DnsRefreshTimeout = 120000; // just is case mono decides to have it infinity ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; -- cgit v1.1 From 7b80bcc57a4d7be5d518e83408e063a71ce0eb4c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 23 May 2017 00:52:40 +0100 Subject: no all mono versions know DnsRefreshTimeout --- OpenSim/Region/Application/Application.cs | 3 ++- OpenSim/Server/ServerMain.cs | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index 2fea8d1..4bd2c28 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -79,7 +79,8 @@ namespace OpenSim else { ServicePointManager.DefaultConnectionLimit = 12; - ServicePointManager.DnsRefreshTimeout = 120000; // just is case crazy mono decides to have it infinity + try { ServicePointManager.DnsRefreshTimeout = 120000; } // just is case crazy some mono decides to have it infinity + catch { } } ServicePointManager.Expect100Continue = false; diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 2f2eb28..341c227 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -55,10 +55,12 @@ namespace OpenSim.Server public static int Main(string[] args) { ServicePointManager.DefaultConnectionLimit = 64; - ServicePointManager.DnsRefreshTimeout = 120000; // just is case mono decides to have it infinity ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; + try { ServicePointManager.DnsRefreshTimeout = 120000; } // just is case some mono decides to have it infinity + catch { } + m_Server = new HttpServerBase("R.O.B.U.S.T.", args); string registryLocation; -- cgit v1.1 From 928733efc908e25ea460ca4724a8846a4fb71fa1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 23 May 2017 03:26:32 +0100 Subject: please DIE! PLEASE?? --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 9 +++++++-- .../Servers/HttpServer/PollServiceRequestManager.cs | 11 +++++++---- OpenSim/Framework/Servers/MainServer.cs | 12 ++++++++++++ OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs | 2 ++ .../CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | 1 + OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 9 ++++++++- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 3 +++ 7 files changed, 40 insertions(+), 7 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 62cd543..99d94bb 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -108,12 +108,17 @@ namespace OpenSim.Framework.Servers protected override void ShutdownSpecific() { - m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting..."); - RemovePIDFile(); base.ShutdownSpecific(); + MainServer.Stop(); + + Thread.Sleep(5000); + + RemovePIDFile(); + m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting..."); + if (!SuppressExit) Environment.Exit(0); } diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 8bf98da..e1bd564 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -181,17 +181,20 @@ namespace OpenSim.Framework.Servers.HttpServer { m_running = false; - Thread.Sleep(1000); // let the world move + Thread.Sleep(100); // let the world move foreach (Thread t in m_workerThreads) Watchdog.AbortThread(t.ManagedThreadId); + m_threadPool.Shutdown(); + // any entry in m_bycontext should have a active request on the other queues // so just delete contents to easy GC foreach (Queue qu in m_bycontext.Values) qu.Clear(); m_bycontext.Clear(); +/* try { foreach (PollServiceHttpRequest req in m_retryRequests) @@ -204,8 +207,9 @@ namespace OpenSim.Framework.Servers.HttpServer } PollServiceHttpRequest wreq; +*/ m_retryRequests.Clear(); - +/* while (m_requests.Count() > 0) { try @@ -218,7 +222,7 @@ namespace OpenSim.Framework.Servers.HttpServer { } } - +*/ m_requests.Clear(); } @@ -229,7 +233,6 @@ namespace OpenSim.Framework.Servers.HttpServer while (m_running) { PollServiceHttpRequest req = m_requests.Dequeue(5000); - Watchdog.UpdateThread(); if (req != null) { diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index ea7b2b5..9b1d906 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs @@ -353,5 +353,17 @@ namespace OpenSim.Framework.Servers return m_Servers[port]; } } + + public static void Stop() + { + lock (m_Servers) + { + foreach (BaseHttpServer httpServer in m_Servers.Values) + { + httpServer.Stop(); + } + } + } + } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs index 5d66d34..8c44ee2 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs @@ -106,6 +106,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid if (!m_Enabled) return; + base.RemoveRegion(scene); + scene.EventManager.OnClientClosed -= EventManager_OnClientClosed; } diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index dabff60..57dc556 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -415,6 +415,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest public void Close() { + ThreadPool.Shutdown(); } public string Name diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 5dcf326..00c8279 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -215,6 +215,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap m_scene.EventManager.OnNewClient -= OnNewClient; m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps; + m_scene.UnregisterModuleInterface(this); + string regionimage = "regionImage" + m_scene.RegionInfo.RegionID.ToString(); regionimage = regionimage.Replace("-", ""); MainServer.Instance.RemoveLLSDHandler("/MAP/MapItems/" + m_scene.RegionInfo.RegionHandle.ToString(), @@ -1148,7 +1150,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap List thisRunData = new List(); while (true) { - m_mapBlockRequestEvent.WaitOne(); + while(!m_mapBlockRequestEvent.WaitOne(4900)) + { + if(m_scene == null) + return; + } + lock (m_mapBlockRequestEvent) { int total = 0; diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 0ccc683..2e39033 100755 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -827,6 +827,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine if (m_ScriptEngines.Contains(this)) m_ScriptEngines.Remove(this); } + + lock(m_Scripts) + m_ThreadPool.Shutdown(); } public object DoBackup(object o) -- cgit v1.1 From f3eb73926e1602f855f2c7fceb040b07f7265f3b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 23 May 2017 04:05:31 +0100 Subject: stop a few more threads on exit --- OpenSim/Framework/Monitoring/WorkManager.cs | 6 ++++- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 2 ++ .../Api/Implementation/AsyncCommandManager.cs | 30 ++++++++++------------ 3 files changed, 21 insertions(+), 17 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Monitoring/WorkManager.cs b/OpenSim/Framework/Monitoring/WorkManager.cs index 43130f9..a3e0390 100644 --- a/OpenSim/Framework/Monitoring/WorkManager.cs +++ b/OpenSim/Framework/Monitoring/WorkManager.cs @@ -82,6 +82,11 @@ namespace OpenSim.Framework.Monitoring HandleControlCommand); } + public static void Stop() + { + JobEngine.Stop(); + } + /// /// Start a new long-lived thread. /// @@ -131,7 +136,6 @@ namespace OpenSim.Framework.Monitoring thread.Start(); - return thread; } diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 99d94bb..7d21e00 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -116,6 +116,8 @@ namespace OpenSim.Framework.Servers Thread.Sleep(5000); + WorkManager.Stop(); + RemovePIDFile(); m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting..."); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index 6a39bb9..2a31efd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs @@ -197,20 +197,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ~AsyncCommandManager() { // Shut down thread -// try -// { -// if (cmdHandlerThread != null) -// { -// if (cmdHandlerThread.IsAlive == true) -// { -// cmdHandlerThread.Abort(); -// //cmdHandlerThread.Join(); -// } -// } -// } -// catch -// { -// } + try + { + if (cmdHandlerThread != null) + { + if (cmdHandlerThread.IsAlive == true) + { + cmdHandlerThread.Abort(); + //cmdHandlerThread.Join(); + } + } + } + catch + { + } } /// @@ -387,8 +387,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - - public static Object[] GetSerializationData(IScriptEngine engine, UUID itemID) { List data = new List(); -- cgit v1.1 From e69057a1b6115d6d7012d09eccee3ba8aca16d41 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 23 May 2017 04:21:03 +0100 Subject: dont fail saving a OAR because of a broken material --- OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 93406cb..5a9a5a0 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -550,7 +550,16 @@ namespace OpenSim.Region.Framework.Scenes /// private void RecordMaterialAssetUuids(AssetBase materialAsset) { - OSDMap mat = (OSDMap)OSDParser.DeserializeLLSDXml(materialAsset.Data); + OSDMap mat; + try + { + mat = (OSDMap)OSDParser.DeserializeLLSDXml(materialAsset.Data); + } + catch (Exception e) + { + m_log.WarnFormat("[Materials]: cannot decode material asset {0}: {1}", materialAsset.ID, e.Message); + return; + } UUID normMap = mat["NormMap"].AsUUID(); if (normMap != UUID.Zero) -- cgit v1.1 From 8e777d50a63038a73cb2e56d24698aa9bb416e57 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 23 May 2017 05:34:25 +0100 Subject: only remove AsyncCommandManager thread when last instance is deleted --- .../Shared/Api/Implementation/AsyncCommandManager.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index 2a31efd..5e7a724 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api private static Thread cmdHandlerThread; private static int cmdHandlerThreadCycleSleepms; - + private static int numInstances; /// /// Lock for reading/writing static components of AsyncCommandManager. /// @@ -172,6 +172,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!m_XmlRequest.ContainsKey(m_ScriptEngine)) m_XmlRequest[m_ScriptEngine] = new XmlRequest(this); + numInstances++; StartThread(); } } @@ -199,12 +200,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // Shut down thread try { - if (cmdHandlerThread != null) + lock (staticLock) { - if (cmdHandlerThread.IsAlive == true) + numInstances--; + if(numInstances > 0) + return; + if (cmdHandlerThread != null) { - cmdHandlerThread.Abort(); + if (cmdHandlerThread.IsAlive == true) + { + cmdHandlerThread.Abort(); //cmdHandlerThread.Join(); + } } } } -- cgit v1.1 From d5e8e116d4b4e02e338d95ae084c9d6270139dcb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 23 May 2017 05:41:04 +0100 Subject: protect AsyncCommandManager thread from fails on the several things it checks --- .../Shared/Api/Implementation/AsyncCommandManager.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index 5e7a724..cefd39e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs @@ -247,24 +247,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api lock (staticLock) { // Check HttpRequests - m_HttpRequest[m_ScriptEngines[0]].CheckHttpRequests(); + try { m_HttpRequest[m_ScriptEngines[0]].CheckHttpRequests(); } catch {} // Check XMLRPCRequests - m_XmlRequest[m_ScriptEngines[0]].CheckXMLRPCRequests(); + try { m_XmlRequest[m_ScriptEngines[0]].CheckXMLRPCRequests(); } catch {} foreach (IScriptEngine s in m_ScriptEngines) { // Check Listeners - m_Listener[s].CheckListeners(); + try { m_Listener[s].CheckListeners(); } catch {} + // Check timers - m_Timer[s].CheckTimerEvents(); + try { m_Timer[s].CheckTimerEvents(); } catch {} // Check Sensors - m_SensorRepeat[s].CheckSenseRepeaterEvents(); + try { m_SensorRepeat[s].CheckSenseRepeaterEvents(); } catch {} // Check dataserver - m_Dataserver[s].ExpireRequests(); + try { m_Dataserver[s].ExpireRequests(); } catch {} } } } -- cgit v1.1 From e1aa591815f451f4fcf7eb49065d8e300141d9bf Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 23 May 2017 05:59:14 +0100 Subject: allow new thread creation if it was aborted on AsyncCommandManager --- .../Shared/Api/Implementation/AsyncCommandManager.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index cefd39e..4714275 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs @@ -182,9 +182,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (cmdHandlerThread == null) { // Start the thread that will be doing the work - cmdHandlerThread - = WorkManager.StartThread( + lock (staticLock) + { + cmdHandlerThread = WorkManager.StartThread( CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true, true); + } } } @@ -210,7 +212,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (cmdHandlerThread.IsAlive == true) { cmdHandlerThread.Abort(); - //cmdHandlerThread.Join(); + //cmdHandlerThread.Join(); + cmdHandlerThread = null; } } } -- cgit v1.1 From 3c97bb1e6fe5a850f35929da58321655331ebae1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 23 May 2017 06:03:51 +0100 Subject: fix lock position removing a not necessary function --- .../Shared/Api/Implementation/AsyncCommandManager.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index 4714275..eb6455a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs @@ -173,16 +173,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_XmlRequest[m_ScriptEngine] = new XmlRequest(this); numInstances++; - StartThread(); - } - } - - private static void StartThread() - { - if (cmdHandlerThread == null) - { - // Start the thread that will be doing the work - lock (staticLock) + if (cmdHandlerThread == null) { cmdHandlerThread = WorkManager.StartThread( CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true, true); -- cgit v1.1 From 07e614a32c79b9295b162119d95ab1770243a8cc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 23 May 2017 06:38:19 +0100 Subject: dont log timeouts on stopped threads --- OpenSim/Region/Application/OpenSim.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index f9f103a..524f2be 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -504,7 +504,8 @@ 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