From 200c77ad15d830983bc70efc14a511530824b7d1 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Tue, 5 Aug 2008 20:47:36 +0000 Subject: * possible fix for event queue problems (exceptions and event count max exceeded issues) seen in osgrid meeting today * From the logs, I'm guessing probable cause is that an exception generated by a bad index given to substring error line number conversion stopped the script being killed, leading to continuous events that filled up the log (maybe) * Someone will need to go back and fix this properly --- .../Common/ScriptEngineBase/EventQueueThreadClass.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Common/ScriptEngineBase') diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs index 321dd5e..3a5cc23 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs @@ -27,9 +27,11 @@ using System; using System.Collections; +using System.Reflection; using System.Threading; using System.Globalization; using libsecondlife; +using log4net; using OpenSim.Framework; using OpenSim.Region.Environment.Scenes.Scripting; @@ -40,6 +42,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase /// public class EventQueueThreadClass : iScriptEngineFunctionModule { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// /// How many ms to sleep if queue is empty /// @@ -313,7 +317,19 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase { // Not sure why this is converted to an int then back to a string, either // way, need to skip the word "line " in the substring - line = " at line " + Convert.ToInt32(t.Substring(colon + 6)).ToString(); + try + { + line = " at line " + Convert.ToInt32(t.Substring(colon + 6)).ToString(); + } + catch (ArgumentOutOfRangeException e) + { + // FIXME: Big fat temporary patch to stop the Substring above throwing an exception + // and stopping a proper kill of the script. We're making an unwarranted assumption + // about the size of t. This needs to be fixed properly. + m_log.ErrorFormat("[SCRIPT ENGINE]: Line number conversion exception {0}", e); + line = " at line (unavailable)"; + } + break; } } -- cgit v1.1