Really bad idea to lock m_UserCache for so long in UserManagementModule. Added a special lock object instead, if we really want to avoid concurrent executions of that code.
parent
57141e34bf
commit
b33db917f5
|
@ -56,6 +56,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
|
||||
// The cache
|
||||
protected Dictionary<UUID, UserData> m_UserCache = new Dictionary<UUID, UserData>();
|
||||
private object m_AddUserLock = new object();
|
||||
|
||||
#region ISharedRegionModule
|
||||
|
||||
|
@ -475,9 +476,11 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
|
||||
UserData oldUser;
|
||||
//lock the whole block - prevent concurrent update
|
||||
lock (m_UserCache)
|
||||
lock (m_AddUserLock)
|
||||
{
|
||||
m_UserCache.TryGetValue (id, out oldUser);
|
||||
lock (m_UserCache)
|
||||
m_UserCache.TryGetValue(id, out oldUser);
|
||||
|
||||
if (oldUser != null)
|
||||
{
|
||||
if (creatorData == null || creatorData == String.Empty)
|
||||
|
@ -488,9 +491,10 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
|
||||
//try update unknown users
|
||||
//and creator's home URL's
|
||||
if ((oldUser.FirstName == "Unknown" && !creatorData.Contains ("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith (oldUser.HomeURL)))
|
||||
if ((oldUser.FirstName == "Unknown" && !creatorData.Contains("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith(oldUser.HomeURL)))
|
||||
{
|
||||
m_UserCache.Remove (id);
|
||||
lock (m_UserCache)
|
||||
m_UserCache.Remove(id);
|
||||
m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData, oldUser.HomeURL);
|
||||
}
|
||||
else
|
||||
|
@ -500,38 +504,38 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
}
|
||||
}
|
||||
|
||||
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount (m_Scenes [0].RegionInfo.ScopeID, id);
|
||||
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id);
|
||||
|
||||
if (account != null)
|
||||
{
|
||||
AddUser (id, account.FirstName, account.LastName);
|
||||
AddUser(id, account.FirstName, account.LastName);
|
||||
}
|
||||
else
|
||||
{
|
||||
UserData user = new UserData ();
|
||||
UserData user = new UserData();
|
||||
user.Id = id;
|
||||
|
||||
if (creatorData != null && creatorData != string.Empty)
|
||||
{
|
||||
//creatorData = <endpoint>;<name>
|
||||
|
||||
string[] parts = creatorData.Split (';');
|
||||
string[] parts = creatorData.Split(';');
|
||||
if (parts.Length >= 1)
|
||||
{
|
||||
user.HomeURL = parts [0];
|
||||
user.HomeURL = parts[0];
|
||||
try
|
||||
{
|
||||
Uri uri = new Uri (parts [0]);
|
||||
Uri uri = new Uri(parts[0]);
|
||||
user.LastName = "@" + uri.Authority;
|
||||
}
|
||||
catch (UriFormatException)
|
||||
{
|
||||
m_log.DebugFormat ("[SCENE]: Unable to parse Uri {0}", parts [0]);
|
||||
m_log.DebugFormat("[SCENE]: Unable to parse Uri {0}", parts[0]);
|
||||
user.LastName = "@unknown";
|
||||
}
|
||||
}
|
||||
if (parts.Length >= 2)
|
||||
user.FirstName = parts [1].Replace (' ', '.');
|
||||
user.FirstName = parts[1].Replace(' ', '.');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -539,7 +543,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
|||
user.LastName = "UserUMMAU";
|
||||
}
|
||||
|
||||
AddUserInternal (user);
|
||||
AddUserInternal(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue