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.
This commit is contained in:
Justin Clark-Casey (justincc)
2012-03-15 00:20:47 +00:00
parent 12cebb12d5
commit 2f81e53f63
2 changed files with 10 additions and 20 deletions

View File

@@ -176,12 +176,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
get { return m_ConfigSource; }
}
/// <summary>
/// Event fired after the script engine has finished removing a script.
/// </summary>
public event ScriptRemoved OnScriptRemoved;
/// <summary>
/// Event fired after the script engine has finished removing a script from an object.
/// </summary>
public event ObjectRemoved OnObjectRemoved;
//
// IRegionModule functions
//
public void Initialise(IConfigSource configSource)
{
if (configSource.Configs["XEngine"] == null)
@@ -1122,7 +1126,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
// Give the script some time to finish processing its last event. Simply aborting the script thread can
// cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort.
instance.Stop(1000);
// bool objectRemoved = false;
lock (m_PrimObjects)
@@ -1153,14 +1157,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
UnloadAppDomain(instance.AppDomain);
}
instance = null;
ObjectRemoved handlerObjectRemoved = OnObjectRemoved;
if (handlerObjectRemoved != null)
{
SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
handlerObjectRemoved(part.UUID);
}
handlerObjectRemoved(instance.ObjectID);
ScriptRemoved handlerScriptRemoved = OnScriptRemoved;
if (handlerScriptRemoved != null)