aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs74
1 files changed, 43 insertions, 31 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index ebb8e52..fde1e46 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1046,49 +1046,61 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1046 1046
1047 public Object DoOnRezScriptQueue(Object dummy) 1047 public Object DoOnRezScriptQueue(Object dummy)
1048 { 1048 {
1049 if (m_InitialStartup) 1049 try
1050 { 1050 {
1051 // This delay exists to stop mono problems where script compilation and startup would stop the sim 1051 if (m_InitialStartup)
1052 // working properly for the session. 1052 {
1053 System.Threading.Thread.Sleep(m_StartDelay); 1053 // This delay exists to stop mono problems where script compilation and startup would stop the sim
1054 // working properly for the session.
1055 System.Threading.Thread.Sleep(m_StartDelay);
1054 1056
1055 m_log.InfoFormat("[XEngine]: Performing initial script startup on {0}", m_Scene.Name); 1057 m_log.InfoFormat("[XEngine]: Performing initial script startup on {0}", m_Scene.Name);
1056 } 1058 }
1057 1059
1058 object[] o; 1060 object[] o;
1059 1061
1060 int scriptsStarted = 0; 1062 int scriptsStarted = 0;
1061 1063
1062 while (m_CompileQueue.Dequeue(out o)) 1064 while (m_CompileQueue.Dequeue(out o))
1063 {
1064 if (DoOnRezScript(o))
1065 { 1065 {
1066 scriptsStarted++; 1066 if (DoOnRezScript(o))
1067 {
1068 scriptsStarted++;
1067 1069
1068 if (m_InitialStartup) 1070 if (m_InitialStartup)
1069 if (scriptsStarted % 50 == 0) 1071 if (scriptsStarted % 50 == 0)
1070 m_log.InfoFormat( 1072 m_log.InfoFormat(
1071 "[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.Name); 1073 "[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.Name);
1074 }
1072 } 1075 }
1073 }
1074 1076
1075 if (m_InitialStartup) 1077 if (m_InitialStartup)
1076 m_log.InfoFormat( 1078 m_log.InfoFormat(
1077 "[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.Name); 1079 "[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.Name);
1078 1080
1079 m_Scene.EventManager.TriggerEmptyScriptCompileQueue(m_ScriptFailCount, 1081 }
1080 m_ScriptErrorMessage); 1082 catch (Exception e)
1083 {
1084 m_log.Error(string.Format("[XEngine]: Failure in DoOnRezScriptQueue(). Exception ", e));
1085 }
1086 finally
1087 {
1088 // FIXME: On failure we must trigger this even if the compile queue is not actually empty so that the
1089 // RegionReadyModule is not forever waiting. This event really needs a different name.
1090 m_Scene.EventManager.TriggerEmptyScriptCompileQueue(m_ScriptFailCount,
1091 m_ScriptErrorMessage);
1081 1092
1082 m_ScriptFailCount = 0; 1093 m_ScriptFailCount = 0;
1083 m_InitialStartup = false; 1094 m_InitialStartup = false;
1084 1095
1085 // NOTE: Despite having a lockless queue, this lock is required 1096 // NOTE: Despite having a lockless queue, this lock is required
1086 // to make sure there is never no compile thread while there 1097 // to make sure there is never no compile thread while there
1087 // are still scripts to compile. This could otherwise happen 1098 // are still scripts to compile. This could otherwise happen
1088 // due to a race condition 1099 // due to a race condition
1089 // 1100 //
1090 lock (m_CompileQueue) 1101 lock (m_CompileQueue)
1091 m_CurrentCompile = null; 1102 m_CurrentCompile = null;
1103 }
1092 1104
1093 return null; 1105 return null;
1094 } 1106 }