aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-02-20 14:04:29 +0000
committerJustin Clarke Casey2009-02-20 14:04:29 +0000
commit01f70de2ea562f78991084be01a83295f8f2be0b (patch)
treeff43706bf83039ce9d9c6c5bfffe56f2df1d1c86 /OpenSim/Region/Framework
parentRevert previous commit (diff)
downloadopensim-SC_OLD-01f70de2ea562f78991084be01a83295f8f2be0b.zip
opensim-SC_OLD-01f70de2ea562f78991084be01a83295f8f2be0b.tar.gz
opensim-SC_OLD-01f70de2ea562f78991084be01a83295f8f2be0b.tar.bz2
opensim-SC_OLD-01f70de2ea562f78991084be01a83295f8f2be0b.tar.xz
* Consistently lock part.TaskInventory as pointed out in http://opensimulator.org/mantis/view.php?id=3159
* Not locking causes enumeration exceptions as described in this matis * part.TaskInventory needs to be locked for every access as it's a dictionary * Extra locking will hopefully not cause any major issues - in places where the enumeration of the dictionary performs other lock or long running operations, the dictionary is cloned instead
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs34
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs6
3 files changed, 30 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
index 1a3c4c8..f7db908 100644
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
+++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
@@ -226,9 +226,12 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
226 { 226 {
227 TaskInventoryDictionary tinv = sog.RootPart.TaskInventory; 227 TaskInventoryDictionary tinv = sog.RootPart.TaskInventory;
228 228
229 foreach (TaskInventoryItem titem in tinv.Values) 229 lock (tinv)
230 { 230 {
231 uuids.Add(titem.AssetID, (InventoryType)titem.Type == InventoryType.Texture); 231 foreach (TaskInventoryItem titem in tinv.Values)
232 {
233 uuids.Add(titem.AssetID, (InventoryType)titem.Type == InventoryType.Texture);
234 }
232 } 235 }
233 } 236 }
234 237
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index ec3fdf1..27c22eb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1710,12 +1710,15 @@ if (m_shape != null) {
1710 info.AddValue("m_inventoryFileName", Inventory.GetInventoryFileName()); 1710 info.AddValue("m_inventoryFileName", Inventory.GetInventoryFileName());
1711 info.AddValue("m_folderID", UUID); 1711 info.AddValue("m_folderID", UUID);
1712 info.AddValue("PhysActor", PhysActor); 1712 info.AddValue("PhysActor", PhysActor);
1713 1713
1714 Dictionary<Guid, TaskInventoryItem> TaskInventory_work = new Dictionary<Guid, TaskInventoryItem>(); 1714 Dictionary<Guid, TaskInventoryItem> TaskInventory_work = new Dictionary<Guid, TaskInventoryItem>();
1715 1715
1716 foreach (UUID id in TaskInventory.Keys) 1716 lock (TaskInventory)
1717 { 1717 {
1718 TaskInventory_work.Add(id.Guid, TaskInventory[id]); 1718 foreach (UUID id in TaskInventory.Keys)
1719 {
1720 TaskInventory_work.Add(id.Guid, TaskInventory[id]);
1721 }
1719 } 1722 }
1720 1723
1721 info.AddValue("TaskInventory", TaskInventory_work); 1724 info.AddValue("TaskInventory", TaskInventory_work);
@@ -2166,13 +2169,16 @@ if (m_shape != null) {
2166 { 2169 {
2167 //Trys to fetch sound id from prim's inventory. 2170 //Trys to fetch sound id from prim's inventory.
2168 //Prim's inventory doesn't support non script items yet 2171 //Prim's inventory doesn't support non script items yet
2169 SceneObjectPart op = this; 2172
2170 foreach (KeyValuePair<UUID, TaskInventoryItem> item in op.TaskInventory) 2173 lock (TaskInventory)
2171 { 2174 {
2172 if (item.Value.Name == sound) 2175 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2173 { 2176 {
2174 soundID = item.Value.ItemID; 2177 if (item.Value.Name == sound)
2175 break; 2178 {
2179 soundID = item.Value.ItemID;
2180 break;
2181 }
2176 } 2182 }
2177 } 2183 }
2178 } 2184 }
@@ -2486,13 +2492,15 @@ if (m_shape != null) {
2486 if (!UUID.TryParse(sound, out soundID)) 2492 if (!UUID.TryParse(sound, out soundID))
2487 { 2493 {
2488 // search sound file from inventory 2494 // search sound file from inventory
2489 SceneObjectPart op = this; 2495 lock (TaskInventory)
2490 foreach (KeyValuePair<UUID, TaskInventoryItem> item in op.TaskInventory)
2491 { 2496 {
2492 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 2497 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2493 { 2498 {
2494 soundID = item.Value.ItemID; 2499 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
2495 break; 2500 {
2501 soundID = item.Value.ItemID;
2502 break;
2503 }
2496 } 2504 }
2497 } 2505 }
2498 } 2506 }
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index bc8896e..7b2fae0 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -140,9 +140,11 @@ namespace OpenSim.Region.Framework.Scenes
140 // If the prim is a sculpt then preserve this information too 140 // If the prim is a sculpt then preserve this information too
141 if (part.Shape.SculptTexture != UUID.Zero) 141 if (part.Shape.SculptTexture != UUID.Zero)
142 assetUuids[part.Shape.SculptTexture] = 1; 142 assetUuids[part.Shape.SculptTexture] = 1;
143 143
144 TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();
145
144 // Now analyze this prim's inventory items to preserve all the uuids that they reference 146 // Now analyze this prim's inventory items to preserve all the uuids that they reference
145 foreach (TaskInventoryItem tii in part.TaskInventory.Values) 147 foreach (TaskInventoryItem tii in taskDictionary.Values)
146 { 148 {
147 //m_log.DebugFormat("[ARCHIVER]: Analysing item asset type {0}", tii.Type); 149 //m_log.DebugFormat("[ARCHIVER]: Analysing item asset type {0}", tii.Type);
148 150