diff options
author | Justin Clark-Casey (justincc) | 2012-03-15 00:20:47 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-03-15 00:20:47 +0000 |
commit | 2f81e53f63012f0ed1623dc6159da01a3807fbf6 (patch) | |
tree | 3ffa114441d92456392f452464f808983fbe1ee3 | |
parent | Alleviate an issue where calling Thread.Abort() on script WorkItems can fail ... (diff) | |
download | opensim-SC-2f81e53f63012f0ed1623dc6159da01a3807fbf6.zip opensim-SC-2f81e53f63012f0ed1623dc6159da01a3807fbf6.tar.gz opensim-SC-2f81e53f63012f0ed1623dc6159da01a3807fbf6.tar.bz2 opensim-SC-2f81e53f63012f0ed1623dc6159da01a3807fbf6.tar.xz |
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.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 19 |
2 files changed, 10 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9e59d50..3a066d4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -219,8 +219,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
219 | 219 | ||
220 | private int m_lastUpdate; | 220 | private int m_lastUpdate; |
221 | private bool m_firstHeartbeat = true; | 221 | private bool m_firstHeartbeat = true; |
222 | |||
223 | private object m_deleting_scene_object = new object(); | ||
224 | 222 | ||
225 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; | 223 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; |
226 | private bool m_reprioritizationEnabled = true; | 224 | private bool m_reprioritizationEnabled = true; |
@@ -1994,15 +1992,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1994 | public void DeleteSceneObject(SceneObjectGroup group, bool silent) | 1992 | public void DeleteSceneObject(SceneObjectGroup group, bool silent) |
1995 | { | 1993 | { |
1996 | // m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); | 1994 | // m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); |
1997 | |||
1998 | //SceneObjectPart rootPart = group.GetChildPart(group.UUID); | ||
1999 | 1995 | ||
2000 | // Serialise calls to RemoveScriptInstances to avoid | 1996 | group.RemoveScriptInstances(true); |
2001 | // deadlocking on m_parts inside SceneObjectGroup | ||
2002 | lock (m_deleting_scene_object) | ||
2003 | { | ||
2004 | group.RemoveScriptInstances(true); | ||
2005 | } | ||
2006 | 1997 | ||
2007 | SceneObjectPart[] partList = group.Parts; | 1998 | SceneObjectPart[] partList = group.Parts; |
2008 | 1999 | ||
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 44397b7..105d97d 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -176,12 +176,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
176 | get { return m_ConfigSource; } | 176 | get { return m_ConfigSource; } |
177 | } | 177 | } |
178 | 178 | ||
179 | /// <summary> | ||
180 | /// Event fired after the script engine has finished removing a script. | ||
181 | /// </summary> | ||
179 | public event ScriptRemoved OnScriptRemoved; | 182 | public event ScriptRemoved OnScriptRemoved; |
183 | |||
184 | /// <summary> | ||
185 | /// Event fired after the script engine has finished removing a script from an object. | ||
186 | /// </summary> | ||
180 | public event ObjectRemoved OnObjectRemoved; | 187 | public event ObjectRemoved OnObjectRemoved; |
181 | 188 | ||
182 | // | ||
183 | // IRegionModule functions | ||
184 | // | ||
185 | public void Initialise(IConfigSource configSource) | 189 | public void Initialise(IConfigSource configSource) |
186 | { | 190 | { |
187 | if (configSource.Configs["XEngine"] == null) | 191 | if (configSource.Configs["XEngine"] == null) |
@@ -1122,7 +1126,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1122 | // Give the script some time to finish processing its last event. Simply aborting the script thread can | 1126 | // Give the script some time to finish processing its last event. Simply aborting the script thread can |
1123 | // cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort. | 1127 | // cause issues on mono 2.6, 2.10 and possibly later where locks are not released properly on abort. |
1124 | instance.Stop(1000); | 1128 | instance.Stop(1000); |
1125 | 1129 | ||
1126 | // bool objectRemoved = false; | 1130 | // bool objectRemoved = false; |
1127 | 1131 | ||
1128 | lock (m_PrimObjects) | 1132 | lock (m_PrimObjects) |
@@ -1153,14 +1157,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1153 | UnloadAppDomain(instance.AppDomain); | 1157 | UnloadAppDomain(instance.AppDomain); |
1154 | } | 1158 | } |
1155 | 1159 | ||
1156 | instance = null; | ||
1157 | |||
1158 | ObjectRemoved handlerObjectRemoved = OnObjectRemoved; | 1160 | ObjectRemoved handlerObjectRemoved = OnObjectRemoved; |
1159 | if (handlerObjectRemoved != null) | 1161 | if (handlerObjectRemoved != null) |
1160 | { | 1162 | handlerObjectRemoved(instance.ObjectID); |
1161 | SceneObjectPart part = m_Scene.GetSceneObjectPart(localID); | ||
1162 | handlerObjectRemoved(part.UUID); | ||
1163 | } | ||
1164 | 1163 | ||
1165 | ScriptRemoved handlerScriptRemoved = OnScriptRemoved; | 1164 | ScriptRemoved handlerScriptRemoved = OnScriptRemoved; |
1166 | if (handlerScriptRemoved != null) | 1165 | if (handlerScriptRemoved != null) |