diff options
author | Justin Clarke Casey | 2008-09-19 18:50:19 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-09-19 18:50:19 +0000 |
commit | 4c7ddd2c71c5189d7045c63a7a421d8742d8fcd4 (patch) | |
tree | d0b6f24d161676f614e7076030343120fb72c049 | |
parent | convert to using proper .net tempfiles, should have done this (diff) | |
download | opensim-SC-4c7ddd2c71c5189d7045c63a7a421d8742d8fcd4.zip opensim-SC-4c7ddd2c71c5189d7045c63a7a421d8742d8fcd4.tar.gz opensim-SC-4c7ddd2c71c5189d7045c63a7a421d8742d8fcd4.tar.bz2 opensim-SC-4c7ddd2c71c5189d7045c63a7a421d8742d8fcd4.tar.xz |
* 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
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 466a879..7255de4 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -406,9 +406,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
406 | // Get the asset ID of the script, so we can check if we | 406 | // Get the asset ID of the script, so we can check if we |
407 | // already have it. | 407 | // already have it. |
408 | 408 | ||
409 | // We must look for the part outside the m_Scripts lock because GetSceneObjectPart later triggers the | ||
410 | // m_parts lock on SOG. At the same time, a scene object that is being deleted will take the m_parts lock | ||
411 | // and then later on try to take the m_scripts lock in this class when it calls OnRemoveScript() | ||
409 | SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); | 412 | SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); |
410 | if (part == null) | 413 | if (part == null) |
414 | { | ||
415 | Log.Error("[Script] SceneObjectPart unavailable. Script NOT started."); | ||
411 | return false; | 416 | return false; |
417 | } | ||
412 | 418 | ||
413 | TaskInventoryItem item = part.GetInventoryItem(itemID); | 419 | TaskInventoryItem item = part.GetInventoryItem(itemID); |
414 | if (item == null) | 420 | if (item == null) |
@@ -494,7 +500,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
494 | m_DomainScripts[appDomain].Add(itemID); | 500 | m_DomainScripts[appDomain].Add(itemID); |
495 | 501 | ||
496 | ScriptInstance instance = | 502 | ScriptInstance instance = |
497 | new ScriptInstance(this,localID, | 503 | new ScriptInstance(this, part.LocalId, |
498 | part.UUID, itemID, assetID, assembly, | 504 | part.UUID, itemID, assetID, assembly, |
499 | m_AppDomains[appDomain], | 505 | m_AppDomains[appDomain], |
500 | part.ParentGroup.RootPart.Name, | 506 | part.ParentGroup.RootPart.Name, |