From cacc02883526d6913be13d745215d7367708412e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 17 Nov 2011 21:03:08 +0000 Subject: If the entire simulator is shutting down then don't bother to unload the scripts from the appdomain in XEngine. All the other actions (script state save, etc.) still occur. This makes shutdown where there are many scripts vastly quicker. --- OpenSim/Region/Framework/Scenes/EventManager.cs | 26 +++++++++++++++---------- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 26 ++++++++++++++++++------- 2 files changed, 35 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 4906665..4a4d98f 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -98,9 +98,10 @@ namespace OpenSim.Region.Framework.Scenes public event OnPluginConsoleDelegate OnPluginConsole; - public delegate void OnShutdownDelegate(); - - public event OnShutdownDelegate OnShutdown; + /// + /// Triggered when the entire simulator is shutdown. + /// + public event Action OnShutdown; public delegate void ObjectDeGrabDelegate(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); public delegate void ScriptResetDelegate(uint localID, UUID itemID); @@ -113,9 +114,14 @@ namespace OpenSim.Region.Framework.Scenes public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; - public delegate void SceneShuttingDownDelegate(Scene scene); - - public event SceneShuttingDownDelegate OnSceneShuttingDown; + /// + /// Triggered when an individual scene is shutdown. + /// + /// + /// This does not automatically mean that the entire simulator is shutting down. Listen to OnShutdown for that + /// notification. + /// + public event Action OnSceneShuttingDown; /// /// Fired when an object is touched/grabbed. @@ -869,10 +875,10 @@ namespace OpenSim.Region.Framework.Scenes public void TriggerShutdown() { - OnShutdownDelegate handlerShutdown = OnShutdown; + Action handlerShutdown = OnShutdown; if (handlerShutdown != null) { - foreach (OnShutdownDelegate d in handlerShutdown.GetInvocationList()) + foreach (Action d in handlerShutdown.GetInvocationList()) { try { @@ -2212,10 +2218,10 @@ namespace OpenSim.Region.Framework.Scenes public void TriggerSceneShuttingDown(Scene s) { - SceneShuttingDownDelegate handler = OnSceneShuttingDown; + Action handler = OnSceneShuttingDown; if (handler != null) { - foreach (SceneShuttingDownDelegate d in handler.GetInvocationList()) + foreach (Action d in handler.GetInvocationList()) { try { diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 1c16c87..12e1a78 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -90,6 +90,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine private bool m_KillTimedOutScripts; private string m_ScriptEnginesPath = null; + /// + /// Is the entire simulator in the process of shutting down? + /// + private bool m_SimulatorShuttingDown; + private static List m_ScriptEngines = new List(); @@ -470,17 +475,22 @@ namespace OpenSim.Region.ScriptEngine.XEngine // instance.DestroyScriptInstance(); - // Unload scripts and app domains + // Unload scripts and app domains. // Must be done explicitly because they have infinite - // lifetime - // - m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); - if (m_DomainScripts[instance.AppDomain].Count == 0) + // lifetime. + // However, don't bother to do this if the simulator is shutting + // down since it takes a long time with many scripts. + if (!m_SimulatorShuttingDown) { - m_DomainScripts.Remove(instance.AppDomain); - UnloadAppDomain(instance.AppDomain); + m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); + if (m_DomainScripts[instance.AppDomain].Count == 0) + { + m_DomainScripts.Remove(instance.AppDomain); + UnloadAppDomain(instance.AppDomain); + } } } + m_Scripts.Clear(); m_PrimObjects.Clear(); m_Assemblies.Clear(); @@ -1428,6 +1438,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine public void OnShutdown() { + m_SimulatorShuttingDown = true; + List instances = new List(); lock (m_Scripts) -- cgit v1.1 From 352672eaf2d07a210d2d0de97944dac48250828d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 17 Nov 2011 22:13:32 +0000 Subject: Make "terrain save" more friendly by telling the user if we have saved and putting out a useful complaint message if we haven't for some reason --- .../CoreModules/World/Terrain/TerrainModule.cs | 50 ++++++++++++++-------- 1 file changed, 32 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index c832520..428440e 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -86,6 +86,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain private volatile bool m_tainted; private readonly Stack m_undo = new Stack(5); + /// + /// Human readable list of terrain file extensions that are supported. + /// + private string m_supportedFileExtensions = ""; + #region ICommandableModule Members public ICommander CommandInterface @@ -135,6 +140,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain InstallDefaultEffects(); LoadPlugins(); + + // Generate user-readable extensions list + string supportedFilesSeparator = ""; + + foreach (KeyValuePair loader in m_loaders) + { + m_supportedFileExtensions += supportedFilesSeparator + loader.Key + " (" + loader.Value + ")"; + supportedFilesSeparator = ", "; + } } public void RegionLoaded(Scene scene) @@ -251,20 +265,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain if (filename.EndsWith(loader.Key)) { loader.Value.SaveFile(filename, m_channel); + m_log.InfoFormat("[TERRAIN]: Saved terrain from {0} to {1}", m_scene.RegionInfo.RegionName, filename); return; } } } - catch (NotImplementedException) - { - m_log.Error("Unable to save to " + filename + ", saving of this file format has not been implemented."); - throw new TerrainException(String.Format("Unable to save heightmap: saving of this file format not implemented")); - } catch (IOException ioe) { m_log.Error(String.Format("[TERRAIN]: Unable to save to {0}, {1}", filename, ioe.Message)); throw new TerrainException(String.Format("Unable to save heightmap: {0}", ioe.Message)); } + + m_log.ErrorFormat( + "[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}", + m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions); } /// @@ -345,6 +359,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain float duration = 0.25f; if (action == 0) duration = 4.0f; + client_OnModifyTerrain(user, (float)pos.Z, duration, size, action, pos.Y, pos.X, pos.Y, pos.X, agentId); } @@ -534,6 +549,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain m_channel = channel; UpdateRevertMap(); } + return; } } @@ -566,10 +582,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain fileWidth, fileHeight, (int)Constants.RegionSize, (int)Constants.RegionSize); + + m_log.InfoFormat("[TERRAIN]: Saved terrain from {0} to {1}", m_scene.RegionInfo.RegionName, filename); } + return; } } + + m_log.ErrorFormat( + "[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}", + m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions); } } @@ -1124,32 +1147,23 @@ namespace OpenSim.Region.CoreModules.World.Terrain private void InstallInterfaces() { - // Load / Save - string supportedFileExtensions = ""; - string supportedFilesSeparator = ""; - foreach (KeyValuePair loader in m_loaders) - { - supportedFileExtensions += supportedFilesSeparator + loader.Key + " (" + loader.Value + ")"; - supportedFilesSeparator = ", "; - } - Command loadFromFileCommand = new Command("load", CommandIntentions.COMMAND_HAZARDOUS, InterfaceLoadFile, "Loads a terrain from a specified file."); loadFromFileCommand.AddArgument("filename", "The file you wish to load from, the file extension determines the loader to be used. Supported extensions include: " + - supportedFileExtensions, "String"); + m_supportedFileExtensions, "String"); Command saveToFileCommand = new Command("save", CommandIntentions.COMMAND_NON_HAZARDOUS, InterfaceSaveFile, "Saves the current heightmap to a specified file."); saveToFileCommand.AddArgument("filename", "The destination filename for your heightmap, the file extension determines the format to save in. Supported extensions include: " + - supportedFileExtensions, "String"); + m_supportedFileExtensions, "String"); Command loadFromTileCommand = new Command("load-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceLoadTileFile, "Loads a terrain from a section of a larger file."); loadFromTileCommand.AddArgument("filename", "The file you wish to load from, the file extension determines the loader to be used. Supported extensions include: " + - supportedFileExtensions, "String"); + m_supportedFileExtensions, "String"); loadFromTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer"); loadFromTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer"); loadFromTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file", @@ -1161,7 +1175,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain new Command("save-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceSaveTileFile, "Saves the current heightmap to the larger file."); saveToTileCommand.AddArgument("filename", "The file you wish to save to, the file extension determines the loader to be used. Supported extensions include: " + - supportedFileExtensions, "String"); + m_supportedFileExtensions, "String"); saveToTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer"); saveToTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer"); saveToTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file", -- cgit v1.1 From 9c928e9dc63a03e652aa5614fc1053351aad0ed1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 17 Nov 2011 22:15:46 +0000 Subject: For TerrainModule.SaveToFile(), don't bother throwing the exception onwards after printing out the error, since this method is invoked by users. Still throwing the exception on the stream method since this invoked programatically --- OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 428440e..cf000a4 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -273,7 +273,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain catch (IOException ioe) { m_log.Error(String.Format("[TERRAIN]: Unable to save to {0}, {1}", filename, ioe.Message)); - throw new TerrainException(String.Format("Unable to save heightmap: {0}", ioe.Message)); } m_log.ErrorFormat( -- cgit v1.1 From 01ae916bad672722aa62ee712b7b580d6f5f4370 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 19 Nov 2011 00:07:34 +0000 Subject: Don't register a region twice on both official registration and maptile regeneration. Maptile storage appears orthogonal to region registration --- OpenSim/Region/Framework/Scenes/Scene.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f10789b..47450ed 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -5017,18 +5017,16 @@ namespace OpenSim.Region.Framework.Scenes return offsets.ToArray(); } + /// + /// Regenerate the maptile for this scene. + /// + /// + /// public void RegenerateMaptile(object sender, ElapsedEventArgs e) { IWorldMapModule mapModule = RequestModuleInterface(); if (mapModule != null) - { mapModule.GenerateMaptile(); - - string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo)); - - if (error != String.Empty) - throw new Exception(error); - } } // This method is called across the simulation connector to -- cgit v1.1 From 10a23a823edb261af2c0b7895ce0898ea6918ef1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 19 Nov 2011 01:16:07 +0000 Subject: Get rid of the spurious [WEB UTIL] couldn't decode : Invalid character 'O' in input string messages These are just the result of an attempt to canonicalize received messages - it's not important that we constantly log them. Also finally get the deregister grid service message working properly --- OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 0e22156..d76ed3e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -174,7 +174,6 @@ namespace OpenSim.Region.Framework.Scenes { // We're ignoring a collection was modified error because this data gets old and outdated fast. } - } /// @@ -182,13 +181,18 @@ namespace OpenSim.Region.Framework.Scenes /// protected void SendCloseChildAgent(UUID agentID, ulong regionHandle) { - m_log.Debug("[INTERGRID]: Sending close agent to " + regionHandle); // let's do our best, but there's not much we can do if the neighbour doesn't accept. //m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID); uint x = 0, y = 0; Utils.LongToUInts(regionHandle, out x, out y); + GridRegion destination = m_scene.GridService.GetRegionByPosition(m_regionInfo.ScopeID, (int)x, (int)y); + + m_log.DebugFormat( + "[INTERGRID]: Sending close agent {0} to region at {1}-{2}", + agentID, destination.RegionCoordX, destination.RegionCoordY); + m_scene.SimulationService.CloseAgent(destination, agentID); } -- cgit v1.1 From 726ca72c479dc5c9510631e675c932f1331e92bb Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 19 Nov 2011 01:27:06 +0000 Subject: minor: Make HelloNeighbour messages more informative --- .../Neighbour/LocalNeighbourServiceConnector.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs index f71bf46..40cc536 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs @@ -25,11 +25,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using log4net; -using Nini.Config; using System; using System.Collections.Generic; using System.Reflection; +using log4net; +using Nini.Config; +using OpenMetaverse; using OpenSim.Framework; using OpenSim.Server.Base; using OpenSim.Region.Framework.Interfaces; @@ -119,10 +120,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour #region INeighbourService - public GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) + public OpenSim.Services.Interfaces.GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) { - m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from {0}, to {1}.", - thisRegion.RegionName, regionHandle); + uint x, y; + Utils.LongToUInts(regionHandle, out x, out y); + + m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from region {0} to region at {1}-{2}", + thisRegion.RegionName, x / Constants.RegionSize, y / Constants.RegionSize); + foreach (Scene s in m_Scenes) { if (s.RegionInfo.RegionHandle == regionHandle) -- cgit v1.1 From 2206e2fc9680240ce8ddad985998febc18896850 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 19 Nov 2011 01:32:21 +0000 Subject: Remove the "[LOCAL SIMULATION CONNECTOR]: Did not find region {0} for SendCreateChildAgent" message This is misleading since a simulator will call this method before successfully trying remote regions. Also comments out spammy "[SIMULATION]: Stream handler called" AgentHandlers messages for now. --- .../ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 2cf02b5..a17c6ae 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs @@ -196,7 +196,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation } } - m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Did not find region {0} for SendCreateChildAgent", destination.RegionName); reason = "Did not find region " + destination.RegionName; return false; } -- cgit v1.1