aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTedd Hansen2007-08-25 20:34:54 +0000
committerTedd Hansen2007-08-25 20:34:54 +0000
commit80234b98e5dd03de08229fb5cc6dd2a42e70ec24 (patch)
treefcc566aa0855c79655a5749be245cd16db7cd5aa
parentTest to see if this change improves or makes worse the texture sending bug (diff)
downloadopensim-SC-80234b98e5dd03de08229fb5cc6dd2a42e70ec24.zip
opensim-SC-80234b98e5dd03de08229fb5cc6dd2a42e70ec24.tar.gz
opensim-SC-80234b98e5dd03de08229fb5cc6dd2a42e70ec24.tar.bz2
opensim-SC-80234b98e5dd03de08229fb5cc6dd2a42e70ec24.tar.xz
Removal of script that was unable to compile no longer crashes server.
Displays script compile error messages in-world.
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs7
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs51
3 files changed, 45 insertions, 14 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
index f24eb63..bdeed8f 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
@@ -93,12 +93,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
93 // TODO: Return errors to user somehow 93 // TODO: Return errors to user somehow
94 if (results.Errors.Count > 0) 94 if (results.Errors.Count > 0)
95 { 95 {
96
97 string errtext = "";
96 foreach (CompilerError CompErr in results.Errors) 98 foreach (CompilerError CompErr in results.Errors)
97 { 99 {
98 Console.WriteLine("Line number " + CompErr.Line + 100 errtext += "Line number " + CompErr.Line +
99 ", Error Number: " + CompErr.ErrorNumber + 101 ", Error Number: " + CompErr.ErrorNumber +
100 ", '" + CompErr.ErrorText + ";"); 102 ", '" + CompErr.ErrorText + "'\r\n";
101 } 103 }
104 throw new Exception(errtext);
102 } 105 }
103 106
104 107
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
index e2c039c..2395dbd 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
@@ -131,7 +131,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
131 if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime()) 131 if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime())
132 { 132 {
133 // Add it to queue 133 // Add it to queue
134 //Console.WriteLine("Enqueue timer event: " + ts.next.ToUniversalTime().ToString("HH:mm:ss") + " > " + DateTime.Now.ToUniversalTime().ToString("HH:mm:ss"));
135 myScriptEngine.myEventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { }); 134 myScriptEngine.myEventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { });
136 // set next interval 135 // set next interval
137 136
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index 29171a1..bf863b8 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -245,6 +245,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
245 // It will be up to the script itself to hook up the correct events. 245 // It will be up to the script itself to hook up the correct events.
246 string FileName = ""; 246 string FileName = "";
247 247
248 IScriptHost m_host = World.GetSceneObjectPart(localID);
249
248 try 250 try
249 { 251 {
250 252
@@ -264,7 +266,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
264 long before; 266 long before;
265 before = GC.GetTotalMemory(false); 267 before = GC.GetTotalMemory(false);
266#endif 268#endif
267 LSL_BaseClass CompiledScript = m_scriptEngine.myAppDomainManager.LoadScript(FileName); 269 LSL_BaseClass CompiledScript;
270 CompiledScript = m_scriptEngine.myAppDomainManager.LoadScript(FileName);
268#if DEBUG 271#if DEBUG
269 Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(false) - before); 272 Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(false) - before);
270#endif 273#endif
@@ -274,7 +277,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
274 277
275 // We need to give (untrusted) assembly a private instance of BuiltIns 278 // We need to give (untrusted) assembly a private instance of BuiltIns
276 // this private copy will contain Read-Only FullitemID so that it can bring that on to the server whenever needed. 279 // this private copy will contain Read-Only FullitemID so that it can bring that on to the server whenever needed.
277 LSL_BuiltIn_Commands LSLB = new LSL_BuiltIn_Commands(m_scriptEngine, World.GetSceneObjectPart(localID), localID, itemID); 280
281
282 LSL_BuiltIn_Commands LSLB = new LSL_BuiltIn_Commands(m_scriptEngine, m_host, localID, itemID);
278 283
279 // Start the script - giving it BuiltIns 284 // Start the script - giving it BuiltIns
280 CompiledScript.Start(LSLB); 285 CompiledScript.Start(LSLB);
@@ -286,8 +291,21 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
286 } 291 }
287 catch (Exception e) 292 catch (Exception e)
288 { 293 {
289 m_scriptEngine.Log.Error("ScriptEngine", "Exception loading script \"" + FileName + "\": " + e.ToString()); 294 m_scriptEngine.Log.Error("ScriptEngine", "Error compiling script: " + e.ToString());
295 try
296 {
297 // DISPLAY ERROR INWORLD
298 string text = "Error compiling script:\r\n" + e.Message.ToString();
299 if (text.Length > 1500)
300 text = text.Substring(0, 1500);
301 World.SimChat(Helpers.StringToField(text), 1, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
302 }
303 catch (Exception e2)
304 {
305 m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString());
306 }
290 } 307 }
308
291 309
292 310
293 } 311 }
@@ -300,14 +318,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
300 // Stop long command on script 318 // Stop long command on script
301 m_scriptEngine.myLSLLongCmdHandler.RemoveScript(localID, itemID); 319 m_scriptEngine.myLSLLongCmdHandler.RemoveScript(localID, itemID);
302 320
303 // Get AppDomain 321 LSL_BaseClass LSLBC = GetScript(localID, itemID);
304 AppDomain ad = GetScript(localID, itemID).Exec.GetAppDomain(); 322 if (LSLBC == null)
305 // Tell script not to accept new requests 323 return;
306 GetScript(localID, itemID).Exec.StopScript(); 324
307 // Remove from internal structure 325 try
308 RemoveScript(localID, itemID); 326 {
309 // Tell AppDomain that we have stopped script 327 // Get AppDomain
310 m_scriptEngine.myAppDomainManager.StopScript(ad); 328 AppDomain ad = LSLBC.Exec.GetAppDomain();
329 // Tell script not to accept new requests
330 GetScript(localID, itemID).Exec.StopScript();
331 // Remove from internal structure
332 RemoveScript(localID, itemID);
333 // Tell AppDomain that we have stopped script
334 m_scriptEngine.myAppDomainManager.StopScript(ad);
335 }
336 catch(Exception e)
337 {
338 Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + ": " + e.ToString());
339 }
311 } 340 }
312 private string ProcessYield(string FileName) 341 private string ProcessYield(string FileName)
313 { 342 {