* Remove one possible deadlock situation as seen today

* On script rez, XEngine was taking an m_scripts lock and then later on an m_parts lock when looking for a part by local id
* In the meantime, a scene object being deleted would take an m_parts lock and then later on try to take an m_scripts lock when it tried to trigger script removal
* There may be better ways to resolve this, but I believe that in general, we must always take an m_parts lock before an m_scripts lock
0.6.0-stable
Justin Clarke Casey 2008-09-19 18:50:19 +00:00
parent 7ac264c2f0
commit 4c7ddd2c71
1 changed files with 7 additions and 1 deletions

View File

@ -406,9 +406,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
// Get the asset ID of the script, so we can check if we
// already have it.
// We must look for the part outside the m_Scripts lock because GetSceneObjectPart later triggers the
// m_parts lock on SOG. At the same time, a scene object that is being deleted will take the m_parts lock
// and then later on try to take the m_scripts lock in this class when it calls OnRemoveScript()
SceneObjectPart part = m_Scene.GetSceneObjectPart(localID);
if (part == null)
{
Log.Error("[Script] SceneObjectPart unavailable. Script NOT started.");
return false;
}
TaskInventoryItem item = part.GetInventoryItem(itemID);
if (item == null)
@ -494,7 +500,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
m_DomainScripts[appDomain].Add(itemID);
ScriptInstance instance =
new ScriptInstance(this,localID,
new ScriptInstance(this, part.LocalId,
part.UUID, itemID, assetID, assembly,
m_AppDomains[appDomain],
part.ParentGroup.RootPart.Name,