Xengine: remove option CompactMemOnLoad, that wasn't that good; add option AttachmentsDomainLoading to allow attachments to load on own appdomain even if AppDomainLoading is false. Scripts will be slower, use more memory but will be disposed on avatar leave, if gc is in good mood. This may be usefull on regions with a lot of traffic, sure use Yengine even better,

master
UbitUmarov 2020-07-27 16:13:09 +01:00
parent 0c716cbd73
commit be5c2bb212
2 changed files with 12 additions and 27 deletions

View File

@ -110,7 +110,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
private int m_ScriptFailCount; // Number of script fails since compile queue was last empty
private string m_ScriptErrorMessage;
private bool m_AppDomainLoading;
private bool m_CompactMemOnLoad;
private bool m_AttachmentsDomainLoading;
private Dictionary<UUID,ArrayList> m_ScriptErrors =
new Dictionary<UUID,ArrayList>();
@ -308,7 +308,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
m_StackSize = m_ScriptConfig.GetInt("ThreadStackSize", 262144);
m_SleepTime = m_ScriptConfig.GetInt("MaintenanceInterval", 10) * 1000;
m_AppDomainLoading = m_ScriptConfig.GetBoolean("AppDomainLoading", false);
m_CompactMemOnLoad = m_ScriptConfig.GetBoolean("CompactMemOnLoad", false);
m_AttachmentsDomainLoading = m_ScriptConfig.GetBoolean("AttachmentsDomainLoading", false);
m_EventLimit = m_ScriptConfig.GetInt("EventLimit", 30);
m_KillTimedOutScripts = m_ScriptConfig.GetBoolean("KillTimedOutScripts", false);
m_SaveTime = m_ScriptConfig.GetInt("SaveInterval", 120) * 1000;
@ -1295,22 +1295,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
}
}
// optionaly do not load a assembly on top of a lot of to release memory
// only if logins disable since causes a lot of rubber banding
if(m_CompactMemOnLoad && !m_Scene.LoginsEnabled)
GC.Collect(2);
ScriptInstance instance = null;
lock (m_Scripts)
{
// Create the object record
if ((!m_Scripts.ContainsKey(itemID)) ||
(m_Scripts[itemID].AssetID != assetID))
if ((!m_Scripts.ContainsKey(itemID)) || (m_Scripts[itemID].AssetID != assetID))
{
// UUID appDomain = assetID;
// if (part.ParentGroup.IsAttachment)
// appDomain = part.ParentGroup.RootPart.UUID;
bool attachDomains = m_AttachmentsDomainLoading && part.ParentGroup.IsAttachmentCheckFull();
UUID appDomain = part.ParentGroup.RootPart.UUID;
if (!m_AppDomains.ContainsKey(appDomain))
@ -1318,7 +1310,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
try
{
AppDomain sandbox;
if (m_AppDomainLoading)
if (m_AppDomainLoading || attachDomains)
{
AppDomainSetup appSetup = new AppDomainSetup();
appSetup.PrivateBinPath = Path.Combine(
@ -1349,7 +1341,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
//sandbox.SetAppDomainPolicy(sandboxPolicy);
m_AppDomains[appDomain] = sandbox;
m_DomainScripts[appDomain] = new List<UUID>();
}
catch (Exception e)
@ -1366,6 +1357,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return false;
}
}
m_DomainScripts[appDomain].Add(itemID);
IScript scriptObj = null;
@ -1616,13 +1608,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
UnloadAppDomain(instance.AppDomain);
}
ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
if (handlerObjectRemoved != null)
handlerObjectRemoved(instance.ObjectID);
ScriptRemoved handlerScriptRemoved = OnScriptRemoved;
if (handlerScriptRemoved != null)
handlerScriptRemoved(itemID);
OnObjectRemoved?.Invoke(instance.ObjectID);
OnScriptRemoved?.Invoke(itemID);
}
public void OnScriptReset(uint localID, UUID itemID)

View File

@ -1800,6 +1800,10 @@
; so default is now false until a fix is found
; AppDomainLoading = false
; Set this to true to load attachment scripts in separated domain, if AppDomainLoading is false
; same issues as AppDomainLoading, but my be usefull on regions with a lot of avatars traffic, if they carry scripts like AOs
; AppDomainLoading = false
; Controls whether previously compiled scripts DLLs are deleted on sim restart.
; If you set this to false then startup will be considerably faster since scripts won't need to be recompiled.
; It should be true on first run after updating opensim binary version
@ -1808,12 +1812,6 @@
; This does not delete cached scripts state.
; DeleteScriptsOnStartup = true
; CompactMemOnLoad
; forces calls to memory garbage collector before loading each script DLL during region startup.
; Peak memory usage is reduced and region starts with a more compacted memory allocation.
; But this costs a lot of time, so region load will take a lot longer.
; it is more usefull if there are no previously compiled scripts DLLs (or DeleteScriptsOnStartup = true)
; CompactMemOnLoad = false
; Controls whether scripts are stopped by aborting their threads externally (abort)
; or by co-operative checks inserted by OpenSimulator into compiled script (co-op).