aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.cs
diff options
context:
space:
mode:
authorSean Dague2008-11-10 12:42:22 +0000
committerSean Dague2008-11-10 12:42:22 +0000
commitbfc2d8c231234c35ae8134d885c26f0fe14935e2 (patch)
tree8673d0e1cb8947ee96bb2a7a92df7436e8dd3c49 /OpenSim/Region/Environment/Scenes/Scene.cs
parentThe region proxy for the load balancer module works again. The incoming proxy... (diff)
downloadopensim-SC_OLD-bfc2d8c231234c35ae8134d885c26f0fe14935e2.zip
opensim-SC_OLD-bfc2d8c231234c35ae8134d885c26f0fe14935e2.tar.gz
opensim-SC_OLD-bfc2d8c231234c35ae8134d885c26f0fe14935e2.tar.bz2
opensim-SC_OLD-bfc2d8c231234c35ae8134d885c26f0fe14935e2.tar.xz
From: Christopher Yeoh <cyeoh@au1.ibm.com>
This patch addresses mantis bug 2576. http://opensimulator.org/mantis/view.php?id=2576 Briefly, if you call llDie from many scripts at the same time (say a build is cleaning up excess objects) then OpenSim deadlocks. Avatars are unable to move, and whilst the console is active you can't do much without it also locking up. This only occurs with the XEngine script engine enabled. I have attached a patch which works, but I'm not sure its the right way to address the problem. The fundamental problem is that a lock on a SceneObjectGroup's m_parts is taken when the object is deleted, a callback to the script engine occurs and a fair way down the callchain, potentially there are locks taken on several other SceneObjectGroup's m_parts. Deadlock then occurs if you get unlucky enough to get in the situation where with several llDie's are called and SceneObjectGroups have taken a lock on their own m_parts, and end up waiting on each other's locks to become available. The patch adds a lock at a high level so that that the removal of script instances from an object only occurs once per scene at a time. This avoids the potential of deadlock. Theoretically there could be some performance hit but AFAICT the path taken is not a common occurrence. Would welcome any suggestions for a better solution, otherwise feel free to apply :-) Note this patch was built against the 0.6.0 freeze as trunk was rather broken for me this morning (creating a script killed the client connection).
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs8
1 files changed, 7 insertions, 1 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 6634028..f1c4c6c 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -164,6 +164,8 @@ namespace OpenSim.Region.Environment.Scenes
164 private Thread HeartbeatThread; 164 private Thread HeartbeatThread;
165 private volatile bool shuttingdown = false; 165 private volatile bool shuttingdown = false;
166 166
167 private object m_deleting_scene_object = new object();
168
167 #endregion 169 #endregion
168 170
169 #region Properties 171 #region Properties
@@ -1824,7 +1826,11 @@ namespace OpenSim.Region.Environment.Scenes
1824 { 1826 {
1825 //SceneObjectPart rootPart = group.GetChildPart(group.UUID); 1827 //SceneObjectPart rootPart = group.GetChildPart(group.UUID);
1826 1828
1827 group.RemoveScriptInstances(); 1829 // Serialise calls to RemoveScriptInstances to avoid
1830 // deadlocking on m_parts inside SceneObjectGroup
1831 lock (m_deleting_scene_object) {
1832 group.RemoveScriptInstances();
1833 }
1828 1834
1829 foreach (SceneObjectPart part in group.Children.Values) 1835 foreach (SceneObjectPart part in group.Children.Values)
1830 { 1836 {