In co-op termination, extend EventWaitHandle to give this an indefinite lifetime in order to avoid a later RemotingException if scripts are being loaded into their own domains.
This is necessary because XEngineScriptBase now retains a reference to an EventWaitHandle when co-op termination is active. Aims to address http://opensimulator.org/mantis/view.php?id=6634cpu-performance
parent
65239b059f
commit
3d118fb580
|
@ -241,7 +241,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
if (Engine.Config.GetString("ScriptStopStrategy", "abort") == "co-op")
|
||||
{
|
||||
m_coopTermination = true;
|
||||
m_coopSleepHandle = new AutoResetEvent(false);
|
||||
m_coopSleepHandle = new XEngineEventWaitHandle(false, EventResetMode.AutoReset);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1201,4 +1201,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
|||
Suspended = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Xengine event wait handle.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This class exists becase XEngineScriptBase gets a reference to this wait handle. We need to make sure that
|
||||
/// when scripts are running in different AppDomains the lease does not expire.
|
||||
/// FIXME: Like LSL_Api, etc., this effectively leaks memory since the GC will never collect it. To avoid this,
|
||||
/// proper remoting sponsorship needs to be implemented across the board.
|
||||
/// </remarks>
|
||||
public class XEngineEventWaitHandle : EventWaitHandle
|
||||
{
|
||||
public XEngineEventWaitHandle(bool initialState, EventResetMode mode) : base(initialState, mode) {}
|
||||
|
||||
public override Object InitializeLifetimeService()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue