aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2015-01-27 18:58:11 +0000
committerJustin Clark-Casey (justincc)2015-01-27 19:07:20 +0000
commite0a34402637e9035e9f19f0992cac7829b816428 (patch)
treeabb2d11c70f4d51a04effa0b846083d9228c1228 /OpenSim
parentIf an exception comes out of DoOnRezScript in DoOnRezScriptQueue(), then only... (diff)
downloadopensim-SC-e0a34402637e9035e9f19f0992cac7829b816428.zip
opensim-SC-e0a34402637e9035e9f19f0992cac7829b816428.tar.gz
opensim-SC-e0a34402637e9035e9f19f0992cac7829b816428.tar.bz2
opensim-SC-e0a34402637e9035e9f19f0992cac7829b816428.tar.xz
If [XEngine] ScriptStopStrategy is different from a compiled script strategy, ask user to manually set DeleteScriptsOnStartup = true for at least one simuator session rather than auto-recompiling.
This does not work on Windows since the VM retains a handle to the DLL even if class instantiation was unsuccessful. Which causes deletion of the old DLL to fail with access sharing violations. Instead, log a warning in this situation asking the user to manually set DeleteScriptsOnStartup = true for a session (or one could separately delete the DLLs in the relevant bin/scriptengines/<region-uuid> dir For the current session, the script engine will continue using the script compiled stop strategy as before. Relates to http://opensimulator.org/mantis/view.php?id=7278
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs54
1 files changed, 26 insertions, 28 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 3f77371..44201aa 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -74,6 +74,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
74 /// </remarks> 74 /// </remarks>
75 public int DebugLevel { get; set; } 75 public int DebugLevel { get; set; }
76 76
77 /// <summary>
78 /// A parameter to allow us to notify the log if at least one script has a compilation that is not compatible
79 /// with ScriptStopStrategy.
80 /// </summary>
81 public bool HaveNotifiedLogOfScriptStopMistmatch { get; private set; }
82
77 private SmartThreadPool m_ThreadPool; 83 private SmartThreadPool m_ThreadPool;
78 private int m_MaxScriptQueue; 84 private int m_MaxScriptQueue;
79 private Scene m_Scene; 85 private Scene m_Scene;
@@ -1339,11 +1345,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1339 m_DomainScripts[appDomain].Add(itemID); 1345 m_DomainScripts[appDomain].Add(itemID);
1340 1346
1341 IScript scriptObj = null; 1347 IScript scriptObj = null;
1342 bool recompile = false; 1348 EventWaitHandle coopSleepHandle;
1343 bool abortAfterRecompile = false;
1344 EventWaitHandle coopSleepHandle = null;
1345 bool coopTerminationForThisScript; 1349 bool coopTerminationForThisScript;
1346 string typeName;
1347 1350
1348 // Set up assembly name to point to the appropriate scriptEngines directory 1351 // Set up assembly name to point to the appropriate scriptEngines directory
1349 AssemblyName assemblyName = new AssemblyName(Path.GetFileNameWithoutExtension(assemblyPath)); 1352 AssemblyName assemblyName = new AssemblyName(Path.GetFileNameWithoutExtension(assemblyPath));
@@ -1368,7 +1371,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1368 1371
1369 coopTerminationForThisScript = true; 1372 coopTerminationForThisScript = true;
1370 } 1373 }
1371 catch (TypeLoadException e) 1374 catch (TypeLoadException)
1372 { 1375 {
1373 coopSleepHandle = null; 1376 coopSleepHandle = null;
1374 1377
@@ -1389,15 +1392,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1389 { 1392 {
1390 m_log.Error( 1393 m_log.Error(
1391 string.Format( 1394 string.Format(
1392 "[XENGINE]: Could not load previous SecondLife.Script from assembly {0} in {1}. Recompiling then aborting. Exception ", 1395 "[XENGINE]: Could not load previous SecondLife.Script from assembly {0} in {1}. Not starting. Exception ",
1393 assemblyName.FullName, World.Name), 1396 assemblyName.FullName, World.Name),
1394 e2); 1397 e2);
1395 1398
1396 abortAfterRecompile = true; 1399 return false;
1397 } 1400 }
1398 1401
1399 coopTerminationForThisScript = false; 1402 coopTerminationForThisScript = false;
1400 recompile = true;
1401 } 1403 }
1402 } 1404 }
1403 else 1405 else
@@ -1415,9 +1417,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1415 null, 1417 null,
1416 null); 1418 null);
1417 1419
1420 coopSleepHandle = null;
1418 coopTerminationForThisScript = false; 1421 coopTerminationForThisScript = false;
1419 } 1422 }
1420 catch (TypeLoadException e) 1423 catch (TypeLoadException)
1421 { 1424 {
1422 coopSleepHandle = new XEngineEventWaitHandle(false, EventResetMode.AutoReset); 1425 coopSleepHandle = new XEngineEventWaitHandle(false, EventResetMode.AutoReset);
1423 1426
@@ -1430,7 +1433,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1430 false, 1433 false,
1431 BindingFlags.Default, 1434 BindingFlags.Default,
1432 null, 1435 null,
1433 new object[] { new XEngineEventWaitHandle(false, EventResetMode.AutoReset) }, 1436 new object[] { coopSleepHandle },
1434 null, 1437 null,
1435 null); 1438 null);
1436 } 1439 }
@@ -1438,33 +1441,28 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1438 { 1441 {
1439 m_log.Error( 1442 m_log.Error(
1440 string.Format( 1443 string.Format(
1441 "[XENGINE]: Could not load previous SecondLife.XEngineScript from assembly {0} in {1}. Recompiling then aborting. Exception ", 1444 "[XENGINE]: Could not load previous SecondLife.XEngineScript from assembly {0} in {1}. Not starting. Exception ",
1442 assemblyName.FullName, World.Name), 1445 assemblyName.FullName, World.Name),
1443 e2); 1446 e2);
1444 1447
1445 abortAfterRecompile = true; 1448 return false;
1446 } 1449 }
1447 1450
1448 coopTerminationForThisScript = true; 1451 coopTerminationForThisScript = true;
1449 recompile = true;
1450 } 1452 }
1451 } 1453 }
1452 1454
1453 // If we are loading all scripts into the same AppDomain, then we can't reload the DLL in this 1455 if (m_coopTermination != coopTerminationForThisScript && !HaveNotifiedLogOfScriptStopMistmatch)
1454 // simulator session if the script halt strategy has been changed. Instead, we'll continue with
1455 // the existing DLL and the new one will be used in the next simulator session.
1456 if (recompile)
1457 { 1456 {
1458 m_log.DebugFormat( 1457 // Notify the log that there is at least one script compile that doesn't match the
1459 "[XEngine]: Recompiling script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5} to switch it to {6} termination. New termination will be active on next restart.", 1458 // ScriptStopStrategy. Operator has to manually delete old DLLs - we can't do this on Windows
1460 part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID, 1459 // once the assembly has been loaded evne if the instantiation of a class was unsuccessful.
1461 part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.Name, 1460 m_log.WarnFormat(
1462 m_coopTermination ? "co-op" : "abort"); 1461 "[XEngine]: At least one existing compiled script DLL in {0} has {1} as ScriptStopStrategy whereas config setting is {2}."
1463 1462 + "\nContinuing with script compiled strategy but to remove this message please set [XEngine] DeleteScriptsOnStartup = true for one simulator session to remove old script DLLs (script state will not be lost).",
1464 m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, true, out assemblyPath, out linemap); 1463 World.Name, coopTerminationForThisScript ? "co-op" : "abort", m_coopTermination);
1465 1464
1466 if (abortAfterRecompile) 1465 HaveNotifiedLogOfScriptStopMistmatch = true;
1467 return false;
1468 } 1466 }
1469 1467
1470 instance = new ScriptInstance(this, part, 1468 instance = new ScriptInstance(this, part,