From ebe5e1731d24e68ec7a8aa61a397f5febc1c2662 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 15 Feb 2012 01:45:25 +0000 Subject: In ObjectTortureTests, run garbage collector on Teardown and run scene loop update when scene objects have been deleted. At least on mono 2.6.4, running GC.Collect() is not guaranteed to force gc of all objects when run in the same method where those objects had references. Therefore, GC.Collect() is now being done in the per-script teardown of ObjectTortureTests. In addition, scene loop update is being run after garbage collection in order to clean out the viewer update list of scene objects in the SceneGraph. These measures mean that scene objects/parts are now garbage collected after a test run if deleted from the scene, resulting in a much better memory usage report (though probably still not very accurate). However, deletion takes a very long time - what's really needed is to find out now why the entire scene isn't being GC'd by this measure. This change hasn't yet been applied to the other stress tests. --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 10 +++--- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 ++ .../Scenes/Tests/SceneObjectBasicTests.cs | 41 ++++++++++++++++++++-- 3 files changed, 47 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 693a79e..e66678a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -359,7 +359,7 @@ namespace OpenSim.Region.Framework.Scenes m_log.ErrorFormat( "[SCENEGRAPH]: Tried to add scene object {0} to {1} with illegal UUID of {2}", sceneObject.Name, m_parentScene.RegionInfo.RegionName, UUID.Zero); - + return false; } @@ -368,12 +368,12 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()", // m_parentScene.RegionInfo.RegionName, sceneObject.UUID); - + return false; } - + // m_log.DebugFormat( -// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", +// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", // sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName); SceneObjectPart[] parts = sceneObject.Parts; @@ -409,7 +409,7 @@ namespace OpenSim.Region.Framework.Scenes lock (SceneObjectGroupsByFullID) SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; - + lock (SceneObjectGroupsByFullPartID) { foreach (SceneObjectPart part in parts) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4c339d9..b130bf7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -303,6 +303,9 @@ namespace OpenSim.Region.Framework.Scenes // ~SceneObjectPart() // { +// Console.WriteLine( +// "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", +// Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); // m_log.DebugFormat( // "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", // Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 80f198d..7737d8e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs @@ -27,6 +27,7 @@ using System; using System.Reflection; +using System.Threading; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; @@ -43,6 +44,42 @@ namespace OpenSim.Region.Framework.Scenes.Tests [TestFixture] public class SceneObjectBasicTests { +// [TearDown] +// public void TearDown() +// { +// Console.WriteLine("TearDown"); +// GC.Collect(); +// Thread.Sleep(3000); +// } + +// public class GcNotify +// { +// public static AutoResetEvent gcEvent = new AutoResetEvent(false); +// private static bool _initialized = false; +// +// public static void Initialize() +// { +// if (!_initialized) +// { +// _initialized = true; +// new GcNotify(); +// } +// } +// +// private GcNotify(){} +// +// ~GcNotify() +// { +// if (!Environment.HasShutdownStarted && +// !AppDomain.CurrentDomain.IsFinalizingForUnload()) +// { +// Console.WriteLine("GcNotify called"); +// gcEvent.Set(); +// new GcNotify(); +// } +// } +// } + /// /// Test adding an object to a scene. /// @@ -147,11 +184,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void TestDeleteSceneObject() { TestHelpers.InMethod(); - + TestScene scene = SceneHelpers.SetupScene(); SceneObjectPart part = SceneHelpers.AddSceneObject(scene); scene.DeleteSceneObject(part.ParentGroup, false); - + SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); Assert.That(retrievedPart, Is.Null); } -- cgit v1.1 From 2b842958cc172fbf9ee79b495a268f012fb47cdc Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 16 Feb 2012 02:58:00 +0000 Subject: If shape properties fail SOP parsing (e.g. due to commas instead of decimal points) print out one short message listing the failing node names rather than lots of exceptions. Adds skeleton bad float values deserialization test --- .../Scenes/Serialization/SceneObjectSerializer.cs | 34 ++++++++++++++-------- 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 0a32214..e6b88a3 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Drawing; using System.IO; +using System.Linq; using System.Reflection; using System.Xml; using log4net; @@ -570,13 +571,15 @@ namespace OpenSim.Region.Framework.Scenes.Serialization private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) { - bool errors = false; - obj.Shape = ReadShape(reader, "Shape", out errors); + List errorNodeNames; + obj.Shape = ReadShape(reader, "Shape", out errorNodeNames); - if (errors) + if (errorNodeNames != null) + { m_log.DebugFormat( - "[SceneObjectSerializer]: Parsing PrimitiveBaseShape for object part {0} {1} encountered errors. Please see earlier log entries.", - obj.Name, obj.UUID); + "[SceneObjectSerializer]: Parsing PrimitiveBaseShape for object part {0} {1} encountered errors in properties {2}.", + obj.Name, obj.UUID, string.Join(", ", errorNodeNames.ToArray())); + } } private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader) @@ -1519,37 +1522,44 @@ namespace OpenSim.Region.Framework.Scenes.Serialization /// /// /// The name of the xml element containing the shape - /// true if any errors were encountered during parsing, false otherwise + /// a list containing the failing node names. If no failures then null. /// The shape parsed - public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out bool errors) + public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out List errorNodeNames) { - errors = false; + List internalErrorNodeNames = null; PrimitiveBaseShape shape = new PrimitiveBaseShape(); if (reader.IsEmptyElement) { reader.Read(); + errorNodeNames = null; return shape; } reader.ReadStartElement(name, String.Empty); // Shape - errors = ExternalRepresentationUtils.ExecuteReadProcessors( + ExternalRepresentationUtils.ExecuteReadProcessors( shape, m_ShapeXmlProcessors, reader, (o, nodeName, e) => { - m_log.DebugFormat( - "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}", - nodeName, e.Message, e.StackTrace); +// m_log.DebugFormat( +// "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}", +// nodeName, e.Message, e.StackTrace); + if (internalErrorNodeNames == null) + internalErrorNodeNames = new List(); + + internalErrorNodeNames.Add(nodeName); } ); reader.ReadEndElement(); // Shape + errorNodeNames = internalErrorNodeNames; + return shape; } -- cgit v1.1 From 4486b7d8e8aaa7f98e0003ce06fc0e145903f6b9 Mon Sep 17 00:00:00 2001 From: PixelTomsen Date: Thu, 16 Feb 2012 00:07:12 +0100 Subject: Fix: Object owned by the group does not return to the last owner http://opensimulator.org/mantis/view.php?id=5404 --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 5a5307c..9d9729e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1926,7 +1926,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (SceneObjectGroup g in deleteGroups) { - AddReturn(g.OwnerID, g.Name, g.AbsolutePosition, "parcel owner return"); + AddReturn(g.OwnerID == g.GroupID ? g.LastOwnerID : g.OwnerID, g.Name, g.AbsolutePosition, "parcel owner return"); } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 5b838f8..878476e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1330,7 +1330,7 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat( "[SCENE OBJECT GROUP]: Returning object {0} due to parcel autoreturn", RootPart.UUID); - m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel autoreturn"); + m_scene.AddReturn(OwnerID == GroupID ? LastOwnerID : OwnerID, Name, AbsolutePosition, "parcel autoreturn"); m_scene.DeRezObjects(null, new List() { RootPart.LocalId }, UUID.Zero, DeRezAction.Return, UUID.Zero); -- cgit v1.1 From ba98d6fffe03389d6538a11d5eec45c863964403 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 17 Feb 2012 08:03:53 -0500 Subject: Fix missing telehub handling on login --- OpenSim/Region/Framework/Scenes/Scene.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4c8e2d2..ecc553d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3427,6 +3427,27 @@ namespace OpenSim.Region.Framework.Scenes agent.startpos.Z = 720; } } + + // Honor Estate teleport routing via Telehubs + if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && RegionInfo.EstateSettings.AllowDirectTeleport == false) + { + SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); + // Can have multiple SpawnPoints + List spawnpoints = RegionInfo.RegionSettings.SpawnPoints(); + if ( spawnpoints.Count > 1) + { + // We have multiple SpawnPoints, Route the agent to a random one + agent.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count)].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); + } + else + { + // We have a single SpawnPoint and will route the agent to it + agent.startpos = spawnpoints[0].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); + } + + return true; + } + // Honor parcel landing type and position. if (land != null) { -- cgit v1.1 From 6baa13ab7aeb7d0ee08f2460f52961dbd79bada1 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 17 Feb 2012 09:12:41 -0800 Subject: Add new and updated script events --- OpenSim/Region/Framework/Scenes/EventManager.cs | 58 ++++++++++++++++++++-- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 12 +++++ 2 files changed, 67 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index d31d380..34d3da7 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -184,10 +184,62 @@ namespace OpenSim.Region.Framework.Scenes public event ClientClosed OnClientClosed; + // Fired when a script is created + // The indication that a new script exists in this region. + public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID); + public event NewScript OnNewScript; + public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID) + { + NewScript handlerNewScript = OnNewScript; + if (handlerNewScript != null) + { + foreach (NewScript d in handlerNewScript.GetInvocationList()) + { + try + { + d(clientID, part, itemID); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerNewScript failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } + + //TriggerUpdateScript: triggered after Scene receives client's upload of updated script and stores it as asset + // An indication that the script has changed. + public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID); + public event UpdateScript OnUpdateScript; + public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID) + { + UpdateScript handlerUpdateScript = OnUpdateScript; + if (handlerUpdateScript != null) + { + foreach (UpdateScript d in handlerUpdateScript.GetInvocationList()) + { + try + { + d(clientId, itemId, primId, isScriptRunning, newAssetID); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerUpdateScript failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } + /// - /// This is fired when a scene object property that a script might be interested in (such as color, scale or - /// inventory) changes. Only enough information is sent for the LSL changed event - /// (see http://lslwiki.net/lslwiki/wakka.php?wakka=changed) + /// ScriptChangedEvent is fired when a scene object property that a script might be interested + /// in (such as color, scale or inventory) changes. Only enough information sent is for the LSL changed event. + /// This is not an indication that the script has changed (see OnUpdateScript for that). + /// This event is sent to a script to tell it that some property changed on + /// the object the script is in. See http://lslwiki.net/lslwiki/wakka.php?wakka=changed . /// public event ScriptChangedEvent OnScriptChangedEvent; public delegate void ScriptChangedEvent(uint localID, uint change); diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 9d9729e..6cc78b8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -283,6 +283,10 @@ namespace OpenSim.Region.Framework.Scenes { remoteClient.SendAgentAlertMessage("Script saved", false); } + + // Tell anyone managing scripts that a script has been reloaded/changed + EventManager.TriggerUpdateScript(remoteClient.AgentId, itemId, primId, isScriptRunning, item.AssetID); + part.ParentGroup.ResumeScripts(); return errors; } @@ -1624,9 +1628,13 @@ namespace OpenSim.Region.Framework.Scenes // have state in inventory part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0); + // tell anyone watching that there is a new script in town + EventManager.TriggerNewScript(agentID, part, copyID); + // m_log.InfoFormat("[PRIMINVENTORY]: " + // "Rezzed script {0} into prim local ID {1} for user {2}", // item.inventoryName, localID, remoteClient.Name); + part.ParentGroup.ResumeScripts(); return part; @@ -1707,6 +1715,10 @@ namespace OpenSim.Region.Framework.Scenes part.Inventory.AddInventoryItem(taskItem, false); part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); + + // tell anyone managing scripts that a new script exists + EventManager.TriggerNewScript(agentID, part, taskItem.ItemID); + part.ParentGroup.ResumeScripts(); return part; -- cgit v1.1