A stab a getting the user server to act right. Move acquisition of the

locks to just before the try/catch/finally block, so that an exception
thrown between taking the lock and entering the try doesn't leave a mutex
locked
0.6.0-stable
Melanie Thielker 2008-11-01 15:10:45 +00:00
parent 337da2a7a3
commit 4fb2d70373
2 changed files with 21 additions and 18 deletions

View File

@ -403,10 +403,10 @@ namespace OpenSim.Data.MySQL
/// <returns>The sim profile</returns> /// <returns>The sim profile</returns>
override public RegionProfileData GetProfileByString(string regionName) override public RegionProfileData GetProfileByString(string regionName)
{ {
MySQLSuperManager dbm = GetLockedConnection();
if (regionName.Length > 2) if (regionName.Length > 2)
{ {
MySQLSuperManager dbm = GetLockedConnection();
try try
{ {
Dictionary<string, string> param = new Dictionary<string, string>(); Dictionary<string, string> param = new Dictionary<string, string>();
@ -436,8 +436,8 @@ namespace OpenSim.Data.MySQL
dbm.Release(); dbm.Release();
} }
dbm.Release();
} }
dbm.Release();
m_log.Error("[GRID DB]: Searched for a Region Name shorter then 3 characters"); m_log.Error("[GRID DB]: Searched for a Region Name shorter then 3 characters");
return null; return null;
} }

View File

@ -208,8 +208,6 @@ namespace OpenSim.Data.MySQL
public override void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) public override void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms)
{ {
MySQLSuperManager dbm = GetLockedConnection("AddNewUserFriend");
int dtvalue = Util.UnixTimeSinceEpoch(); int dtvalue = Util.UnixTimeSinceEpoch();
Dictionary<string, string> param = new Dictionary<string, string>(); Dictionary<string, string> param = new Dictionary<string, string>();
@ -218,6 +216,8 @@ namespace OpenSim.Data.MySQL
param["?friendPerms"] = perms.ToString(); param["?friendPerms"] = perms.ToString();
param["?datetimestamp"] = dtvalue.ToString(); param["?datetimestamp"] = dtvalue.ToString();
MySQLSuperManager dbm = GetLockedConnection("AddNewUserFriend");
try try
{ {
IDbCommand adder = IDbCommand adder =
@ -252,12 +252,12 @@ namespace OpenSim.Data.MySQL
public override void RemoveUserFriend(UUID friendlistowner, UUID friend) public override void RemoveUserFriend(UUID friendlistowner, UUID friend)
{ {
MySQLSuperManager dbm = GetLockedConnection("RemoveUserFriend");
Dictionary<string, string> param = new Dictionary<string, string>(); Dictionary<string, string> param = new Dictionary<string, string>();
param["?ownerID"] = friendlistowner.ToString(); param["?ownerID"] = friendlistowner.ToString();
param["?friendID"] = friend.ToString(); param["?friendID"] = friend.ToString();
MySQLSuperManager dbm = GetLockedConnection("RemoveUserFriend");
try try
{ {
IDbCommand updater = IDbCommand updater =
@ -286,13 +286,13 @@ namespace OpenSim.Data.MySQL
public override void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) public override void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms)
{ {
MySQLSuperManager dbm = GetLockedConnection("UpdateUserFriendPerms");
Dictionary<string, string> param = new Dictionary<string, string>(); Dictionary<string, string> param = new Dictionary<string, string>();
param["?ownerID"] = friendlistowner.ToString(); param["?ownerID"] = friendlistowner.ToString();
param["?friendID"] = friend.ToString(); param["?friendID"] = friend.ToString();
param["?friendPerms"] = perms.ToString(); param["?friendPerms"] = perms.ToString();
MySQLSuperManager dbm = GetLockedConnection("UpdateUserFriendPerms");
try try
{ {
IDbCommand updater = IDbCommand updater =
@ -317,12 +317,13 @@ namespace OpenSim.Data.MySQL
public override List<FriendListItem> GetUserFriendList(UUID friendlistowner) public override List<FriendListItem> GetUserFriendList(UUID friendlistowner)
{ {
MySQLSuperManager dbm = GetLockedConnection("GetUserFriendList");
List<FriendListItem> Lfli = new List<FriendListItem>(); List<FriendListItem> Lfli = new List<FriendListItem>();
Dictionary<string, string> param = new Dictionary<string, string>(); Dictionary<string, string> param = new Dictionary<string, string>();
param["?ownerID"] = friendlistowner.ToString(); param["?ownerID"] = friendlistowner.ToString();
MySQLSuperManager dbm = GetLockedConnection("GetUserFriendList");
try try
{ {
//Left Join userfriends to itself //Left Join userfriends to itself
@ -373,8 +374,6 @@ namespace OpenSim.Data.MySQL
public override List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query) public override List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query)
{ {
MySQLSuperManager dbm = GetLockedConnection("GeneratePickerResults");
List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]"); Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]");
@ -386,6 +385,8 @@ namespace OpenSim.Data.MySQL
Dictionary<string, string> param = new Dictionary<string, string>(); Dictionary<string, string> param = new Dictionary<string, string>();
param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], String.Empty) + "%"; param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], String.Empty) + "%";
param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], String.Empty) + "%"; param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], String.Empty) + "%";
MySQLSuperManager dbm = GetLockedConnection("GeneratePickerResults");
try try
{ {
IDbCommand result = IDbCommand result =
@ -419,6 +420,8 @@ namespace OpenSim.Data.MySQL
} }
else if (querysplit.Length == 1) else if (querysplit.Length == 1)
{ {
MySQLSuperManager dbm = GetLockedConnection("GeneratePickerResults");
try try
{ {
Dictionary<string, string> param = new Dictionary<string, string>(); Dictionary<string, string> param = new Dictionary<string, string>();
@ -520,12 +523,12 @@ namespace OpenSim.Data.MySQL
/// <remarks>is it still used ?</remarks> /// <remarks>is it still used ?</remarks>
public override void StoreWebLoginKey(UUID AgentID, UUID WebLoginKey) public override void StoreWebLoginKey(UUID AgentID, UUID WebLoginKey)
{ {
MySQLSuperManager dbm = GetLockedConnection("StoreWebLoginKey");
Dictionary<string, string> param = new Dictionary<string, string>(); Dictionary<string, string> param = new Dictionary<string, string>();
param["?UUID"] = AgentID.ToString(); param["?UUID"] = AgentID.ToString();
param["?webLoginKey"] = WebLoginKey.ToString(); param["?webLoginKey"] = WebLoginKey.ToString();
MySQLSuperManager dbm = GetLockedConnection("StoreWebLoginKey");
try try
{ {
dbm.Manager.ExecuteParameterizedSql( dbm.Manager.ExecuteParameterizedSql(
@ -785,11 +788,11 @@ namespace OpenSim.Data.MySQL
public Hashtable GetUserAttachments(UUID agentID) public Hashtable GetUserAttachments(UUID agentID)
{ {
MySQLSuperManager dbm = GetLockedConnection("GetUserAttachments");
Dictionary<string, string> param = new Dictionary<string, string>(); Dictionary<string, string> param = new Dictionary<string, string>();
param["?uuid"] = agentID.ToString(); param["?uuid"] = agentID.ToString();
MySQLSuperManager dbm = GetLockedConnection("GetUserAttachments");
try try
{ {
IDbCommand result = dbm.Manager.Query( IDbCommand result = dbm.Manager.Query(
@ -829,11 +832,11 @@ namespace OpenSim.Data.MySQL
public override void ResetAttachments(UUID userID) public override void ResetAttachments(UUID userID)
{ {
MySQLSuperManager dbm = GetLockedConnection("ResetAttachments");
Dictionary<string, string> param = new Dictionary<string, string>(); Dictionary<string, string> param = new Dictionary<string, string>();
param["?uuid"] = userID.ToString(); param["?uuid"] = userID.ToString();
MySQLSuperManager dbm = GetLockedConnection("ResetAttachments");
try try
{ {
dbm.Manager.ExecuteParameterizedSql( dbm.Manager.ExecuteParameterizedSql(