From 0e7c4046d3fde862c56b7b5255b48928fa2652e6 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 7 Apr 2008 17:28:02 +0000 Subject: [PATCH] * Nasty hack to reduce the incidence of spurious exceptions where a user deletes a newly rezzed object before the persistence thread gets to it from its queue. * This should greatly reduce but not eliminate the problem - elimination probably requires a redesign of the prim persistence processes --- OpenSim/Region/Environment/Scenes/InnerScene.cs | 10 +++++++++- OpenSim/Region/Environment/Scenes/Scene.cs | 10 +++++++++- OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 7 ++++--- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 9a720d93af..ef98599139 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -236,7 +236,15 @@ namespace OpenSim.Region.Environment.Scenes // Don't abort the whole update if one entity happens to give us an exception. try { - m_updateList[i].Update(); + // A null name signals that this group was deleted before the scheduled update + // FIXME: This is merely a temporary measure to reduce the incidence of failure, when + // an object has been deleted from a scene before update was processed. + // A more fundamental overhaul of the update mechanism is required to eliminate all + // the race conditions. + if (entity.Name != null) + { + m_updateList[i].Update(); + } } catch (Exception e) { diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 101bac30a3..8f4c332043 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -2676,7 +2676,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// public void DeleteSceneObjectGroup(SceneObjectGroup group) - { + { SceneObjectPart rootPart = (group).GetChildPart(group.UUID); if (rootPart.PhysActor != null) { @@ -2693,6 +2693,14 @@ namespace OpenSim.Region.Environment.Scenes m_innerScene.RemoveAPrimCount(); } group.DeleteParts(); + + // In case anybody else retains a reference to this group, signal deletion by changing the name + // to null. We can't zero out the UUID because this is taken from the root part, which has already + // been removed. + // FIXME: This is a really poor temporary solution, since it still leaves plenty of scope for race + // conditions where a user deletes an entity while it is being stored. Really, the update + // code needs a redesign. + group.Name = null; } /// diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 38c7e4528f..90f0708a7a 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -128,7 +128,8 @@ namespace OpenSim.Region.Environment.Scenes { if( m_rootPart == null ) { - throw new NullReferenceException(string.Format("Object {0} has no root part.", m_uuid)); + throw new NullReferenceException( + string.Format("[SCENE OBJECT GROUP]: Object {0} has no root part.", m_uuid)); } return m_rootPart.GroupPosition; @@ -164,7 +165,7 @@ namespace OpenSim.Region.Environment.Scenes get { if (m_rootPart == null) { - m_log.Error("[PRIMGROUP]: Unable to find the rootpart for a LocalId Request!"); + m_log.Error("[SCENE OBJECT GROUP]: Unable to find the rootpart for a LocalId Request!"); return 0; } @@ -1948,7 +1949,7 @@ namespace OpenSim.Region.Environment.Scenes /// Completely delete this group and tell all the scene presences about that deletion. /// public void DeleteGroup() - { + { DetachFromBackup(this); lock (m_parts)