From ea0f78c97152d3aa54822487e5343ca2db0b47b9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 12 Sep 2011 21:57:22 +0100 Subject: Start locking entire add/remove operations on an IScenePresence.AttachmentsSyncLock object Attach and detach packets are processed asynchronously when received from a viewer. Bugs like http://opensimulator.org/mantis/view.php?id=5644 indicate that in some situations (such as attaching/detaching entire folders of objects at once), there are race conditions between these threads. Since multiple data structures need to be updated on attach/detach, it's not enough to lock the individual collections. Therefore, this commit introduces a new IScenePresence.AttachmentsSyncLock which add/remove operations lock on. --- OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | 9 +++++++++ OpenSim/Region/Framework/Interfaces/IScenePresence.cs | 8 ++++++++ 2 files changed, 17 insertions(+) (limited to 'OpenSim/Region/Framework/Interfaces') diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 73d15a5..e6ac6b5 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs @@ -88,6 +88,15 @@ namespace OpenSim.Region.Framework.Interfaces ISceneEntity RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt); /// + /// Rez an attachment from user inventory and change inventory status to match. + /// + /// + /// + /// + /// The scene object that was attached. Null if the scene object could not be found + ISceneEntity RezSingleAttachmentFromInventory(ScenePresence sp, UUID itemID, uint AttachmentPt); + + /// /// Rez multiple attachments from a user's inventory /// /// diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs index 8913133..95688ab 100644 --- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs +++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs @@ -61,6 +61,14 @@ namespace OpenSim.Region.Framework.Interfaces AvatarAppearance Appearance { get; set; } /// + /// The AttachmentsModule synchronizes on this to avoid race conditions between commands to add and remove attachments. + /// + /// + /// All add and remove attachment operations must synchronize on this for the lifetime of their operations. + /// + Object AttachmentsSyncLock { get; } + + /// /// The scene objects attached to this avatar. /// /// -- cgit v1.1