From 00e94b0ba8e22b1bfdcbebc7c3d5c879d22b52a4 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 30 Apr 2011 16:53:11 -0700 Subject: [PATCH 1/8] Check for RegionID instead of RegionHandle. Other minor tweaks --- .../Simulation/RemoteSimulationConnector.cs | 4 ++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index 7858f2afd3..f8cea71b43 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs @@ -179,7 +179,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation return true; // else do the remote thing - if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) + if (!m_localBackend.IsLocalRegion(destination.RegionID)) { return m_remoteConnector.CreateAgent(destination, aCircuit, teleportFlags, out reason); } @@ -241,7 +241,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation return true; // else do the remote thing - if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) + if (!m_localBackend.IsLocalRegion(destination.RegionID)) return m_remoteConnector.QueryAccess(destination, id, position, out version, out reason); return false; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1aac09ddbf..5b86735ef3 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -937,7 +937,7 @@ namespace OpenSim.Region.Framework.Scenes // and it has already rezzed the attachments and started their scripts. // We do the following only for non-login agents, because their scripts // haven't started yet. - if (wasChild) + if (wasChild && Attachments != null && Attachments.Count > 0) { m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments..."); // Resume scripts From 56df7461330b1d193f3f60274525eb1b128315ef Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 30 Apr 2011 16:53:43 -0700 Subject: [PATCH 2/8] XXX DEBUGGING! --- OpenSim/Framework/ChildAgentDataUpdate.cs | 3 ++- OpenSim/Framework/WebUtil.cs | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index a626b82302..c4b5ddecb1 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -454,6 +454,7 @@ namespace OpenSim.Framework { OSDMap info = new OSDMap(4); info["sog"] = OSD.FromString(so.ToXml2()); + m_log.DebugFormat("[XXX] {0}", so.ToXml2()); info["extra"] = OSD.FromString(so.ExtraToXmlString()); info["modified"] = OSD.FromBoolean(so.HasGroupChanged); try @@ -462,7 +463,7 @@ namespace OpenSim.Framework } catch (IndexOutOfRangeException e) { - m_log.WarnFormat("[CHILD AGENT DATA]: scrtips list is shorter than object list."); + m_log.WarnFormat("[CHILD AGENT DATA]: scripts list is shorter than object list."); } attObjs.Add(info); diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 9d70f63189..5449a6faf9 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -177,7 +177,16 @@ namespace OpenSim.Framework // If there is some input, write it into the request if (data != null) { - string strBuffer = OSDParser.SerializeJsonString(data); + string strBuffer = string.Empty; + try + { + strBuffer = OSDParser.SerializeJsonString(data); + } + catch (Exception e) + { + m_log.DebugFormat("[WEB UTIL]: Exception serializing data {0}", e.Message); + throw e; + } byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer); request.ContentType = "application/json"; From 91a604d4b6822130871f35ddbc2c53f3468c2a01 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 30 Apr 2011 17:40:21 -0700 Subject: [PATCH 3/8] Removed XXX Debug. Increased ReadWriteTimeout on ServiceOSDRequest, because it was _way_ too low and is probably making writes abort in the middle. --- OpenSim/Framework/ChildAgentDataUpdate.cs | 1 - OpenSim/Framework/WebUtil.cs | 15 +++------------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index c4b5ddecb1..28fe3ba889 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -454,7 +454,6 @@ namespace OpenSim.Framework { OSDMap info = new OSDMap(4); info["sog"] = OSD.FromString(so.ToXml2()); - m_log.DebugFormat("[XXX] {0}", so.ToXml2()); info["extra"] = OSD.FromString(so.ExtraToXmlString()); info["modified"] = OSD.FromBoolean(so.HasGroupChanged); try diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 5449a6faf9..f6fed33d69 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -171,24 +171,15 @@ namespace OpenSim.Framework request.Timeout = timeout; request.KeepAlive = false; request.MaximumAutomaticRedirections = 10; - request.ReadWriteTimeout = timeout / 4; + request.ReadWriteTimeout = timeout * 8; request.Headers[OSHeaderRequestID] = reqnum.ToString(); // If there is some input, write it into the request if (data != null) { - string strBuffer = string.Empty; - try - { - strBuffer = OSDParser.SerializeJsonString(data); - } - catch (Exception e) - { - m_log.DebugFormat("[WEB UTIL]: Exception serializing data {0}", e.Message); - throw e; - } + string strBuffer = OSDParser.SerializeJsonString(data); byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer); - + request.ContentType = "application/json"; request.ContentLength = buffer.Length; //Count bytes to send using (Stream requestStream = request.GetRequestStream()) From d4323dd7530734ed2c35138722ed8c9c01d53d4e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 30 Apr 2011 18:08:48 -0700 Subject: [PATCH 4/8] Increased Timeout to 30 secs. --- OpenSim/Framework/WebUtil.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index f6fed33d69..ac0828b90e 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -142,17 +142,17 @@ namespace OpenSim.Framework /// public static OSDMap PutToService(string url, OSDMap data) { - return ServiceOSDRequest(url,data,"PUT",10000); + return ServiceOSDRequest(url,data,"PUT",30000); } public static OSDMap PostToService(string url, OSDMap data) { - return ServiceOSDRequest(url,data,"POST",10000); + return ServiceOSDRequest(url,data,"POST",30000); } public static OSDMap GetFromService(string url) { - return ServiceOSDRequest(url,null,"GET",10000); + return ServiceOSDRequest(url,null,"GET",30000); } public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout) From bbe41c75e17764a238f301bfdebdc095cc4a64cd Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 1 May 2011 09:30:23 -0700 Subject: [PATCH 5/8] Fixed confusing OSDMap that comes as the response of QueryAccess in the case it fails. --- .../Simulation/SimulationServiceConnector.cs | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 7545db8200..5cb82699d6 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -275,27 +275,30 @@ namespace OpenSim.Services.Connectors.Simulation try { OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000); - OSDMap data = (OSDMap)result["_Result"]; - bool success = result["success"].AsBoolean(); - reason = data["reason"].AsString(); - if (data["version"] != null && data["version"].AsString() != string.Empty) - version = data["version"].AsString(); + if (result.ContainsKey("_Result")) + { + OSDMap data = (OSDMap)result["_Result"]; - m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1} version {2} ({3})", uri, success, version, data["version"].AsString()); + reason = data["reason"].AsString(); + if (data["version"] != null && data["version"].AsString() != string.Empty) + version = data["version"].AsString(); + + m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1} version {2} ({3})", uri, success, version, data["version"].AsString()); + } if (!success) { - if (data.ContainsKey("Message")) + if (result.ContainsKey("Message")) { - string message = data["Message"].AsString(); + string message = result["Message"].AsString(); if (message == "Service request failed: [MethodNotAllowed] MethodNotAllowed") // Old style region { m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored"); return true; } - reason = data["Message"]; + reason = result["Message"]; } else { From 8cc547c2776f957abd0fa09c33c02bf42de70340 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 2 May 2011 09:04:34 -0700 Subject: [PATCH 6/8] Turns out that it's a bad idea to let Agent position updates linger for a long time on certain versions of mono. It's better to abort them if they take too long. So timeout is now an argument. Currently: 20secs for CreateAgent, 100secs for UpdateAgent (fat), 10 secs for UpdateAgent (Position); all of these divided by 4, for ReadWrite, as Mic had before. --- OpenSim/Framework/WebUtil.cs | 18 +++++++++--------- .../Simulation/SimulationServiceConnector.cs | 14 +++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index ac0828b90e..4734fc1f83 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -140,19 +140,19 @@ namespace OpenSim.Framework /// PUT JSON-encoded data to a web service that returns LLSD or /// JSON data /// - public static OSDMap PutToService(string url, OSDMap data) + public static OSDMap PutToService(string url, OSDMap data, int timeout) { - return ServiceOSDRequest(url,data,"PUT",30000); + return ServiceOSDRequest(url,data, "PUT", timeout); } - - public static OSDMap PostToService(string url, OSDMap data) + + public static OSDMap PostToService(string url, OSDMap data, int timeout) { - return ServiceOSDRequest(url,data,"POST",30000); + return ServiceOSDRequest(url, data, "POST", timeout); } - - public static OSDMap GetFromService(string url) + + public static OSDMap GetFromService(string url, int timeout) { - return ServiceOSDRequest(url,null,"GET",30000); + return ServiceOSDRequest(url, null, "GET", timeout); } public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout) @@ -171,7 +171,7 @@ namespace OpenSim.Framework request.Timeout = timeout; request.KeepAlive = false; request.MaximumAutomaticRedirections = 10; - request.ReadWriteTimeout = timeout * 8; + request.ReadWriteTimeout = timeout / 4; request.Headers[OSHeaderRequestID] = reqnum.ToString(); // If there is some input, write it into the request diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 5cb82699d6..0f2ced14ca 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -102,7 +102,7 @@ namespace OpenSim.Services.Connectors.Simulation args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); args["teleport_flags"] = OSD.FromString(flags.ToString()); - OSDMap result = WebUtil.PostToService(uri,args); + OSDMap result = WebUtil.PostToService(uri, args, 20000); if (result["Success"].AsBoolean()) return true; @@ -126,7 +126,7 @@ namespace OpenSim.Services.Connectors.Simulation /// public bool UpdateAgent(GridRegion destination, AgentData data) { - return UpdateAgent(destination, (IAgentData)data); + return UpdateAgent(destination, (IAgentData)data, 100000); // yes, 100 seconds } /// @@ -181,7 +181,7 @@ namespace OpenSim.Services.Connectors.Simulation } } - UpdateAgent(destination,(IAgentData)pos); + UpdateAgent(destination, (IAgentData)pos, 10000); } // unreachable @@ -191,7 +191,7 @@ namespace OpenSim.Services.Connectors.Simulation /// /// This is the worker function to send AgentData to a neighbor region /// - private bool UpdateAgent(GridRegion destination, IAgentData cAgentData) + private bool UpdateAgent(GridRegion destination, IAgentData cAgentData, int timeout) { // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: UpdateAgent start"); @@ -207,7 +207,7 @@ namespace OpenSim.Services.Connectors.Simulation args["destination_name"] = OSD.FromString(destination.RegionName); args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); - OSDMap result = WebUtil.PutToService(uri,args); + OSDMap result = WebUtil.PutToService(uri, args, timeout); return result["Success"].AsBoolean(); } catch (Exception e) @@ -233,7 +233,7 @@ namespace OpenSim.Services.Connectors.Simulation try { - OSDMap result = WebUtil.GetFromService(uri); + OSDMap result = WebUtil.GetFromService(uri, 10000); if (result["Success"].AsBoolean()) { // OSDMap args = Util.GetOSDMap(result["_RawResult"].AsString()); @@ -392,7 +392,7 @@ namespace OpenSim.Services.Connectors.Simulation args["destination_name"] = OSD.FromString(destination.RegionName); args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); - WebUtil.PostToService(uri, args); + WebUtil.PostToService(uri, args, 40000); } catch (Exception e) { From 51d0b8b4e9179d5dbfd289a34e7103d2889c4b71 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 2 May 2011 09:06:21 -0700 Subject: [PATCH 7/8] Oops, forgot this one. --- .../Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 8ab323ad41..0430ef60d7 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -314,7 +314,7 @@ namespace OpenSim.Services.Connectors.Hypergrid args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); args["teleport_flags"] = OSD.FromString(flags.ToString()); - OSDMap result = WebUtil.PostToService(uri,args); + OSDMap result = WebUtil.PostToService(uri, args, 20000); if (result["Success"].AsBoolean()) { OSDMap unpacked = (OSDMap)result["_Result"]; From f7d37201265b45ce8449c1361fa51928931d6bfd Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 2 May 2011 09:20:08 -0700 Subject: [PATCH 8/8] Increased timeout for fat UpdateAgent to 200secs. Nebadon's 3800-prim alien avatar takes 6secs to transfer between sims on the same machine... --- .../Connectors/Simulation/SimulationServiceConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 0f2ced14ca..cef6473b78 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -126,7 +126,7 @@ namespace OpenSim.Services.Connectors.Simulation /// public bool UpdateAgent(GridRegion destination, AgentData data) { - return UpdateAgent(destination, (IAgentData)data, 100000); // yes, 100 seconds + return UpdateAgent(destination, (IAgentData)data, 200000); // yes, 200 seconds } ///