aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
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/World/Archiver/ArchiveReadRequest.cs
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 '')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs42
1 files changed, 27 insertions, 15 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