ScriptServer fixes: Added more debug logging, mutex lock (to be extra-super-sure) on script load/unload, removed experimental Grid-scriptengine from compile because of dynamic module loader, and added random string to script filename to bypass module loader file lock.
Please delete your copy of bin/ScriptEngine/OpenSim.Grid.ScriptEngine.DotNetEngine.dll.afrisby
parent
4fad66f855
commit
dcf41cb683
|
@ -82,6 +82,10 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
|
||||
string EventName = m_Script.State() + "_event_" + FunctionName;
|
||||
|
||||
#if DEBUG
|
||||
Console.WriteLine("ScriptEngine: Script event function name: " + EventName);
|
||||
#endif
|
||||
|
||||
//type.InvokeMember(EventName, BindingFlags.InvokeMethod, null, m_Script, args);
|
||||
|
||||
//Console.WriteLine("ScriptEngine Executor.ExecuteEvent: \"" + EventName + "\"");
|
||||
|
@ -112,6 +116,9 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
return;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
Console.WriteLine("ScriptEngine: Executing function name: " + EventName);
|
||||
#endif
|
||||
// Found
|
||||
//try
|
||||
//{
|
||||
|
|
|
@ -39,6 +39,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
private LSL2CSConverter LSL_Converter = new LSL2CSConverter();
|
||||
private CSharpCodeProvider codeProvider = new CSharpCodeProvider();
|
||||
private static UInt64 scriptCompileCounter = 0;
|
||||
private static int instanceID = new Random().Next(0, int.MaxValue); // Implemented due to peer preassure --- will cause garbage in ScriptEngines folder ;)
|
||||
//private ICodeCompiler icc = codeProvider.CreateCompiler();
|
||||
public string CompileFromFile(string LSOFileName)
|
||||
{
|
||||
|
@ -82,7 +83,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
{
|
||||
// Output assembly name
|
||||
scriptCompileCounter++;
|
||||
string OutFile = Path.Combine("ScriptEngines", "Script_" + scriptCompileCounter + ".dll");
|
||||
string OutFile = Path.Combine("ScriptEngines", "DotNetScript_" + instanceID.ToString() + "_" + scriptCompileCounter.ToString() + ".dll");
|
||||
try
|
||||
{
|
||||
File.Delete(OutFile);
|
||||
|
|
|
@ -53,6 +53,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
|
||||
public string Convert(string Script)
|
||||
{
|
||||
quotes.Clear();
|
||||
string Return = "";
|
||||
Script = " \r\n" + Script;
|
||||
|
||||
|
@ -310,6 +311,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
Return += Script;
|
||||
Return += "} }\r\n";
|
||||
|
||||
|
||||
quotes.Clear();
|
||||
|
||||
return Return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -181,6 +181,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
// Execute function
|
||||
try
|
||||
{
|
||||
#if DEBUG
|
||||
m_ScriptEngine.Log.Debug("ScriptEngine", "Executing event:\r\n"
|
||||
+ "QIS.localID: " + QIS.localID
|
||||
+ ", QIS.itemID: " + QIS.itemID
|
||||
+ ", QIS.functionName: " + QIS.functionName);
|
||||
#endif
|
||||
m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID, QIS.itemID,
|
||||
QIS.functionName, QIS.param);
|
||||
}
|
||||
|
@ -188,16 +194,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
{
|
||||
// DISPLAY ERROR INWORLD
|
||||
string text = "Error executing script function \"" + QIS.functionName + "\":\r\n";
|
||||
if (e.InnerException != null)
|
||||
{
|
||||
//if (e.InnerException != null)
|
||||
//{
|
||||
// Send inner exception
|
||||
text += e.InnerException.Message.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
text += "\r\n";
|
||||
// Send normal
|
||||
text += e.Message.ToString();
|
||||
}
|
||||
//}
|
||||
try
|
||||
{
|
||||
if (text.Length > 1500)
|
||||
|
@ -214,7 +221,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
//else
|
||||
//{
|
||||
// T oconsole
|
||||
Console.WriteLine("Unable to send text in-world:\r\n" + text);
|
||||
m_ScriptEngine.Log.Error("ScriptEngine", "Unable to send text in-world:\r\n" + text);
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
@ -230,7 +237,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Exception in EventQueueThreadLoop: " + e.ToString());
|
||||
m_ScriptEngine.Log.Error("ScriptEngine", "Exception in EventQueueThreadLoop: " + e.ToString());
|
||||
}
|
||||
} // while
|
||||
} // try
|
||||
|
|
|
@ -225,6 +225,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
|
||||
#region Start/Stop/Reset script
|
||||
|
||||
Object startStopLock = new Object();
|
||||
|
||||
/// <summary>
|
||||
/// Fetches, loads and hooks up a script to an objects events
|
||||
/// </summary>
|
||||
|
@ -259,7 +261,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
StartScript(localID, itemID, script);
|
||||
}
|
||||
|
||||
// Create a new instance of the compiler (reuse)
|
||||
Compiler.LSL.Compiler LSLCompiler = new Compiler.LSL.Compiler();
|
||||
private void _StartScript(uint localID, LLUUID itemID, string Script)
|
||||
{
|
||||
lock (startStopLock)
|
||||
{
|
||||
//IScriptHost root = host.GetRoot();
|
||||
Console.WriteLine("ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID);
|
||||
|
@ -272,8 +278,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
|
||||
try
|
||||
{
|
||||
// Create a new instance of the compiler (currently we don't want reuse)
|
||||
Compiler.LSL.Compiler LSLCompiler = new Compiler.LSL.Compiler();
|
||||
|
||||
// Compile (We assume LSL)
|
||||
ScriptSource = LSLCompiler.CompileFromLSLText(Script);
|
||||
//Console.WriteLine("Compilation of " + FileName + " done");
|
||||
|
@ -307,7 +312,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
CompiledScript.Start(LSLB);
|
||||
|
||||
// Fire the first start-event
|
||||
m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] {});
|
||||
m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] { });
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -323,11 +328,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
catch (Exception e2)
|
||||
{
|
||||
m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString());
|
||||
m_scriptEngine.Log.Error("ScriptEngine", "Errormessage: Error compiling script:\r\n" + e.Message.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void _StopScript(uint localID, LLUUID itemID)
|
||||
{
|
||||
lock (startStopLock)
|
||||
{
|
||||
// Stop script
|
||||
Console.WriteLine("Stop script localID: " + localID + " LLUID: " + itemID.ToString());
|
||||
|
@ -361,6 +370,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
": " + e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string ProcessYield(string FileName)
|
||||
{
|
||||
|
@ -382,12 +392,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
/// <param name="args">Arguments to pass to function</param>
|
||||
internal void ExecuteEvent(uint localID, LLUUID itemID, string FunctionName, object[] args)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine("ScriptEngine: Inside ExecuteEvent for event " + FunctionName);
|
||||
#endif
|
||||
// Execute a function in the script
|
||||
//m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName);
|
||||
LSL_BaseClass Script = m_scriptEngine.m_ScriptManager.GetScript(localID, itemID);
|
||||
if (Script == null)
|
||||
return;
|
||||
|
||||
#if DEBUG
|
||||
Console.WriteLine("ScriptEngine: Executing event: " + FunctionName);
|
||||
#endif
|
||||
// Must be done in correct AppDomain, so leaving it up to the script itself
|
||||
Script.Exec.ExecuteEvent(FunctionName, args);
|
||||
}
|
||||
|
|
55
prebuild.xml
55
prebuild.xml
|
@ -963,61 +963,6 @@
|
|||
</Project>
|
||||
|
||||
|
||||
<Project name="OpenSim.Grid.ScriptEngine.Common" path="OpenSim/Grid/ScriptEngine/Common" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
<OutputPath>../../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
<Configuration name="Release">
|
||||
<Options>
|
||||
<OutputPath>../../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
|
||||
<ReferencePath>../../../../bin/</ReferencePath>
|
||||
<ReferencePath>../../../../bin/ScriptEngines/</ReferencePath>
|
||||
<Reference name="System" localCopy="false"/>
|
||||
<Reference name="System.Data" localCopy="false"/>
|
||||
<Reference name="System.Xml" localCopy="false"/>
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="true"/>
|
||||
</Files>
|
||||
</Project>
|
||||
|
||||
|
||||
|
||||
<Project name="OpenSim.Grid.ScriptEngine.DotNetEngine" path="OpenSim/Grid/ScriptEngine/DotNetEngine" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
<OutputPath>../../../../bin/ScriptEngines/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
<Configuration name="Release">
|
||||
<Options>
|
||||
<OutputPath>../../../../bin/ScriptEngines/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
|
||||
<ReferencePath>../../../../bin/</ReferencePath>
|
||||
<ReferencePath>../../../../bin/ScriptEngines/</ReferencePath>
|
||||
<Reference name="System" localCopy="false"/>
|
||||
<Reference name="System.Data" localCopy="false"/>
|
||||
<Reference name="System.Xml" localCopy="false"/>
|
||||
<Reference name="System.Runtime.Remoting" localCopy="false"/>
|
||||
<Reference name="OpenSim.Region.Environment" />
|
||||
<Reference name="libsecondlife.dll"/>
|
||||
<Reference name="RAIL.dll"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Region.ScriptEngine.Common"/>
|
||||
<Reference name="Axiom.MathLib.dll" localCopy="false"/>
|
||||
<Reference name="Nini.dll" />
|
||||
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="true"/>
|
||||
</Files>
|
||||
</Project>
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue