From 805b7ccb3e45c5233dd771a5e4a2fe01a5dfb4fc Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Dec 2014 20:35:49 +0000 Subject: minor: improve logged error in XEngine.SetXmlState if there was a problem writing the linemap. The previous error report of already exists is inaccurate since existing files do get overwritten. --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/XEngine') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index a4113d6..e5c11d8 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -2155,7 +2155,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine catch (IOException ex) { // if there already exists a file at that location, it may be locked. - m_log.ErrorFormat("[XEngine]: Linemap file {0} already exists! {1}", mappath, ex.Message); + m_log.Error( + string.Format("[XEngine]: Linemap file {0} could not be written. Exception ", mappath), ex); } } } -- cgit v1.1 From c3c05a86939de9669c1065d0a738a2a9b0f30c27 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Dec 2014 20:48:17 +0000 Subject: Reintroduce general xengine extra debugging log level. This can be controlled at runtime with the command "debug xengine log ", as with similar commands. If log level is 1 then every script load is logged. This means the section in OpenSim.exe.config is no longer needed to avoid log spam on regions with many scripts and can be removed. --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 63 +++++++++++++------------- 1 file changed, 32 insertions(+), 31 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/XEngine') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index e5c11d8..bd11451 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -70,7 +70,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine /// /// If DebugLevel >= 1, then we log every time that a script is started. /// -// public int DebugLevel { get; set; } + public int DebugLevel { get; set; } private SmartThreadPool m_ThreadPool; private int m_MaxScriptQueue; @@ -403,12 +403,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine + "Level >= 2, log event invocations.\n", HandleDebugScriptLogCommand); -// MainConsole.Instance.Commands.AddCommand( -// "Debug", false, "debug xengine", "debug xengine []", -// "Turn on detailed xengine debugging.", -// "If level <= 0, then no extra logging is done.\n" -// + "If level >= 1, then we log every time that a script is started.", -// HandleDebugLevelCommand); + MainConsole.Instance.Commands.AddCommand( + "Debug", false, "debug xengine log", "debug xengine log []", + "Turn on detailed xengine debugging.", + "If level <= 0, then no extra logging is done.\n" + + "If level >= 1, then we log every time that a script is started.", + HandleDebugLevelCommand); } private void HandleDebugScriptLogCommand(string module, string[] args) @@ -451,26 +451,26 @@ namespace OpenSim.Region.ScriptEngine.XEngine /// /// /// -// private void HandleDebugLevelCommand(string module, string[] args) -// { -// if (args.Length == 3) -// { -// int newDebug; -// if (int.TryParse(args[2], out newDebug)) -// { -// DebugLevel = newDebug; -// MainConsole.Instance.OutputFormat("Debug level set to {0}", newDebug); -// } -// } -// else if (args.Length == 2) -// { -// MainConsole.Instance.OutputFormat("Current debug level is {0}", DebugLevel); -// } -// else -// { -// MainConsole.Instance.Output("Usage: debug xengine 0..1"); -// } -// } + private void HandleDebugLevelCommand(string module, string[] args) + { + if (args.Length <= 4) + { + int newDebug; + if (ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, args[3], out newDebug)) + { + DebugLevel = newDebug; + MainConsole.Instance.OutputFormat("Debug level set to {0} in XEngine for region {1}", newDebug, m_Scene.Name); + } + } + else if (args.Length == 3) + { + MainConsole.Instance.OutputFormat("Current debug level is {0}", DebugLevel); + } + else + { + MainConsole.Instance.Output("Usage: debug xengine log "); + } + } /// /// Parse the raw item id into a script instance from the command params if it's present. @@ -1148,10 +1148,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine return false; } - m_log.DebugFormat( - "[XEngine]: Loading script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}", - part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID, - part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName); + if (DebugLevel > 0) + m_log.DebugFormat( + "[XEngine]: Loading script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}", + part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID, + part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName); UUID assetID = item.AssetID; -- cgit v1.1 From d34ad345d5f6a8e57b4262e72b38e60e8623de30 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Dec 2014 21:08:43 +0000 Subject: minor: If we are recompiling scripts in response to a ScriptStopStrategy config change (a rare situation), then explicitly log this for debug purposes. --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/XEngine') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index bd11451..752b397 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -1349,7 +1349,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine // simulator session if the script halt strategy has been changed. Instead, we'll continue with // the existing DLL and the new one will be used in the next simulator session. if (recompile) + { + m_log.DebugFormat( + "[XEngine]: Recompiling script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5} to switch it to {6} termination. Will be active on next restart.", + part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID, + part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.Name, + m_coopTermination ? "co-op" : "abort"); + m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, true, out assemblyPath, out linemap); + } instance = new ScriptInstance(this, part, item, -- cgit v1.1 From 76722d832486b521610ee422dfa4c78a5797f3a9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 9 Dec 2014 23:59:19 +0000 Subject: In XEngine, enqueue a script rez to the compile queue after setting m_CompileDict to avoid a rare but not impossible race condition. --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/XEngine') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 752b397..7ff82e6 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -1020,11 +1020,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine } else { - m_CompileQueue.Enqueue(parms); lock (m_CompileDict) - { m_CompileDict[itemID] = 0; - } + + // This must occur after the m_CompileDict so that an existing compile thread cannot hit the check + // in DoOnRezScript() before m_CompileDict has been updated. + m_CompileQueue.Enqueue(parms); // m_log.DebugFormat("[XEngine]: Added script {0} to compile queue", itemID); -- cgit v1.1 From 227d2e2b616ad52331b387f2dbf3392583f194f6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 10 Dec 2014 00:04:10 +0000 Subject: Avoid a possible race condition where the XEngine script compile thread could complete but see OnRezScript() insert a new job and complete before it set m_CurrentCompile = null If the above happened, it would mean the new script would not compile until some script was added for compilation. --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/XEngine') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 7ff82e6..ccd5d99 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -1101,7 +1101,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine // due to a race condition // lock (m_CompileQueue) + { m_CurrentCompile = null; + + // This is to avoid a situation where the m_CompileQueue while loop above could complete but + // OnRezScript() place a new script on the queue and check m_CurrentCompile = null before we hit + // this section. + if (m_CompileQueue.Count > 0) + m_CurrentCompile = m_ThreadPool.QueueWorkItem(DoOnRezScriptQueue, null); + } } return null; -- cgit v1.1 From 2b9f0647de513f6a916d9d58d4e7883d30b804d3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 10 Dec 2014 00:25:27 +0000 Subject: Fix a regression where objects crossing regions in the same simulator (on their own or as attachments) with AppDomainLoading = false would create the new state in the source region area rather than the dest. This was beause the code was finding the script DLL compiled for the source region as everything is in the same appdomain and using this as the location for the destination script state, etc. This resolves the regression by passing the proper destination separately from the DLL retrieved. Probably a regression since commit d7b92604 (11 July 2014). Added regression test for this case. At least partly addresses http://opensimulator.org/mantis/view.php?id=7278 --- .../XEngine/Tests/XEngineBasicTests.cs | 4 +- .../XEngine/Tests/XEngineCrossingTests.cs | 195 +++++++++++++++++++++ OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 51 +++--- 3 files changed, 220 insertions(+), 30 deletions(-) create mode 100644 OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineCrossingTests.cs (limited to 'OpenSim/Region/ScriptEngine/XEngine') diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineBasicTests.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineBasicTests.cs index fe15157..878e571 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineBasicTests.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineBasicTests.cs @@ -40,10 +40,10 @@ using OpenSim.Tests.Common; namespace OpenSim.Region.ScriptEngine.XEngine.Tests { /// - /// XEngine tests. + /// Basic XEngine tests. /// [TestFixture] - public class XEngineTest : OpenSimTestCase + public class XEngineBasicTests : OpenSimTestCase { private TestScene m_scene; private XEngine m_xEngine; diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineCrossingTests.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineCrossingTests.cs new file mode 100644 index 0000000..587695f --- /dev/null +++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineCrossingTests.cs @@ -0,0 +1,195 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Threading; +using Nini.Config; +using NUnit.Framework; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.CoreModules.Framework.EntityTransfer; +using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.ScriptEngine.Shared; +using OpenSim.Tests.Common; + +namespace OpenSim.Region.ScriptEngine.XEngine.Tests +{ + /// + /// XEngine tests connected with crossing scripts between regions. + /// + [TestFixture] + public class XEngineCrossingTests : OpenSimTestCase + { + [TestFixtureSetUp] + public void FixtureInit() + { + // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. + Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest; + } + + [TestFixtureTearDown] + public void TearDown() + { + // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple + // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression + // tests really shouldn't). + Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; + } + + /// + /// Test script state preservation when a script crosses between regions on the same simulator. + /// + [Test] + public void TestScriptCrossOnSameSimulator() + { + TestHelpers.InMethod(); +// TestHelpers.EnableLogging(); + + UUID userId = TestHelpers.ParseTail(0x1); + int sceneObjectIdTail = 0x2; + + EntityTransferModule etmA = new EntityTransferModule(); + EntityTransferModule etmB = new EntityTransferModule(); + LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); + XEngine xEngineA = new XEngine(); + XEngine xEngineB = new XEngine(); + xEngineA.DebugLevel = 1; + xEngineB.DebugLevel = 1; + + IConfigSource configSource = new IniConfigSource(); + + IConfig startupConfig = configSource.AddConfig("Startup"); + startupConfig.Set("DefaultScriptEngine", "XEngine"); + + IConfig xEngineConfig = configSource.AddConfig("XEngine"); + xEngineConfig.Set("Enabled", "true"); + xEngineConfig.Set("StartDelay", "0"); + + // These tests will not run with AppDomainLoading = true, at least on mono. For unknown reasons, the call + // to AssemblyResolver.OnAssemblyResolve fails. + xEngineConfig.Set("AppDomainLoading", "false"); + + IConfig modulesConfig = configSource.AddConfig("Modules"); + modulesConfig.Set("EntityTransferModule", etmA.Name); + modulesConfig.Set("SimulationServices", lscm.Name); + + SceneHelpers sh = new SceneHelpers(); + TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000, configSource); + TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999, configSource); + + SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, configSource, lscm); + SceneHelpers.SetupSceneModules(sceneA, configSource, etmA, xEngineA); + SceneHelpers.SetupSceneModules(sceneB, configSource, etmB, xEngineB); + sceneA.StartScripts(); + sceneB.StartScripts(); + + SceneObjectGroup soSceneA = SceneHelpers.AddSceneObject(sceneA, 1, userId, "so1-", sceneObjectIdTail); + soSceneA.AbsolutePosition = new Vector3(128, 10, 20); + + // CREATE SCRIPT TODO + InventoryItemBase scriptItemSceneA = new InventoryItemBase(); + // itemTemplate.ID = itemId; + scriptItemSceneA.Name = "script1"; + scriptItemSceneA.Folder = soSceneA.UUID; + scriptItemSceneA.InvType = (int)InventoryType.LSL; + + AutoResetEvent chatEvent = new AutoResetEvent(false); + OSChatMessage messageReceived = null; + sceneA.EventManager.OnChatFromWorld += (s, m) => { messageReceived = m; chatEvent.Set(); }; + + sceneA.RezNewScript(userId, scriptItemSceneA, +@"integer c = 0; + +default +{ + state_entry() + { + llSay(0, ""Script running""); + } + + changed(integer change) + { + llSay(0, ""Changed""); + } + + touch_start(integer n) + { + c = c + 1; + llSay(0, (string)c); + } +}"); + + chatEvent.WaitOne(60000); + + Assert.That(messageReceived, Is.Not.Null, "No chat message received."); + Assert.That(messageReceived.Message, Is.EqualTo("Script running")); + + { + // XXX: Should not be doing this so directly. Should call some variant of EventManager.touch() instead. + DetectParams[] det = new DetectParams[1]; + det[0] = new DetectParams(); + det[0].Key = userId; + det[0].Populate(sceneA); + + EventParams ep = new EventParams("touch_start", new Object[] { new LSL_Types.LSLInteger(1) }, det); + + xEngineA.PostObjectEvent(soSceneA.LocalId, ep); + chatEvent.WaitOne(60000); + + Assert.That(messageReceived.Message, Is.EqualTo("1")); + } + + sceneB.EventManager.OnChatFromWorld += (s, m) => { messageReceived = m; chatEvent.Set(); }; + + // Cross with a negative value + soSceneA.AbsolutePosition = new Vector3(128, -10, 20); + + chatEvent.WaitOne(60000); + Assert.That(messageReceived.Message, Is.EqualTo("Changed")); + + // TEST sending event to moved prim and output + { + SceneObjectGroup soSceneB = sceneB.GetSceneObjectGroup(soSceneA.Name); + TaskInventoryItem scriptItemSceneB = soSceneB.RootPart.Inventory.GetInventoryItem(scriptItemSceneA.Name); + + // XXX: Should not be doing this so directly. Should call some variant of EventManager.touch() instead. + DetectParams[] det = new DetectParams[1]; + det[0] = new DetectParams(); + det[0].Key = userId; + det[0].Populate(sceneB); + + EventParams ep = new EventParams("touch_start", new Object[] { new LSL_Types.LSLInteger(1) }, det); + + xEngineB.PostObjectEvent(soSceneB.LocalId, ep); + chatEvent.WaitOne(60000); + + Assert.That(messageReceived.Message, Is.EqualTo("2")); + } + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index ccd5d99..71ed989 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -716,22 +716,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine { // Force a final state save // - if (m_Assemblies.ContainsKey(instance.AssetID)) + try { - string assembly = m_Assemblies[instance.AssetID]; - - try - { - instance.SaveState(assembly); - } - catch (Exception e) - { - m_log.Error( - string.Format( - "[XEngine]: Failed final state save for script {0}.{1}, item UUID {2}, prim UUID {3} in {4}. Exception ", - instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID, World.Name) - , e); - } + instance.SaveState(); + } + catch (Exception e) + { + m_log.Error( + string.Format( + "[XEngine]: Failed final state save for script {0}.{1}, item UUID {2}, prim UUID {3} in {4}. Exception ", + instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID, World.Name) + , e); } // Clear the event queue and abort the instance thread @@ -840,18 +835,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine foreach (IScriptInstance i in instances) { - string assembly = String.Empty; - - lock (m_Scripts) - { - if (!m_Assemblies.ContainsKey(i.AssetID)) - continue; - assembly = m_Assemblies[i.AssetID]; - } - try { - i.SaveState(assembly); + i.SaveState(); } catch (Exception e) { @@ -1180,7 +1166,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine lock (m_AddingAssemblies) { m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assemblyPath, out linemap); - + +// m_log.DebugFormat( +// "[XENGINE]: Found assembly path {0} onrez {1} in {2}", +// assemblyPath, item.ItemID, World.Name); + if (!m_AddingAssemblies.ContainsKey(assemblyPath)) { m_AddingAssemblies[assemblyPath] = 1; } else { @@ -1373,7 +1363,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine startParam, postOnRez, m_MaxScriptQueue); - if (!instance.Load(m_AppDomains[appDomain], scriptAssembly, stateSource)) + if (!instance.Load( + m_AppDomains[appDomain], scriptAssembly, + Path.Combine(ScriptEnginePath, World.RegionInfo.RegionID.ToString()), stateSource)) return false; // if (DebugLevel >= 1) @@ -1604,7 +1596,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine IScriptInstance instance = (ScriptInstance) parms; - //m_log.DebugFormat("[XEngine]: Processing event for {0}", instance); +// m_log.DebugFormat("[XEngine]: Processing event for {0}", instance); return instance.EventProcessor(); } @@ -2200,6 +2192,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine m_log.ErrorFormat("[XEngine]: Error whilst writing state file {0}, {1}", statepath, ex.Message); } +// m_log.DebugFormat( +// "[XEngine]: Wrote state for script item with ID {0} at {1} in {2}", itemID, statepath, m_Scene.Name); + return true; } -- cgit v1.1 From 147d401b28d6a0193122ec6518e9aaf9d22da816 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 15 Dec 2014 20:38:26 +0000 Subject: Remove XEngine.m_uniqueScripts This provides no obvious benefit as far as I can tell but has a definite cost in keep script strings in memory for the entire simulator session. --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 8 -------- 1 file changed, 8 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/XEngine') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 71ed989..906c6ee 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -101,7 +101,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine private bool m_InitialStartup = true; private int m_ScriptFailCount; // Number of script fails since compile queue was last empty private string m_ScriptErrorMessage; - private Dictionary m_uniqueScripts = new Dictionary(); private bool m_AppDomainLoading; private Dictionary m_ScriptErrors = new Dictionary(); @@ -570,7 +569,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine } sb.AppendFormat("Scripts loaded : {0}\n", scriptsLoaded); - sb.AppendFormat("Unique scripts : {0}\n", m_uniqueScripts.Count); sb.AppendFormat("Scripts waiting for load : {0}\n", m_CompileQueue.Count); sb.AppendFormat("Max threads : {0}\n", m_ThreadPool.MaxThreads); sb.AppendFormat("Min threads : {0}\n", m_ThreadPool.MinThreads); @@ -987,12 +985,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine if (engine != ScriptEngineName) return; - // If we've seen this exact script text before, use that reference instead - if (m_uniqueScripts.ContainsKey(script)) - script = m_uniqueScripts[script]; - else - m_uniqueScripts[script] = script; - Object[] parms = new Object[]{localID, itemID, script, startParam, postOnRez, (StateSource)stateSource}; if (stateSource == (int)StateSource.ScriptedRez) -- cgit v1.1