aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorOren Hurvitz2012-08-09 14:51:05 +0300
committerJustin Clark-Casey (justincc)2013-01-02 22:28:41 +0000
commit9784e4e07db63a23897876dfbd27974878d5eca9 (patch)
tree07a56bc67cc6f6097217e05b62d7428cad9bb96f /OpenSim/Region/CoreModules
parentIf Save OAR/IAR times-out while waiting for assets then notify the caller tha... (diff)
downloadopensim-SC_OLD-9784e4e07db63a23897876dfbd27974878d5eca9.zip
opensim-SC_OLD-9784e4e07db63a23897876dfbd27974878d5eca9.tar.gz
opensim-SC_OLD-9784e4e07db63a23897876dfbd27974878d5eca9.tar.bz2
opensim-SC_OLD-9784e4e07db63a23897876dfbd27974878d5eca9.tar.xz
Changed locks to prevent deadlocks (especially during multi-region Load OAR)
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs42
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs47
-rw-r--r--OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs11
3 files changed, 61 insertions, 39 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index c810242..32d245f 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -604,13 +604,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver
604 /// <returns></returns> 604 /// <returns></returns>
605 private bool ResolveUserUuid(Scene scene, UUID uuid) 605 private bool ResolveUserUuid(Scene scene, UUID uuid)
606 { 606 {
607 if (!m_validUserUuids.ContainsKey(uuid)) 607 lock (m_validUserUuids)
608 { 608 {
609 UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, uuid); 609 if (!m_validUserUuids.ContainsKey(uuid))
610 m_validUserUuids.Add(uuid, account != null); 610 {
611 } 611 // Note: we call GetUserAccount() inside the lock because this UserID is likely
612 // to occur many times, and we only want to query the users service once.
613 UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, uuid);
614 m_validUserUuids.Add(uuid, account != null);
615 }
612 616
613 return m_validUserUuids[uuid]; 617 return m_validUserUuids[uuid];
618 }
614 } 619 }
615 620
616 /// <summary> 621 /// <summary>
@@ -623,19 +628,26 @@ namespace OpenSim.Region.CoreModules.World.Archiver
623 if (uuid == UUID.Zero) 628 if (uuid == UUID.Zero)
624 return true; // this means the object has no group 629 return true; // this means the object has no group
625 630
626 if (!m_validGroupUuids.ContainsKey(uuid)) 631 lock (m_validGroupUuids)
627 { 632 {
628 bool exists; 633 if (!m_validGroupUuids.ContainsKey(uuid))
629 634 {
630 if (m_groupsModule == null) 635 bool exists;
631 exists = false; 636 if (m_groupsModule == null)
632 else 637 {
633 exists = (m_groupsModule.GetGroupRecord(uuid) != null); 638 exists = false;
639 }
640 else
641 {
642 // Note: we call GetGroupRecord() inside the lock because this GroupID is likely
643 // to occur many times, and we only want to query the groups service once.
644 exists = (m_groupsModule.GetGroupRecord(uuid) != null);
645 }
646 m_validGroupUuids.Add(uuid, exists);
647 }
634 648
635 m_validGroupUuids.Add(uuid, exists); 649 return m_validGroupUuids[uuid];
636 } 650 }
637
638 return m_validGroupUuids[uuid];
639 } 651 }
640 652
641 /// Load an asset 653 /// Load an asset
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index e85b7a2..4b1e6b9 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -287,14 +287,15 @@ namespace OpenSim.Region.CoreModules.World.Land
287 LandData newData = data.Copy(); 287 LandData newData = data.Copy();
288 newData.LocalID = local_id; 288 newData.LocalID = local_id;
289 289
290 ILandObject land;
290 lock (m_landList) 291 lock (m_landList)
291 { 292 {
292 if (m_landList.ContainsKey(local_id)) 293 if (m_landList.TryGetValue(local_id, out land))
293 { 294 land.LandData = newData;
294 m_landList[local_id].LandData = newData;
295 m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, m_landList[local_id]);
296 }
297 } 295 }
296
297 if (land != null)
298 m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, land);
298 } 299 }
299 300
300 public bool AllowedForcefulBans 301 public bool AllowedForcefulBans
@@ -613,7 +614,7 @@ namespace OpenSim.Region.CoreModules.World.Land
613 // Only now can we add the prim counts to the land object - we rely on the global ID which is generated 614 // Only now can we add the prim counts to the land object - we rely on the global ID which is generated
614 // as a random UUID inside LandData initialization 615 // as a random UUID inside LandData initialization
615 if (m_primCountModule != null) 616 if (m_primCountModule != null)
616 new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID); 617 new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID);
617 618
618 lock (m_landList) 619 lock (m_landList)
619 { 620 {
@@ -650,6 +651,7 @@ namespace OpenSim.Region.CoreModules.World.Land
650 /// <param name="local_id">Land.localID of the peice of land to remove.</param> 651 /// <param name="local_id">Land.localID of the peice of land to remove.</param>
651 public void removeLandObject(int local_id) 652 public void removeLandObject(int local_id)
652 { 653 {
654 ILandObject land;
653 lock (m_landList) 655 lock (m_landList)
654 { 656 {
655 for (int x = 0; x < 64; x++) 657 for (int x = 0; x < 64; x++)
@@ -666,9 +668,11 @@ namespace OpenSim.Region.CoreModules.World.Land
666 } 668 }
667 } 669 }
668 670
669 m_scene.EventManager.TriggerLandObjectRemoved(m_landList[local_id].LandData.GlobalID); 671 land = m_landList[local_id];
670 m_landList.Remove(local_id); 672 m_landList.Remove(local_id);
671 } 673 }
674
675 m_scene.EventManager.TriggerLandObjectRemoved(land.LandData.GlobalID);
672 } 676 }
673 677
674 /// <summary> 678 /// <summary>
@@ -676,21 +680,27 @@ namespace OpenSim.Region.CoreModules.World.Land
676 /// </summary> 680 /// </summary>
677 public void Clear(bool setupDefaultParcel) 681 public void Clear(bool setupDefaultParcel)
678 { 682 {
683 List<ILandObject> parcels;
679 lock (m_landList) 684 lock (m_landList)
680 { 685 {
681 foreach (ILandObject lo in m_landList.Values) 686 parcels = new List<ILandObject>(m_landList.Values);
682 { 687 }
683 //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); 688
684 m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID); 689 foreach (ILandObject lo in parcels)
685 } 690 {
691 //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID);
692 m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID);
693 }
686 694
695 lock (m_landList)
696 {
687 m_landList.Clear(); 697 m_landList.Clear();
688 698
689 ResetSimLandObjects(); 699 ResetSimLandObjects();
690
691 if (setupDefaultParcel)
692 CreateDefaultParcel();
693 } 700 }
701
702 if (setupDefaultParcel)
703 CreateDefaultParcel();
694 } 704 }
695 705
696 private void performFinalLandJoin(ILandObject master, ILandObject slave) 706 private void performFinalLandJoin(ILandObject master, ILandObject slave)
@@ -1458,11 +1468,8 @@ namespace OpenSim.Region.CoreModules.World.Land
1458 1468
1459 public void EventManagerOnNoLandDataFromStorage() 1469 public void EventManagerOnNoLandDataFromStorage()
1460 { 1470 {
1461 lock (m_landList) 1471 ResetSimLandObjects();
1462 { 1472 CreateDefaultParcel();
1463 ResetSimLandObjects();
1464 CreateDefaultParcel();
1465 }
1466 } 1473 }
1467 1474
1468 #endregion 1475 #endregion
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
index f9cc0cf..9b51cc8 100644
--- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
@@ -490,11 +490,14 @@ namespace OpenSim.Region.CoreModules.World.Land
490 490
491 m_Scene.ForEachSOG(AddObject); 491 m_Scene.ForEachSOG(AddObject);
492 492
493 List<UUID> primcountKeys = new List<UUID>(m_PrimCounts.Keys); 493 lock (m_PrimCounts)
494 foreach (UUID k in primcountKeys)
495 { 494 {
496 if (!m_OwnerMap.ContainsKey(k)) 495 List<UUID> primcountKeys = new List<UUID>(m_PrimCounts.Keys);
497 m_PrimCounts.Remove(k); 496 foreach (UUID k in primcountKeys)
497 {
498 if (!m_OwnerMap.ContainsKey(k))
499 m_PrimCounts.Remove(k);
500 }
498 } 501 }
499 502
500 m_Tainted = false; 503 m_Tainted = false;