Removal of script that was unable to compile no longer crashes server.
Displays script compile error messages in-world.afrisby
parent
65d6ef1bc1
commit
80234b98e5
|
@ -93,12 +93,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||||
// TODO: Return errors to user somehow
|
// TODO: Return errors to user somehow
|
||||||
if (results.Errors.Count > 0)
|
if (results.Errors.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
string errtext = "";
|
||||||
foreach (CompilerError CompErr in results.Errors)
|
foreach (CompilerError CompErr in results.Errors)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Line number " + CompErr.Line +
|
errtext += "Line number " + CompErr.Line +
|
||||||
", Error Number: " + CompErr.ErrorNumber +
|
", Error Number: " + CompErr.ErrorNumber +
|
||||||
", '" + CompErr.ErrorText + ";");
|
", '" + CompErr.ErrorText + "'\r\n";
|
||||||
}
|
}
|
||||||
|
throw new Exception(errtext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||||
if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime())
|
if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime())
|
||||||
{
|
{
|
||||||
// Add it to queue
|
// Add it to queue
|
||||||
//Console.WriteLine("Enqueue timer event: " + ts.next.ToUniversalTime().ToString("HH:mm:ss") + " > " + DateTime.Now.ToUniversalTime().ToString("HH:mm:ss"));
|
|
||||||
myScriptEngine.myEventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { });
|
myScriptEngine.myEventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { });
|
||||||
// set next interval
|
// set next interval
|
||||||
|
|
||||||
|
|
|
@ -245,6 +245,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||||
// It will be up to the script itself to hook up the correct events.
|
// It will be up to the script itself to hook up the correct events.
|
||||||
string FileName = "";
|
string FileName = "";
|
||||||
|
|
||||||
|
IScriptHost m_host = World.GetSceneObjectPart(localID);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -264,7 +266,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||||
long before;
|
long before;
|
||||||
before = GC.GetTotalMemory(false);
|
before = GC.GetTotalMemory(false);
|
||||||
#endif
|
#endif
|
||||||
LSL_BaseClass CompiledScript = m_scriptEngine.myAppDomainManager.LoadScript(FileName);
|
LSL_BaseClass CompiledScript;
|
||||||
|
CompiledScript = m_scriptEngine.myAppDomainManager.LoadScript(FileName);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(false) - before);
|
Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(false) - before);
|
||||||
#endif
|
#endif
|
||||||
|
@ -274,7 +277,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||||
|
|
||||||
// We need to give (untrusted) assembly a private instance of BuiltIns
|
// We need to give (untrusted) assembly a private instance of BuiltIns
|
||||||
// this private copy will contain Read-Only FullitemID so that it can bring that on to the server whenever needed.
|
// this private copy will contain Read-Only FullitemID so that it can bring that on to the server whenever needed.
|
||||||
LSL_BuiltIn_Commands LSLB = new LSL_BuiltIn_Commands(m_scriptEngine, World.GetSceneObjectPart(localID), localID, itemID);
|
|
||||||
|
|
||||||
|
LSL_BuiltIn_Commands LSLB = new LSL_BuiltIn_Commands(m_scriptEngine, m_host, localID, itemID);
|
||||||
|
|
||||||
// Start the script - giving it BuiltIns
|
// Start the script - giving it BuiltIns
|
||||||
CompiledScript.Start(LSLB);
|
CompiledScript.Start(LSLB);
|
||||||
|
@ -286,8 +291,21 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_scriptEngine.Log.Error("ScriptEngine", "Exception loading script \"" + FileName + "\": " + e.ToString());
|
m_scriptEngine.Log.Error("ScriptEngine", "Error compiling script: " + e.ToString());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// DISPLAY ERROR INWORLD
|
||||||
|
string text = "Error compiling script:\r\n" + e.Message.ToString();
|
||||||
|
if (text.Length > 1500)
|
||||||
|
text = text.Substring(0, 1500);
|
||||||
|
World.SimChat(Helpers.StringToField(text), 1, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
|
||||||
|
}
|
||||||
|
catch (Exception e2)
|
||||||
|
{
|
||||||
|
m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -300,14 +318,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||||
// Stop long command on script
|
// Stop long command on script
|
||||||
m_scriptEngine.myLSLLongCmdHandler.RemoveScript(localID, itemID);
|
m_scriptEngine.myLSLLongCmdHandler.RemoveScript(localID, itemID);
|
||||||
|
|
||||||
// Get AppDomain
|
LSL_BaseClass LSLBC = GetScript(localID, itemID);
|
||||||
AppDomain ad = GetScript(localID, itemID).Exec.GetAppDomain();
|
if (LSLBC == null)
|
||||||
// Tell script not to accept new requests
|
return;
|
||||||
GetScript(localID, itemID).Exec.StopScript();
|
|
||||||
// Remove from internal structure
|
try
|
||||||
RemoveScript(localID, itemID);
|
{
|
||||||
// Tell AppDomain that we have stopped script
|
// Get AppDomain
|
||||||
m_scriptEngine.myAppDomainManager.StopScript(ad);
|
AppDomain ad = LSLBC.Exec.GetAppDomain();
|
||||||
|
// Tell script not to accept new requests
|
||||||
|
GetScript(localID, itemID).Exec.StopScript();
|
||||||
|
// Remove from internal structure
|
||||||
|
RemoveScript(localID, itemID);
|
||||||
|
// Tell AppDomain that we have stopped script
|
||||||
|
m_scriptEngine.myAppDomainManager.StopScript(ad);
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + ": " + e.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private string ProcessYield(string FileName)
|
private string ProcessYield(string FileName)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue