Fix a problem where multiple near simultaneous calls to llDie() from multiple scripts in the same linkset can cause unnecessary thread aborts.

The first llDie() could lock Scene.m_deleting_scene_object.
The second llDie() would then wait at this lock.
The first llDie() would go on to remove the second script but always abort it since the second script's WorkItem would not go away.
Easiest solution here is to remove the m_deleting_scene_object since it's no longer justified - we no longer lock m_parts but take a copy instead.
This also requires an adjustment in XEngine.OnRemoveScript not to use instance.ObjectID instead when firing the OnObjectRemoved event.
0.7.3-post-fixes
Justin Clark-Casey (justincc) 2012-03-15 00:20:47 +00:00
parent 9ecbcb787c
commit b01c79354c
2 changed files with 10 additions and 20 deletions

View File

@ -220,8 +220,6 @@ namespace OpenSim.Region.Framework.Scenes
private int m_lastUpdate; private int m_lastUpdate;
private bool m_firstHeartbeat = true; private bool m_firstHeartbeat = true;
private object m_deleting_scene_object = new object();
private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
private bool m_reprioritizationEnabled = true; private bool m_reprioritizationEnabled = true;
private double m_reprioritizationInterval = 5000.0; private double m_reprioritizationInterval = 5000.0;
@ -2007,14 +2005,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); // m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID);
//SceneObjectPart rootPart = group.GetChildPart(group.UUID);
// Serialise calls to RemoveScriptInstances to avoid
// deadlocking on m_parts inside SceneObjectGroup
lock (m_deleting_scene_object)
{
group.RemoveScriptInstances(true); group.RemoveScriptInstances(true);
}
SceneObjectPart[] partList = group.Parts; SceneObjectPart[] partList = group.Parts;

View File

@ -176,12 +176,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
get { return m_ConfigSource; } get { return m_ConfigSource; }
} }
/// <summary>
/// Event fired after the script engine has finished removing a script.
/// </summary>
public event ScriptRemoved OnScriptRemoved; public event ScriptRemoved OnScriptRemoved;
/// <summary>
/// Event fired after the script engine has finished removing a script from an object.
/// </summary>
public event ObjectRemoved OnObjectRemoved; public event ObjectRemoved OnObjectRemoved;
//
// IRegionModule functions
//
public void Initialise(IConfigSource configSource) public void Initialise(IConfigSource configSource)
{ {
if (configSource.Configs["XEngine"] == null) if (configSource.Configs["XEngine"] == null)
@ -1153,14 +1157,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
UnloadAppDomain(instance.AppDomain); UnloadAppDomain(instance.AppDomain);
} }
instance = null;
ObjectRemoved handlerObjectRemoved = OnObjectRemoved; ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
if (handlerObjectRemoved != null) if (handlerObjectRemoved != null)
{ handlerObjectRemoved(instance.ObjectID);
SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
handlerObjectRemoved(part.UUID);
}
ScriptRemoved handlerScriptRemoved = OnScriptRemoved; ScriptRemoved handlerScriptRemoved = OnScriptRemoved;
if (handlerScriptRemoved != null) if (handlerScriptRemoved != null)