aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2012-02-16 00:38:04 +0000
committerMelanie2012-02-16 00:38:04 +0000
commit0c1074537b8a83e68861a6f1a37db68214153165 (patch)
tree99212d4dbc1bab4ea6e620fab6853c576667232e
parentMerge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into ... (diff)
parentFix some logic mistakes where firstly osNpcCreate() without options was creat... (diff)
downloadopensim-SC_OLD-0c1074537b8a83e68861a6f1a37db68214153165.zip
opensim-SC_OLD-0c1074537b8a83e68861a6f1a37db68214153165.tar.gz
opensim-SC_OLD-0c1074537b8a83e68861a6f1a37db68214153165.tar.bz2
opensim-SC_OLD-0c1074537b8a83e68861a6f1a37db68214153165.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs41
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs17
-rw-r--r--OpenSim/Tests/Common/Mock/TestScene.cs3
-rw-r--r--OpenSim/Tests/Torture/ObjectTortureTests.cs21
8 files changed, 87 insertions, 14 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 6dd42dd..5405358 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -406,7 +406,7 @@ namespace OpenSim.Region.Framework.Scenes
406 m_log.ErrorFormat( 406 m_log.ErrorFormat(
407 "[SCENEGRAPH]: Tried to add scene object {0} to {1} with illegal UUID of {2}", 407 "[SCENEGRAPH]: Tried to add scene object {0} to {1} with illegal UUID of {2}",
408 sceneObject.Name, m_parentScene.RegionInfo.RegionName, UUID.Zero); 408 sceneObject.Name, m_parentScene.RegionInfo.RegionName, UUID.Zero);
409 409
410 return false; 410 return false;
411 } 411 }
412 412
@@ -415,12 +415,12 @@ namespace OpenSim.Region.Framework.Scenes
415// m_log.DebugFormat( 415// m_log.DebugFormat(
416// "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()", 416// "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()",
417// m_parentScene.RegionInfo.RegionName, sceneObject.UUID); 417// m_parentScene.RegionInfo.RegionName, sceneObject.UUID);
418 418
419 return false; 419 return false;
420 } 420 }
421 421
422// m_log.DebugFormat( 422// m_log.DebugFormat(
423// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", 423// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}",
424// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName); 424// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName);
425 425
426 SceneObjectPart[] parts = sceneObject.Parts; 426 SceneObjectPart[] parts = sceneObject.Parts;
@@ -456,7 +456,7 @@ namespace OpenSim.Region.Framework.Scenes
456 456
457 lock (SceneObjectGroupsByFullID) 457 lock (SceneObjectGroupsByFullID)
458 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; 458 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
459 459
460 lock (SceneObjectGroupsByFullPartID) 460 lock (SceneObjectGroupsByFullPartID)
461 { 461 {
462 foreach (SceneObjectPart part in parts) 462 foreach (SceneObjectPart part in parts)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index ac39b6b..6cde89c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -314,6 +314,9 @@ namespace OpenSim.Region.Framework.Scenes
314 314
315// ~SceneObjectPart() 315// ~SceneObjectPart()
316// { 316// {
317// Console.WriteLine(
318// "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}",
319// Name, LocalId, ParentGroup.Name, ParentGroup.LocalId);
317// m_log.DebugFormat( 320// m_log.DebugFormat(
318// "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}", 321// "[SCENE OBJECT PART]: Destructor called for {0}, local id {1}, parent {2} {3}",
319// Name, LocalId, ParentGroup.Name, ParentGroup.LocalId); 322// 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 @@
27 27
28using System; 28using System;
29using System.Reflection; 29using System.Reflection;
30using System.Threading;
30using NUnit.Framework; 31using NUnit.Framework;
31using OpenMetaverse; 32using OpenMetaverse;
32using OpenSim.Framework; 33using OpenSim.Framework;
@@ -43,6 +44,42 @@ namespace OpenSim.Region.Framework.Scenes.Tests
43 [TestFixture] 44 [TestFixture]
44 public class SceneObjectBasicTests 45 public class SceneObjectBasicTests
45 { 46 {
47// [TearDown]
48// public void TearDown()
49// {
50// Console.WriteLine("TearDown");
51// GC.Collect();
52// Thread.Sleep(3000);
53// }
54
55// public class GcNotify
56// {
57// public static AutoResetEvent gcEvent = new AutoResetEvent(false);
58// private static bool _initialized = false;
59//
60// public static void Initialize()
61// {
62// if (!_initialized)
63// {
64// _initialized = true;
65// new GcNotify();
66// }
67// }
68//
69// private GcNotify(){}
70//
71// ~GcNotify()
72// {
73// if (!Environment.HasShutdownStarted &&
74// !AppDomain.CurrentDomain.IsFinalizingForUnload())
75// {
76// Console.WriteLine("GcNotify called");
77// gcEvent.Set();
78// new GcNotify();
79// }
80// }
81// }
82
46 /// <summary> 83 /// <summary>
47 /// Test adding an object to a scene. 84 /// Test adding an object to a scene.
48 /// </summary> 85 /// </summary>
@@ -147,11 +184,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
147 public void TestDeleteSceneObject() 184 public void TestDeleteSceneObject()
148 { 185 {
149 TestHelpers.InMethod(); 186 TestHelpers.InMethod();
150 187
151 TestScene scene = SceneHelpers.SetupScene(); 188 TestScene scene = SceneHelpers.SetupScene();
152 SceneObjectPart part = SceneHelpers.AddSceneObject(scene); 189 SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
153 scene.DeleteSceneObject(part.ParentGroup, false); 190 scene.DeleteSceneObject(part.ParentGroup, false);
154 191
155 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 192 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
156 Assert.That(retrievedPart, Is.Null); 193 Assert.That(retrievedPart, Is.Null);
157 } 194 }
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index d395206..ae46c97 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -121,8 +121,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
121 npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue); 121 npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue);
122 122
123 m_log.DebugFormat( 123 m_log.DebugFormat(
124 "[NPC MODULE]: Creating NPC {0} {1} {2} at {3} in {4}", 124 "[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}",
125 firstname, lastname, npcAvatar.AgentId, position, scene.RegionInfo.RegionName); 125 firstname, lastname, npcAvatar.AgentId, owner, senseAsAgent, position, scene.RegionInfo.RegionName);
126 126
127 AgentCircuitData acd = new AgentCircuitData(); 127 AgentCircuitData acd = new AgentCircuitData();
128 acd.AgentID = npcAvatar.AgentId; 128 acd.AgentID = npcAvatar.AgentId;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index c83df4e..331cffd 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2254,7 +2254,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2254 firstname, lastname, position, notecard, 2254 firstname, lastname, position, notecard,
2255 (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0, 2255 (options & ScriptBaseClass.OS_NPC_NOT_OWNED) == 0,
2256 false); 2256 false);
2257// (options & ScriptBaseClass.OS_NPC_SENSE_AS_AGENT) == 0); 2257// (options & ScriptBaseClass.OS_NPC_SENSE_AS_AGENT) != 0);
2258 } 2258 }
2259 2259
2260 private LSL_Key NpcCreate( 2260 private LSL_Key NpcCreate(
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 5c200d6..83da204 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using log4net; 33using log4net;
34
35using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
37using OpenSim.Region.ScriptEngine.Shared; 36using OpenSim.Region.ScriptEngine.Shared;
@@ -41,6 +40,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
41{ 40{
42 public class SensorRepeat 41 public class SensorRepeat
43 { 42 {
43// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44
44 public AsyncCommandManager m_CmdManager; 45 public AsyncCommandManager m_CmdManager;
45 46
46 public SensorRepeat(AsyncCommandManager CmdManager) 47 public SensorRepeat(AsyncCommandManager CmdManager)
@@ -452,11 +453,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
452 453
453 Action<ScenePresence> senseEntity = new Action<ScenePresence>(presence => 454 Action<ScenePresence> senseEntity = new Action<ScenePresence>(presence =>
454 { 455 {
456// m_log.DebugFormat(
457// "[SENSOR REPEAT]: Inspecting scene presence {0}, type {1} on sensor sweep for {2}, type {3}",
458// presence.Name, presence.PresenceType, ts.name, ts.type);
459
455 if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc) 460 if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc)
456 { 461 {
457 INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); 462 INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
458 if (npcData == null || !npcData.SenseAsAgent) 463 if (npcData == null || !npcData.SenseAsAgent)
464 {
465// m_log.DebugFormat(
466// "[SENSOR REPEAT]: Discarding NPC {0} from agent sense sweep for script item id {1}",
467// presence.Name, ts.itemID);
459 return; 468 return;
469 }
460 } 470 }
461 471
462 if ((ts.type & AGENT) == 0) 472 if ((ts.type & AGENT) == 0)
@@ -469,7 +479,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
469 { 479 {
470 INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); 480 INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene);
471 if (npcData != null && npcData.SenseAsAgent) 481 if (npcData != null && npcData.SenseAsAgent)
482 {
483// m_log.DebugFormat(
484// "[SENSOR REPEAT]: Discarding NPC {0} from non-agent sense sweep for script item id {1}",
485// presence.Name, ts.itemID);
472 return; 486 return;
487 }
473 } 488 }
474 } 489 }
475 490
diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs
index 328cd2b..eea68c3 100644
--- a/OpenSim/Tests/Common/Mock/TestScene.cs
+++ b/OpenSim/Tests/Common/Mock/TestScene.cs
@@ -50,7 +50,8 @@ namespace OpenSim.Tests.Common.Mock
50 50
51 ~TestScene() 51 ~TestScene()
52 { 52 {
53 Console.WriteLine("TestScene destructor called for {0}", RegionInfo.RegionName); 53 //Console.WriteLine("TestScene destructor called for {0}", RegionInfo.RegionName);
54 Console.WriteLine("TestScene destructor called");
54 } 55 }
55 56
56 /// <summary> 57 /// <summary>
diff --git a/OpenSim/Tests/Torture/ObjectTortureTests.cs b/OpenSim/Tests/Torture/ObjectTortureTests.cs
index 74b336e..e83186a 100644
--- a/OpenSim/Tests/Torture/ObjectTortureTests.cs
+++ b/OpenSim/Tests/Torture/ObjectTortureTests.cs
@@ -49,6 +49,13 @@ namespace OpenSim.Tests.Torture
49 [TestFixture] 49 [TestFixture]
50 public class ObjectTortureTests 50 public class ObjectTortureTests
51 { 51 {
52 [TearDown]
53 public void TearDown()
54 {
55 GC.Collect();
56 GC.WaitForPendingFinalizers();
57 }
58
52// [Test] 59// [Test]
53// public void Test0000Clean() 60// public void Test0000Clean()
54// { 61// {
@@ -141,8 +148,18 @@ namespace OpenSim.Tests.Torture
141 string.Format("Object {0} could not be retrieved", i)); 148 string.Format("Object {0} could not be retrieved", i));
142 } 149 }
143 150
144 // This does not work to fire the SceneObjectGroup destructors - something else is hanging on to them. 151 // When a scene object is added to a scene, it is placed in the update list for sending to viewers
145// scene.DeleteAllSceneObjects(); 152 // (though in this case we have none). When it is deleted, it is not removed from the update which is
153 // fine since it will later be ignored.
154 //
155 // However, that means that we need to manually run an update here to clear out that list so that deleted
156 // objects will be clean up by the garbage collector before the next stress test is run.
157 scene.Update();
158
159 // Currently, we need to do this in order to garbage collect the scene objects ready for the next test run.
160 // However, what we really need to do is find out why the entire scene is not garbage collected in
161 // teardown.
162 scene.DeleteAllSceneObjects();
146 163
147 Console.WriteLine( 164 Console.WriteLine(
148 "Took {0}ms, {1}MB ({2} - {3}) to create {4} objects each containing {5} prim(s)", 165 "Took {0}ms, {1}MB ({2} - {3}) to create {4} objects each containing {5} prim(s)",