aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAdam Frisby2009-04-09 13:03:27 +0000
committerAdam Frisby2009-04-09 13:03:27 +0000
commit03984e7304df152f5b415e38c314e39b7a551dc7 (patch)
tree14ed1fde266ea01ea1eedbce9fb46eb88befe2a3
parent* Forgot to commit IEntity in last commit. (diff)
downloadopensim-SC_OLD-03984e7304df152f5b415e38c314e39b7a551dc7.zip
opensim-SC_OLD-03984e7304df152f5b415e38c314e39b7a551dc7.tar.gz
opensim-SC_OLD-03984e7304df152f5b415e38c314e39b7a551dc7.tar.bz2
opensim-SC_OLD-03984e7304df152f5b415e38c314e39b7a551dc7.tar.xz
* 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.*
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs1
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs44
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/DrunkenTextAppreciationModule.cs11
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs7
4 files changed, 57 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 041d981..0fe27a5 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3147,6 +3147,7 @@ namespace OpenSim.Region.Framework.Scenes
3147 catch (Exception e) 3147 catch (Exception e)
3148 { 3148 {
3149 m_log.Info("[BUG] in " + RegionInfo.RegionName + ": " + e.ToString()); 3149 m_log.Info("[BUG] in " + RegionInfo.RegionName + ": " + e.ToString());
3150 m_log.Info("[BUG] Stack Trace: " + e.StackTrace);
3150 } 3151 }
3151 } 3152 }
3152 } 3153 }
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
index 6fa8a24..71077f2 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
@@ -91,8 +91,23 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
91 m_log.Info("[MRM] Starting MRM"); 91 m_log.Info("[MRM] Starting MRM");
92 mmb.Start(); 92 mmb.Start();
93 } 93 }
94 catch (UnauthorizedAccessException e)
95 {
96 m_log.Error("[MRM] UAE " + e.Message);
97 m_log.Error("[MRM] " + e.StackTrace);
98
99 if (e.InnerException != null)
100 m_log.Error("[MRM] " + e.InnerException);
101
102 m_scene.Broadcast(delegate(IClientAPI user)
103 {
104 user.SendAlertMessage(
105 "MRM UnAuthorizedAccess: " + e);
106 });
107 }
94 catch (Exception e) 108 catch (Exception e)
95 { 109 {
110 m_log.Info("[MRM] Error: " + e);
96 m_scene.Broadcast(delegate(IClientAPI user) 111 m_scene.Broadcast(delegate(IClientAPI user)
97 { 112 {
98 user.SendAlertMessage( 113 user.SendAlertMessage(
@@ -133,13 +148,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
133 /// <returns></returns> 148 /// <returns></returns>
134 internal string CompileFromDotNetText(string Script, string uuid) 149 internal string CompileFromDotNetText(string Script, string uuid)
135 { 150 {
151 m_log.Info("MRM 1");
136 const string ext = ".cs"; 152 const string ext = ".cs";
137 const string FilePrefix = "MiniModule"; 153 const string FilePrefix = "MiniModule";
138 154
139 // Output assembly name 155 // Output assembly name
140 string OutFile = Path.Combine("MiniModules", Path.Combine( 156 string OutFile = Path.Combine("MiniModules", Path.Combine(
141 m_scene.RegionInfo.RegionID.ToString(), 157 m_scene.RegionInfo.RegionID.ToString(),
142 FilePrefix + "_compiled_" + uuid + ".dll")); 158 FilePrefix + "_compiled_" + uuid + "_" +
159 Util.RandomClass.Next(9000) + ".dll"));
143 160
144 // Create Directories for Assemblies 161 // Create Directories for Assemblies
145 if (!Directory.Exists("MiniModules")) 162 if (!Directory.Exists("MiniModules"))
@@ -148,10 +165,19 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
148 if (!Directory.Exists(tmp)) 165 if (!Directory.Exists(tmp))
149 Directory.CreateDirectory(tmp); 166 Directory.CreateDirectory(tmp);
150 167
168
169 m_log.Info("MRM 2");
170
151 try 171 try
152 { 172 {
153 File.Delete(OutFile); 173 File.Delete(OutFile);
154 } 174 }
175 catch (UnauthorizedAccessException e)
176 {
177 throw new Exception("Unable to delete old existing " +
178 "script-file before writing new. Compile aborted: " +
179 e);
180 }
155 catch (IOException e) 181 catch (IOException e)
156 { 182 {
157 throw new Exception("Unable to delete old existing " + 183 throw new Exception("Unable to delete old existing " +
@@ -159,6 +185,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
159 e); 185 e);
160 } 186 }
161 187
188 m_log.Info("MRM 3");
189
162 // DEBUG - write source to disk 190 // DEBUG - write source to disk
163 string srcFileName = FilePrefix + "_source_" + 191 string srcFileName = FilePrefix + "_source_" +
164 Path.GetFileNameWithoutExtension(OutFile) + ext; 192 Path.GetFileNameWithoutExtension(OutFile) + ext;
@@ -176,6 +204,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
176 srcFileName + "\": " + ex.ToString()); 204 srcFileName + "\": " + ex.ToString());
177 } 205 }
178 206
207 m_log.Info("MRM 4");
208
179 // Do actual compile 209 // Do actual compile
180 CompilerParameters parameters = new CompilerParameters(); 210 CompilerParameters parameters = new CompilerParameters();
181 211
@@ -196,9 +226,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
196 parameters.IncludeDebugInformation = true; 226 parameters.IncludeDebugInformation = true;
197 parameters.TreatWarningsAsErrors = false; 227 parameters.TreatWarningsAsErrors = false;
198 228
229 m_log.Info("MRM 5");
230
199 CompilerResults results = CScodeProvider.CompileAssemblyFromSource( 231 CompilerResults results = CScodeProvider.CompileAssemblyFromSource(
200 parameters, Script); 232 parameters, Script);
201 233
234 m_log.Info("MRM 6");
235
202 int display = 5; 236 int display = 5;
203 if (results.Errors.Count > 0) 237 if (results.Errors.Count > 0)
204 { 238 {
@@ -232,6 +266,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
232 } 266 }
233 } 267 }
234 268
269 m_log.Info("MRM 7");
270
235 if (!File.Exists(OutFile)) 271 if (!File.Exists(OutFile))
236 { 272 {
237 string errtext = String.Empty; 273 string errtext = String.Empty;
@@ -256,6 +292,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
256 throw new Exception(errtext); 292 throw new Exception(errtext);
257 } 293 }
258 294
295 m_log.Info("MRM 8");
296
259 // Convert to base64 297 // Convert to base64
260 // 298 //
261 string filetext = Convert.ToBase64String(data); 299 string filetext = Convert.ToBase64String(data);
@@ -264,10 +302,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
264 302
265 Byte[] buf = enc.GetBytes(filetext); 303 Byte[] buf = enc.GetBytes(filetext);
266 304
305 m_log.Info("MRM 9");
306
267 FileStream sfs = File.Create(OutFile + ".cil.b64"); 307 FileStream sfs = File.Create(OutFile + ".cil.b64");
268 sfs.Write(buf, 0, buf.Length); 308 sfs.Write(buf, 0, buf.Length);
269 sfs.Close(); 309 sfs.Close();
270 310
311 m_log.Info("MRM 10");
312
271 return OutFile; 313 return OutFile;
272 } 314 }
273 } 315 }
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/DrunkenTextAppreciationModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/DrunkenTextAppreciationModule.cs
index 5b1841d..7e8db9c 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/DrunkenTextAppreciationModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/DrunkenTextAppreciationModule.cs
@@ -38,11 +38,14 @@ namespace OpenSim
38 38
39 void World_OnChat(IWorld sender, ChatEventArgs e) 39 void World_OnChat(IWorld sender, ChatEventArgs e)
40 { 40 {
41 e.Text.Replace("s", "sh"); 41 if(!e.Text.Contains("hic!"))
42 e.Text.Replace("S", "Sh"); 42 {
43 e.Text += " ...hic!"; 43 e.Text = e.Text.Replace("s", "sh");
44 e.Text = e.Text.Replace("S", "Sh");
45 e.Text += " ...hic!";
44 46
45 Host.Object.Say(e.Text); 47 Host.Object.Say(e.Text);
48 }
46 } 49 }
47 50
48 public override void Stop() 51 public override void Stop()
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
index e3553bf..802d984 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
@@ -26,7 +26,10 @@
26 */ 26 */
27 27
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Reflection;
30using log4net;
29using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Framework.Client;
30using OpenSim.Region.Framework.Interfaces; 33using OpenSim.Region.Framework.Interfaces;
31using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
32 35
@@ -34,6 +37,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
34{ 37{
35 public class World : IWorld 38 public class World : IWorld
36 { 39 {
40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41
37 private readonly Scene m_internalScene; 42 private readonly Scene m_internalScene;
38 private readonly Heightmap m_heights; 43 private readonly Heightmap m_heights;
39 44
@@ -100,7 +105,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
100 return; 105 return;
101 } 106 }
102 // Avatar? 107 // Avatar?
103 if (chat.SenderObject != null && chat.SenderObject == null) 108 if (chat.Sender != null && chat.SenderObject == null)
104 { 109 {
105 ChatEventArgs e = new ChatEventArgs(); 110 ChatEventArgs e = new ChatEventArgs();
106 e.Sender = new SPAvatar(m_internalScene, chat.SenderUUID); 111 e.Sender = new SPAvatar(m_internalScene, chat.SenderUUID);