From c1d064e1ca1e7ddfb9da851654a6a430747b871f Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 22 Mar 2012 23:16:52 +0000 Subject: [PATCH 01/10] Comment out a terrain save-tile debugging message that accidentally crept in with c4b2d24 --- .../CoreModules/World/Terrain/TerrainModule.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index f6ddc66147..9cd8f2beb3 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -598,12 +598,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain "[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}", m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions); } - else - { - m_log.ErrorFormat( - "[TERRAIN]: Could not save terrain from {0} to {1}. {2} {3} {4} {5} {6} {7}", - m_scene.RegionInfo.RegionName, filename, fileWidth, fileHeight, fileStartX, fileStartY, offsetX, offsetY); - } +// else +// { +// m_log.ErrorFormat( +// "[TERRAIN]: Could not save terrain from {0} to {1}. {2} {3} {4} {5} {6} {7}", +// m_scene.RegionInfo.RegionName, filename, fileWidth, fileHeight, fileStartX, fileStartY, offsetX, offsetY); +// } } /// From 15c2499ccdaf3b461a17557ae473e942dd62a26e Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 22 Mar 2012 23:31:41 +0000 Subject: [PATCH 02/10] Comment out login parameters debug output accidentally included with c4b2d24 --- .../Server/Handlers/Login/LLLoginHandlers.cs | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index ed62f95f46..f83a23998a 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -73,17 +73,19 @@ namespace OpenSim.Server.Handlers.Login if (requestData != null) { - foreach (string key in requestData.Keys) - { - object value = requestData[key]; - Console.WriteLine("{0}:{1}", key, value); - if (value is ArrayList) - { - ICollection col = value as ICollection; - foreach (object item in col) - Console.WriteLine(" {0}", item); - } - } + // Debug code to show exactly what login parameters the viewer is sending us. + // TODO: Extract into a method that can be generally applied if one doesn't already exist. +// foreach (string key in requestData.Keys) +// { +// object value = requestData[key]; +// Console.WriteLine("{0}:{1}", key, value); +// if (value is ArrayList) +// { +// ICollection col = value as ICollection; +// foreach (object item in col) +// Console.WriteLine(" {0}", item); +// } +// } if (requestData.ContainsKey("first") && requestData["first"] != null && requestData.ContainsKey("last") && requestData["last"] != null && ( From 40b9b519b89f5da08e1e6b6557934bfd39b4f90b Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 23 Mar 2012 00:12:14 +0000 Subject: [PATCH 03/10] Add commented out section on collisions switch in Scene.SetSceneCoreDebug(). This was not implemented before the recent changes but should be at some point. --- OpenSim/Region/Framework/Scenes/Scene.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 76e632e45d..9d882c03e0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1074,6 +1074,12 @@ namespace OpenSim.Region.Framework.Scenes m_physics_enabled = enablePhysics; } +// if (options.ContainsKey("collisions")) +// { +// // TODO: Implement. If false, should stop objects colliding, though possibly should still allow +// // the avatar themselves to collide with the ground. +// } + if (options.ContainsKey("teleport")) { bool enableTeleportDebugging; From c903813e00e894475aff75c1b7eec3f8d4b3986c Mon Sep 17 00:00:00 2001 From: BlueWall Date: Thu, 22 Mar 2012 20:49:45 -0400 Subject: [PATCH 04/10] RegionReady logging Some maintenance to clean up logging messages --- .../RegionReadyModule/RegionReadyModule.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index d0142a40e3..0b9f875e89 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -70,8 +70,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady public void Initialise(IConfigSource config) { - //m_log.Info("[RegionReady] Initialising"); - m_config = config.Configs["RegionReady"]; if (m_config != null) { @@ -84,9 +82,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady m_uri = m_config.GetString("alert_uri",string.Empty); } } - -// if (!m_enabled) -// m_log.Info("[RegionReady] disabled."); } public void AddRegion(Scene scene) @@ -113,7 +108,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady { scene.LoginLock = true; scene.LoginsDisabled = true; - m_log.InfoFormat("[RegionReady]: Logins disabled for {0}",m_scene.RegionInfo.RegionName); + m_log.InfoFormat("[RegionReady]: Region {0} - logins disabled during initialization.",m_scene.RegionInfo.RegionName); if(m_uri != string.Empty) { @@ -167,7 +162,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady void OnEmptyScriptCompileQueue(int numScriptsFailed, string message) { - m_log.InfoFormat("[RegionReady]: Script compile queue empty!"); + m_log.DebugFormat("[RegionReady]: Script compile queue empty!"); if (m_firstEmptyCompileQueue || m_oarFileLoading) { @@ -194,7 +189,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady c.SenderUUID = UUID.Zero; c.Scene = m_scene; - m_log.InfoFormat("[RegionReady]: Region \"{0}\" is ready: \"{1}\" on channel {2}", + m_log.DebugFormat("[RegionReady]: Region \"{0}\" is ready: \"{1}\" on channel {2}", m_scene.RegionInfo.RegionName, c.Message, m_channelNotify); m_scene.EventManager.TriggerOnChatBroadcast(this, c); @@ -210,7 +205,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady { m_lastOarLoadedOk = true; } else { - m_log.InfoFormat("[RegionReady]: Oar file load errors: {0}", message); + m_log.WarnFormat("[RegionReady]: Oar file load errors: {0}", message); m_lastOarLoadedOk = false; } } @@ -233,7 +228,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); - m_log.InfoFormat("[RegionReady]: Logins enabled for {0}", m_scene.RegionInfo.RegionName); + m_log.InfoFormat("[RegionReady]: Initialization complete - logins enabled for {0}", m_scene.RegionInfo.RegionName); if ( m_uri != string.Empty ) { From 08b8ebcc7e71038894fa47757db6d6aa5bb66d00 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 23 Mar 2012 00:54:37 +0000 Subject: [PATCH 05/10] Use m_lastFrameTick instead of m_lastUpdate in Scene.GetHealth(). m_lastUpdate is no longer properly updated and is redundant anyway. --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9d882c03e0..16ce1ba2e5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4504,8 +4504,8 @@ namespace OpenSim.Region.Framework.Scenes // int health=1; // Start at 1, means we're up - if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000) - health+=1; + if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) + health += 1; else return health; From bc2963d42ab998551603b74361b26d5dfd5d0acd Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 23 Mar 2012 01:03:10 +0000 Subject: [PATCH 06/10] Comment out unused scene loop restart code. This has actually been unused since at least 0.7.2 due to earlier changes. --- OpenSim/Region/Framework/Scenes/Scene.cs | 41 +++++++++++++----------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 16ce1ba2e5..d89d94d2f2 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -216,9 +216,7 @@ namespace OpenSim.Region.Framework.Scenes // TODO: Possibly stop other classes being able to manipulate this directly. private SceneGraph m_sceneGraph; private volatile int m_bordersLocked; -// private int m_RestartTimerCounter; private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing -// private int m_incrementsof15seconds; private volatile bool m_backingup; private Dictionary m_returns = new Dictionary(); private Dictionary m_groupsWithTargets = new Dictionary(); @@ -226,12 +224,17 @@ namespace OpenSim.Region.Framework.Scenes private bool m_physics_enabled = true; private bool m_scripts_enabled = true; private string m_defaultScriptEngine; + + /// + /// Tick at which the last login occurred. + /// private int m_LastLogin; + private Thread HeartbeatThread; private volatile bool shuttingdown; - private int m_lastUpdate; - private bool m_firstHeartbeat = true; +// private int m_lastUpdate; +// private bool m_firstHeartbeat = true; private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; private bool m_reprioritizationEnabled = true; @@ -801,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes m_permissions = new ScenePermissions(this); - m_lastUpdate = Util.EnvironmentTickCount(); +// m_lastUpdate = Util.EnvironmentTickCount(); } #endregion @@ -1170,7 +1173,7 @@ namespace OpenSim.Region.Framework.Scenes HeartbeatThread.Abort(); HeartbeatThread = null; } - m_lastUpdate = Util.EnvironmentTickCount(); +// m_lastUpdate = Util.EnvironmentTickCount(); HeartbeatThread = Watchdog.StartThread( @@ -1222,8 +1225,8 @@ namespace OpenSim.Region.Framework.Scenes while (!shuttingdown) Update(-1); - m_lastUpdate = Util.EnvironmentTickCount(); - m_firstHeartbeat = false; +// m_lastUpdate = Util.EnvironmentTickCount(); +// m_firstHeartbeat = false; } finally { @@ -2541,7 +2544,7 @@ namespace OpenSim.Region.Framework.Scenes = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; - CheckHeartbeat(); +// CheckHeartbeat(); ScenePresence sp = GetScenePresence(client.AgentId); @@ -3117,7 +3120,7 @@ namespace OpenSim.Region.Framework.Scenes public override void RemoveClient(UUID agentID, bool closeChildAgents) { - CheckHeartbeat(); +// CheckHeartbeat(); bool isChildAgent = false; ScenePresence avatar = GetScenePresence(agentID); if (avatar != null) @@ -4516,7 +4519,7 @@ namespace OpenSim.Region.Framework.Scenes else return health; - CheckHeartbeat(); +// CheckHeartbeat(); return health; } @@ -4704,14 +4707,14 @@ namespace OpenSim.Region.Framework.Scenes return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; } - private void CheckHeartbeat() - { - if (m_firstHeartbeat) - return; - - if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000) - StartTimer(); - } +// private void CheckHeartbeat() +// { +// if (m_firstHeartbeat) +// return; +// +// if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) +// StartTimer(); +// } public override ISceneObject DeserializeObject(string representation) { From a9995ede65d1327413ae5c5e9b2e6f6dcf0f11c2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 23 Mar 2012 01:08:13 +0000 Subject: [PATCH 07/10] Fix bug in ScenePresenceAnimator.RemoveAnimation() introduced in commit 1a8769e Forgot to uppercase the animation name for default animations, since for some reason we store and use them in upper rather than lowercase. --- .../Framework/Scenes/Animation/ScenePresenceAnimator.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index cded9be47d..f5623bdf69 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -125,7 +125,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations // are referenced with lower case names! - UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name); + UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name.ToUpper()); if (animID == UUID.Zero) return; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d89d94d2f2..6fea5ff883 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1159,9 +1159,9 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Start the timer which triggers regular scene updates + /// Start the scene loop /// - public void StartTimer() + public void Start() { // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); From 4ee8b3e23edc9ca11cf3d17f24fddfdcbfd8c1cc Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 23 Mar 2012 01:11:43 +0000 Subject: [PATCH 08/10] Fix build break --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6fea5ff883..8a4c6c966c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1161,7 +1161,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Start the scene loop /// - public void Start() + public void StartTimer() { // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); From 18b3f1132eeb28e51d84e028e4fd69048150ccb7 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 23 Mar 2012 01:21:43 +0000 Subject: [PATCH 09/10] Rename Scene.StartTimer() to Start() - this method no longer uses a timer. Comment out more effectively unused old heartbeat code. --- OpenSim/Region/Application/OpenSimBase.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 49 ++++++++++++----------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index c6956fc2b9..484159ce15 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -430,7 +430,7 @@ namespace OpenSim mscene = scene; - scene.StartTimer(); + scene.Start(); scene.StartScripts(); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8a4c6c966c..d354ef05ad 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -211,7 +211,7 @@ namespace OpenSim.Region.Framework.Scenes /// private bool m_cleaningTemps = false; - private Object m_heartbeatLock = new Object(); +// private Object m_heartbeatLock = new Object(); // TODO: Possibly stop other classes being able to manipulate this directly. private SceneGraph m_sceneGraph; @@ -1159,9 +1159,9 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Start the scene loop + /// Start the scene /// - public void StartTimer() + public void Start() { // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); @@ -1206,33 +1206,34 @@ namespace OpenSim.Region.Framework.Scenes /// private void Heartbeat() { - if (!Monitor.TryEnter(m_heartbeatLock)) - { - Watchdog.RemoveThread(); - return; - } +// if (!Monitor.TryEnter(m_heartbeatLock)) +// { +// Watchdog.RemoveThread(); +// return; +// } - try - { - m_eventManager.TriggerOnRegionStarted(this); +// try +// { - // The first frame can take a very long time due to physics actors being added on startup. Therefore, - // don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false - // alarms for scenes with many objects. - Update(1); - Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; + m_eventManager.TriggerOnRegionStarted(this); - while (!shuttingdown) - Update(-1); + // The first frame can take a very long time due to physics actors being added on startup. Therefore, + // don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false + // alarms for scenes with many objects. + Update(1); + Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; + + while (!shuttingdown) + Update(-1); // m_lastUpdate = Util.EnvironmentTickCount(); // m_firstHeartbeat = false; - } - finally - { - Monitor.Pulse(m_heartbeatLock); - Monitor.Exit(m_heartbeatLock); - } +// } +// finally +// { +// Monitor.Pulse(m_heartbeatLock); +// Monitor.Exit(m_heartbeatLock); +// } Watchdog.RemoveThread(); } From 349454ca2740d5eb5d465f0d45ebd49975556dd5 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 23 Mar 2012 01:46:11 +0000 Subject: [PATCH 10/10] Remove unnecessary shutting down check in Scene.Heartbeat(). Add some method doc. Rename HeartbeatThread, shuttingdown to conform to code standards. --- OpenSim/Region/Framework/Scenes/Scene.cs | 37 +++++++++++++----------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d354ef05ad..09b91c05bd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -230,8 +230,19 @@ namespace OpenSim.Region.Framework.Scenes /// private int m_LastLogin; - private Thread HeartbeatThread; - private volatile bool shuttingdown; + /// + /// Thread that runs the scene loop. + /// + private Thread m_heartbeatThread; + + /// + /// True if these scene is in the process of shutting down or is shutdown. + /// + public bool ShuttingDown + { + get { return m_shuttingDown; } + } + private volatile bool m_shuttingDown; // private int m_lastUpdate; // private bool m_firstHeartbeat = true; @@ -811,11 +822,6 @@ namespace OpenSim.Region.Framework.Scenes #region Startup / Close Methods - public bool ShuttingDown - { - get { return shuttingdown; } - } - /// /// The scene graph for this scene /// @@ -1134,8 +1140,7 @@ namespace OpenSim.Region.Framework.Scenes ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); // Stop updating the scene objects and agents. - //m_heartbeatTimer.Close(); - shuttingdown = true; + m_shuttingDown = true; m_log.Debug("[SCENE]: Persisting changed objects"); EventManager.TriggerSceneShuttingDown(this); @@ -1168,14 +1173,14 @@ namespace OpenSim.Region.Framework.Scenes //m_heartbeatTimer.Enabled = true; //m_heartbeatTimer.Interval = (int)(m_timespan * 1000); //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); - if (HeartbeatThread != null) + if (m_heartbeatThread != null) { - HeartbeatThread.Abort(); - HeartbeatThread = null; + m_heartbeatThread.Abort(); + m_heartbeatThread = null; } // m_lastUpdate = Util.EnvironmentTickCount(); - HeartbeatThread + m_heartbeatThread = Watchdog.StartThread( Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); } @@ -1222,9 +1227,7 @@ namespace OpenSim.Region.Framework.Scenes // alarms for scenes with many objects. Update(1); Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; - - while (!shuttingdown) - Update(-1); + Update(-1); // m_lastUpdate = Util.EnvironmentTickCount(); // m_firstHeartbeat = false; @@ -1252,7 +1255,7 @@ namespace OpenSim.Region.Framework.Scenes List coarseLocations; List avatarUUIDs; - while (!shuttingdown && (endFrame == null || Frame < endFrame)) + while (!m_shuttingDown && (endFrame == null || Frame < endFrame)) { maintc = Util.EnvironmentTickCount(); ++Frame;