From 67555994adc6b5449a0a1c21997e7bfcf880ad02 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 5 Feb 2011 07:55:54 -0800 Subject: [PATCH 1/9] Amend to yesterday's deletions: forgot to delete the RemoteInventory module in th addin.xml file. --- OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index 43de2abd15..a9d247a2b8 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml @@ -47,7 +47,6 @@ - From 3a2a48a8cad9914862b6804cb46b21bc2c8d6bf7 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 5 Feb 2011 08:20:13 -0800 Subject: [PATCH 2/9] Add sane packing of ServiceURLs -- OSDMap. The old way (OSDArray) is still supported for backwards compatibility, but will be removed in the future. --- OpenSim/Framework/AgentCircuitData.cs | 30 ++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index 1600bdc00d..3dbc215d46 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs @@ -220,6 +220,8 @@ namespace OpenSim.Framework args["packed_appearance"] = appmap; } + // Old, bad way. Keeping it fow now for backwards compatibility + // OBSOLETE -- soon to be deleted if (ServiceURLs != null && ServiceURLs.Count > 0) { OSDArray urls = new OSDArray(ServiceURLs.Count * 2); @@ -232,6 +234,19 @@ namespace OpenSim.Framework args["service_urls"] = urls; } + // again, this time the right way + if (ServiceURLs != null && ServiceURLs.Count > 0) + { + OSDMap urls = new OSDMap(); + foreach (KeyValuePair kvp in ServiceURLs) + { + //System.Console.WriteLine("XXX " + kvp.Key + "=" + kvp.Value); + urls[kvp.Key] = OSD.FromString((kvp.Value == null) ? string.Empty : kvp.Value.ToString()); + } + args["serviceurls"] = urls; + } + + return args; } @@ -327,7 +342,20 @@ namespace OpenSim.Framework } ServiceURLs = new Dictionary(); - if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) + // Try parse the new way, OSDMap + if (args.ContainsKey("serviceurls") && args["serviceurls"] != null && (args["serviceurls"]).Type == OSDType.Map) + { + OSDMap urls = (OSDMap)(args["serviceurls"]); + foreach (KeyValuePair kvp in urls) + { + ServiceURLs[kvp.Key] = kvp.Value.AsString(); + //System.Console.WriteLine("XXX " + kvp.Key + "=" + ServiceURLs[kvp.Key]); + + } + } + // else try the old way, OSDArray + // OBSOLETE -- soon to be deleted + else if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) { OSDArray urls = (OSDArray)(args["service_urls"]); for (int i = 0; i < urls.Count / 2; i++) From b20ab1063f5717a69fb3226c44b4af5228280d35 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 5 Feb 2011 17:57:30 -0800 Subject: [PATCH 3/9] Added a couple of console commands to help diagnose issues: show circuits: shows the lists of agent circuit data show http-handlers: shows the currently registered http handlers --- .../Servers/HttpServer/BaseHttpServer.cs | 32 ++++++++++++ OpenSim/Region/Application/OpenSim.cs | 50 +++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index d4ee7ba56d..4c35132ad1 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -143,6 +143,11 @@ namespace OpenSim.Framework.Servers.HttpServer } } + public List GetStreamHandlerKeys() + { + return new List(m_streamHandlers.Keys); + } + private static string GetHandlerKey(string httpMethod, string path) { return httpMethod + ":" + path; @@ -179,6 +184,11 @@ namespace OpenSim.Framework.Servers.HttpServer } } + public List GetXmlRpcHandlerKeys() + { + return new List(m_rpcHandlers.Keys); + } + public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler) { //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName); @@ -196,6 +206,12 @@ namespace OpenSim.Framework.Servers.HttpServer return false; } + public List GetHTTPHandlerKeys() + { + return new List(m_HTTPHandlers.Keys); + } + + public bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args) { bool pollHandlerResult = false; @@ -214,6 +230,12 @@ namespace OpenSim.Framework.Servers.HttpServer return false; } + public List GetPollServiceHandlerKeys() + { + return new List(m_pollHandlers.Keys); + } + + // Note that the agent string is provided simply to differentiate // the handlers - it is NOT required to be an actual agent header // value. @@ -232,6 +254,11 @@ namespace OpenSim.Framework.Servers.HttpServer return false; } + public List GetAgentHandlerKeys() + { + return new List(m_agentHandlers.Keys); + } + public bool AddLLSDHandler(string path, LLSDMethod handler) { lock (m_llsdHandlers) @@ -245,6 +272,11 @@ namespace OpenSim.Framework.Servers.HttpServer return false; } + public List GetLLSDHandlerKeys() + { + return new List(m_llsdHandlers.Keys); + } + public bool SetDefaultLLSDHandler(DefaultLLSDMethod handler) { m_defaultLlsdHandler = handler; diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index ed4b6203c7..bbcc588fcc 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -294,6 +294,14 @@ namespace OpenSim "show connections", "Show connection data", HandleShow); + m_console.Commands.AddCommand("region", false, "show circuits", + "show circuits", + "Show agent circuit data", HandleShow); + + m_console.Commands.AddCommand("region", false, "show http-handlers", + "show http-handlers", + "Show all registered http handlers", HandleShow); + m_console.Commands.AddCommand("region", false, "show modules", "show modules", "Show module data", HandleShow); @@ -943,6 +951,48 @@ namespace OpenSim MainConsole.Instance.Output(connections.ToString()); break; + case "circuits": + System.Text.StringBuilder acd = new System.Text.StringBuilder("Agent Circuits:\n"); + m_sceneManager.ForEachScene( + delegate(Scene scene) + { + //this.HttpServer. + acd.AppendFormat("{0}:\n", scene.RegionInfo.RegionName); + foreach (AgentCircuitData aCircuit in scene.AuthenticateHandler.AgentCircuits.Values) + acd.AppendFormat("\t{0} {1} ({2})\n", aCircuit.firstname, aCircuit.lastname, (aCircuit.child ? "Child" : "Root")); + } + ); + + MainConsole.Instance.Output(acd.ToString()); + break; + + case "http-handlers": + System.Text.StringBuilder handlers = new System.Text.StringBuilder("Registered HTTP Handlers:\n"); + + handlers.AppendFormat("* XMLRPC:\n"); + foreach (String s in HttpServer.GetXmlRpcHandlerKeys()) + handlers.AppendFormat("\t{0}\n", s); + + handlers.AppendFormat("* HTTP:\n"); + List poll = HttpServer.GetPollServiceHandlerKeys(); + foreach (String s in HttpServer.GetHTTPHandlerKeys()) + handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty)); + + handlers.AppendFormat("* Agent:\n"); + foreach (String s in HttpServer.GetAgentHandlerKeys()) + handlers.AppendFormat("\t{0}\n", s); + + handlers.AppendFormat("* LLSD:\n"); + foreach (String s in HttpServer.GetLLSDHandlerKeys()) + handlers.AppendFormat("\t{0}\n", s); + + handlers.AppendFormat("* StreamHandlers ({0}):\n", HttpServer.GetStreamHandlerKeys().Count); + foreach (String s in HttpServer.GetStreamHandlerKeys()) + handlers.AppendFormat("\t{0}\n", s); + + MainConsole.Instance.Output(handlers.ToString()); + break; + case "modules": MainConsole.Instance.Output("The currently loaded shared modules are:"); foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules) From 30fa5ad1e29df50de99611b43adfd577696bfdda Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 5 Feb 2011 19:21:12 -0800 Subject: [PATCH 4/9] One more diagnosis command: show caps --- .../Agent/Capabilities/CapabilitiesModule.cs | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs index c023a6f738..75df6cc512 100644 --- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs @@ -26,12 +26,14 @@ */ using System; +using System.Collections; using System.Collections.Generic; using System.Reflection; using log4net; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; +using OpenSim.Framework.Console; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using Caps=OpenSim.Framework.Capabilities.Caps; @@ -61,6 +63,10 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities { m_scene = scene; m_scene.RegisterModuleInterface(this); + MainConsole.Instance.Commands.AddCommand("Capabilities", false, "show caps", + "show capabilities", + "Shows all registered capabilities", CapabilitiesCommand); + m_log.Error("\n\n**************************************************************\n\n"); } public void RegionLoaded(Scene scene) @@ -72,7 +78,9 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities m_scene.UnregisterModuleInterface(this); } - public void PostInitialise() {} + public void PostInitialise() + { + } public void Close() {} @@ -226,5 +234,23 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities m_log.Info(" >> "+x+", "+y+": "+kvp.Value); } } + + private void CapabilitiesCommand(string module, string[] cmdparams) + { + System.Text.StringBuilder caps = new System.Text.StringBuilder(); + caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName); + + foreach (KeyValuePair kvp in m_capsHandlers) + { + caps.AppendFormat("** User {0}:\n", kvp.Key); + for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.CapsDetails.GetEnumerator(); kvp2.MoveNext(); ) + { + Uri uri = new Uri(kvp2.Value.ToString()); + caps.AppendFormat(" {0} = {1}\n", kvp2.Key, uri.PathAndQuery); + } + } + + MainConsole.Instance.Output(caps.ToString()); + } } } From cc81d924cab97889538c20e9bfa45008ecfead3e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 5 Feb 2011 19:34:02 -0800 Subject: [PATCH 5/9] Fixed Caps handlers leak --- OpenSim/Framework/Capabilities/CapsHandlers.cs | 2 +- .../Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/OpenSim/Framework/Capabilities/CapsHandlers.cs b/OpenSim/Framework/Capabilities/CapsHandlers.cs index 864e6ddb7e..e1c800e907 100644 --- a/OpenSim/Framework/Capabilities/CapsHandlers.cs +++ b/OpenSim/Framework/Capabilities/CapsHandlers.cs @@ -88,8 +88,8 @@ namespace OpenSim.Framework.Capabilities /// handler to be removed public void Remove(string capsName) { - // This line must be here, or caps will break! m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path); + m_httpListener.RemoveStreamHandler("GET", m_capsHandlers[capsName].Path); m_capsHandlers.Remove(capsName); } diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs index 75df6cc512..1d8e70ed54 100644 --- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs @@ -66,7 +66,6 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities MainConsole.Instance.Commands.AddCommand("Capabilities", false, "show caps", "show capabilities", "Shows all registered capabilities", CapabilitiesCommand); - m_log.Error("\n\n**************************************************************\n\n"); } public void RegionLoaded(Scene scene) From 3411d4867d01d4cf87f09300f69d149c5269c611 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 5 Feb 2011 19:40:55 -0800 Subject: [PATCH 6/9] Honor check of m_Enabled in WorldViewModule. --- .../Region/OptionalModules/World/WorldView/WorldViewModule.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs index d4b7020542..cee8851c3a 100644 --- a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs +++ b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs @@ -71,6 +71,9 @@ namespace OpenSim.Region.OptionalModules.World.WorldView public void RegionLoaded(Scene scene) { + if (!m_Enabled) + return; + m_Generator = scene.RequestModuleInterface(); if (m_Generator == null) { From 2c7e87c45bb0d543ba0ab9342a1bc29f92fb4fd3 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 6 Feb 2011 07:51:20 -0800 Subject: [PATCH 7/9] Better output for show neighbours --- .../Grid/LocalGridServiceConnector.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 023a44c601..3c36799050 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs @@ -247,13 +247,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid public void NeighboursCommand(string module, string[] cmdparams) { + System.Text.StringBuilder caps = new System.Text.StringBuilder(); + foreach (KeyValuePair kvp in m_LocalCache) { - m_log.InfoFormat("*** Neighbours of {0} {1} ***", kvp.Key, kvp.Value.RegionName); + caps.AppendFormat("*** Neighbours of {0} ({1}) ***\n", kvp.Value.RegionName, kvp.Key); List regions = kvp.Value.GetNeighbours(); foreach (GridRegion r in regions) - m_log.InfoFormat(" {0} @ {1}={2}", r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize); + caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize); } + + MainConsole.Instance.Output(caps.ToString()); } } From 98ea78fc77b3dd6da185d71dfab402a0ef8780d6 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 6 Feb 2011 19:39:29 -0800 Subject: [PATCH 8/9] New command: show pending-objects --- OpenSim/Region/Application/OpenSim.cs | 22 +++++++++++++++++++ .../Framework/Interfaces/ISceneViewer.cs | 1 + .../Region/Framework/Scenes/SceneViewer.cs | 8 +++++++ 3 files changed, 31 insertions(+) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index bbcc588fcc..bd1aa468ed 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -302,6 +302,10 @@ namespace OpenSim "show http-handlers", "Show all registered http handlers", HandleShow); + m_console.Commands.AddCommand("region", false, "show pending-objects", + "show pending-objects", + "Show # of objects on the pending queues of all scene viewers", HandleShow); + m_console.Commands.AddCommand("region", false, "show modules", "show modules", "Show module data", HandleShow); @@ -993,6 +997,24 @@ namespace OpenSim MainConsole.Instance.Output(handlers.ToString()); break; + case "pending-objects": + System.Text.StringBuilder pending = new System.Text.StringBuilder("Pending objects:\n"); + m_sceneManager.ForEachScene( + delegate(Scene scene) + { + scene.ForEachScenePresence( + delegate(ScenePresence sp) + { + pending.AppendFormat("{0}: {1} {2} pending\n", + scene.RegionInfo.RegionName, sp.Name, sp.SceneViewer.GetPendingObjectsCount()); + } + ); + } + ); + + MainConsole.Instance.Output(pending.ToString()); + break; + case "modules": MainConsole.Instance.Output("The currently loaded shared modules are:"); foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules) diff --git a/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs b/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs index 7251d57f69..2397f223b3 100644 --- a/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs +++ b/OpenSim/Region/Framework/Interfaces/ISceneViewer.cs @@ -36,5 +36,6 @@ namespace OpenSim.Region.Framework.Interfaces void Close(); void QueuePartForUpdate(SceneObjectPart part); void SendPrimUpdates(); + int GetPendingObjectsCount(); } } diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index b44a0100a4..7c067ca148 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs @@ -205,6 +205,14 @@ namespace OpenSim.Region.Framework.Scenes Reset(); } + public int GetPendingObjectsCount() + { + if (m_pendingObjects != null) + return m_pendingObjects.Count; + + return 0; + } + public class ScenePartUpdate { public UUID FullID; From ebeef02fef1a04b5b4cfe13dad588bcce7f9ba21 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 7 Feb 2011 07:45:03 -0800 Subject: [PATCH 9/9] Hunting down mantis #5365 Revert "refactor: remove redundant null checks" This reverts commit 6e58996b4d9db202cd7795a37bd687362effef48. --- .../LindenUDP/UnackedPacketCollection.cs | 45 ++++++++++++------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs index 9d40688ac6..d762bef134 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs @@ -141,31 +141,46 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void ProcessQueues() { // Process all the pending adds + OutgoingPacket pendingAdd; - while (m_pendingAdds.TryDequeue(out pendingAdd)) - m_packets[pendingAdd.SequenceNumber] = pendingAdd; + if (m_pendingAdds != null) + { + while (m_pendingAdds.TryDequeue(out pendingAdd)) + { + if (pendingAdd != null && m_packets != null) + { + m_packets[pendingAdd.SequenceNumber] = pendingAdd; + } + } + } // Process all the pending removes, including updating statistics and round-trip times PendingAck pendingRemove; OutgoingPacket ackedPacket; - while (m_pendingRemoves.TryDequeue(out pendingRemove)) + if (m_pendingRemoves != null) { - if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) + while (m_pendingRemoves.TryDequeue(out pendingRemove)) { - m_packets.Remove(pendingRemove.SequenceNumber); - - // Update stats - Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); - - if (!pendingRemove.FromResend) + if (m_pendingRemoves != null && m_packets != null) { - // Calculate the round-trip time for this packet and its ACK - int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; - if (rtt > 0) - ackedPacket.Client.UpdateRoundTrip(rtt); + if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) + { + m_packets.Remove(pendingRemove.SequenceNumber); + + // Update stats + Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); + + if (!pendingRemove.FromResend) + { + // Calculate the round-trip time for this packet and its ACK + int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; + if (rtt > 0) + ackedPacket.Client.UpdateRoundTrip(rtt); + } + } } } } } } -} \ No newline at end of file +}