* Added additional debug testing info to Scene

* Corrected issue with MRMs where it would attempt to overwrite an already loaded DLL. (and thus fail with cryptic UnauthorizedAccessException.)
* Made DrunkenTextAppreciationModule.cs MRM not crash with StackOverflowException
* Added some temporary logging to MRM World.*
0.6.5-rc1
Adam Frisby 2009-04-09 13:03:27 +00:00
parent 0af0399198
commit 03984e7304
4 changed files with 57 additions and 6 deletions

View File

@ -3147,6 +3147,7 @@ namespace OpenSim.Region.Framework.Scenes
catch (Exception e)
{
m_log.Info("[BUG] in " + RegionInfo.RegionName + ": " + e.ToString());
m_log.Info("[BUG] Stack Trace: " + e.StackTrace);
}
}
}

View File

@ -91,8 +91,23 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
m_log.Info("[MRM] Starting MRM");
mmb.Start();
}
catch (UnauthorizedAccessException e)
{
m_log.Error("[MRM] UAE " + e.Message);
m_log.Error("[MRM] " + e.StackTrace);
if (e.InnerException != null)
m_log.Error("[MRM] " + e.InnerException);
m_scene.Broadcast(delegate(IClientAPI user)
{
user.SendAlertMessage(
"MRM UnAuthorizedAccess: " + e);
});
}
catch (Exception e)
{
m_log.Info("[MRM] Error: " + e);
m_scene.Broadcast(delegate(IClientAPI user)
{
user.SendAlertMessage(
@ -133,13 +148,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
/// <returns></returns>
internal string CompileFromDotNetText(string Script, string uuid)
{
m_log.Info("MRM 1");
const string ext = ".cs";
const string FilePrefix = "MiniModule";
// Output assembly name
string OutFile = Path.Combine("MiniModules", Path.Combine(
m_scene.RegionInfo.RegionID.ToString(),
FilePrefix + "_compiled_" + uuid + ".dll"));
FilePrefix + "_compiled_" + uuid + "_" +
Util.RandomClass.Next(9000) + ".dll"));
// Create Directories for Assemblies
if (!Directory.Exists("MiniModules"))
@ -148,10 +165,19 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
if (!Directory.Exists(tmp))
Directory.CreateDirectory(tmp);
m_log.Info("MRM 2");
try
{
File.Delete(OutFile);
}
catch (UnauthorizedAccessException e)
{
throw new Exception("Unable to delete old existing " +
"script-file before writing new. Compile aborted: " +
e);
}
catch (IOException e)
{
throw new Exception("Unable to delete old existing " +
@ -159,6 +185,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
e);
}
m_log.Info("MRM 3");
// DEBUG - write source to disk
string srcFileName = FilePrefix + "_source_" +
Path.GetFileNameWithoutExtension(OutFile) + ext;
@ -176,6 +204,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
srcFileName + "\": " + ex.ToString());
}
m_log.Info("MRM 4");
// Do actual compile
CompilerParameters parameters = new CompilerParameters();
@ -196,9 +226,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
parameters.IncludeDebugInformation = true;
parameters.TreatWarningsAsErrors = false;
m_log.Info("MRM 5");
CompilerResults results = CScodeProvider.CompileAssemblyFromSource(
parameters, Script);
m_log.Info("MRM 6");
int display = 5;
if (results.Errors.Count > 0)
{
@ -232,6 +266,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
}
}
m_log.Info("MRM 7");
if (!File.Exists(OutFile))
{
string errtext = String.Empty;
@ -256,6 +292,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
throw new Exception(errtext);
}
m_log.Info("MRM 8");
// Convert to base64
//
string filetext = Convert.ToBase64String(data);
@ -264,10 +302,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
Byte[] buf = enc.GetBytes(filetext);
m_log.Info("MRM 9");
FileStream sfs = File.Create(OutFile + ".cil.b64");
sfs.Write(buf, 0, buf.Length);
sfs.Close();
m_log.Info("MRM 10");
return OutFile;
}
}

View File

@ -38,12 +38,15 @@ namespace OpenSim
void World_OnChat(IWorld sender, ChatEventArgs e)
{
e.Text.Replace("s", "sh");
e.Text.Replace("S", "Sh");
if(!e.Text.Contains("hic!"))
{
e.Text = e.Text.Replace("s", "sh");
e.Text = e.Text.Replace("S", "Sh");
e.Text += " ...hic!";
Host.Object.Say(e.Text);
}
}
public override void Stop()
{

View File

@ -26,7 +26,10 @@
*/
using System.Collections.Generic;
using System.Reflection;
using log4net;
using OpenSim.Framework;
using OpenSim.Framework.Client;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
@ -34,6 +37,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public class World : IWorld
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly Scene m_internalScene;
private readonly Heightmap m_heights;
@ -100,7 +105,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
return;
}
// Avatar?
if (chat.SenderObject != null && chat.SenderObject == null)
if (chat.Sender != null && chat.SenderObject == null)
{
ChatEventArgs e = new ChatEventArgs();
e.Sender = new SPAvatar(m_internalScene, chat.SenderUUID);