From 739eb14741151716bf1325c0d73a95e6ee8c148d Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 25 Aug 2010 23:04:12 +0200 Subject: [PATCH 1/3] Change some e.Message to e.ToString. Don't use e.Message, it doesn't carry any useful information. Error messages are useless without location information. It looks more elegant, but is totally pointless. --- .../Servers/HttpServer/SynchronousRestFormsRequester.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index b0cf34d16e..acf725abb2 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -81,7 +81,7 @@ namespace OpenSim.Framework.Servers.HttpServer } catch (Exception e) { - m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: {1}", requestUrl, e.Message); + m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); } finally { @@ -112,7 +112,7 @@ namespace OpenSim.Framework.Servers.HttpServer } catch (Exception e) { - m_log.DebugFormat("[FORMS]: exception occured on receiving reply {0}", e.Message); + m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString()); } finally { From 604423d52bb66b1cc08adac557450addc7ebc94b Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 25 Aug 2010 23:11:00 +0200 Subject: [PATCH 2/3] Make scene object directories more robust and prevent deleted SOP's from sticking around --- OpenSim/Region/Framework/Scenes/Scene.cs | 1 - OpenSim/Region/Framework/Scenes/SceneGraph.cs | 46 ++++++++++++------- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b808c6d74c..f4cbe1f128 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3159,7 +3159,6 @@ namespace OpenSim.Region.Framework.Scenes } m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); - //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); } diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 31faeec620..58a7661ab2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -95,7 +95,6 @@ namespace OpenSim.Region.Framework.Scenes protected internal Dictionary SceneObjectGroupsByLocalID = new Dictionary(); protected internal Dictionary SceneObjectGroupsByFullID = new Dictionary(); - private readonly Object m_dictionary_lock = new Object(); private Object m_updateLock = new Object(); @@ -136,11 +135,10 @@ namespace OpenSim.Region.Framework.Scenes m_scenePresenceArray = newlist; } - lock (m_dictionary_lock) - { + lock (SceneObjectGroupsByFullID) SceneObjectGroupsByFullID.Clear(); + lock (SceneObjectGroupsByLocalID) SceneObjectGroupsByLocalID.Clear(); - } Entities.Clear(); } @@ -395,15 +393,17 @@ namespace OpenSim.Region.Framework.Scenes if (OnObjectCreate != null) OnObjectCreate(sceneObject); - lock (m_dictionary_lock) + lock (SceneObjectGroupsByFullID) { SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; + foreach (SceneObjectPart part in sceneObject.Children.Values) + SceneObjectGroupsByFullID[part.UUID] = sceneObject; + } + lock (SceneObjectGroupsByLocalID) + { SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; foreach (SceneObjectPart part in sceneObject.Children.Values) - { - SceneObjectGroupsByFullID[part.UUID] = sceneObject; SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; - } } } @@ -418,24 +418,32 @@ namespace OpenSim.Region.Framework.Scenes { if (Entities.ContainsKey(uuid)) { + SceneObjectGroup grp = (SceneObjectGroup)Entities[uuid]; + if (!resultOfObjectLinked) { m_numPrim -= ((SceneObjectGroup) Entities[uuid]).Children.Count; - if ((((SceneObjectGroup)Entities[uuid]).RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) - { - RemovePhysicalPrim(((SceneObjectGroup)Entities[uuid]).Children.Count); - } + if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) + RemovePhysicalPrim(grp.Children.Count); } if (OnObjectRemove != null) OnObjectRemove(Entities[uuid]); - lock (m_dictionary_lock) + lock (SceneObjectGroupsByFullID) { - SceneObjectGroupsByFullID.Remove(uuid); - SceneObjectGroupsByLocalID.Remove(((SceneObjectGroup)Entities[uuid]).LocalId); + foreach (SceneObjectPart part in grp.Children.Values) + SceneObjectGroupsByFullID.Remove(part.UUID); + SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); } + lock (SceneObjectGroupsByLocalID) + { + foreach (SceneObjectPart part in grp.Children.Values) + SceneObjectGroupsByLocalID.Remove(part.LocalId); + SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); + } + Entities.Remove(uuid); //SceneObjectGroup part; //((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) @@ -860,7 +868,9 @@ namespace OpenSim.Region.Framework.Scenes { if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog)) { - return sog; + if (sog.HasChildPrim(localID)) + return sog; + SceneObjectGroupsByLocalID.Remove(localID); } } @@ -896,7 +906,9 @@ namespace OpenSim.Region.Framework.Scenes { if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog)) { - return sog; + if (sog.Children.ContainsKey(fullID)) + return sog; + SceneObjectGroupsByFullID.Remove(fullID); } } From 75e2a2b3ceeb67d3124bc8b4534b6927d288fd57 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 25 Aug 2010 23:34:39 +0200 Subject: [PATCH 3/3] Prevent an object disposed exception that made forms comms unreliable. After starting an asynchronous write, one should not close the channel it will be written to synchrnously, that leads to grief. --- .../Servers/HttpServer/SynchronousRestFormsRequester.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index acf725abb2..b2c1c54954 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs @@ -85,8 +85,13 @@ namespace OpenSim.Framework.Servers.HttpServer } finally { - if (requestStream != null) - requestStream.Close(); + // If this is closed, it will be disposed internally, + // but the above write is asynchronous and may hit after + // we're through here. So the thread handling that will + // throw and put us back into the catch above. Isn't + // .NET great? + //if (requestStream != null) + // requestStream.Close(); // Let's not close this //buffer.Close();