From 129610e797548f7b384f772408d2069ae58e00ce Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Fri, 31 Oct 2008 04:58:14 +0000 Subject: * Added some debug information to MySQL UserDataManager to help diagnose a potential issue when in high load. Related to mantis #2508. --- OpenSim/Data/MySQL/MySQLSuperManager.cs | 1 + OpenSim/Data/MySQL/MySQLUserData.cs | 42 +++++++++++++++++++-------------- 2 files changed, 25 insertions(+), 18 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/MySQL/MySQLSuperManager.cs b/OpenSim/Data/MySQL/MySQLSuperManager.cs index b2485b1..f4341d4 100644 --- a/OpenSim/Data/MySQL/MySQLSuperManager.cs +++ b/OpenSim/Data/MySQL/MySQLSuperManager.cs @@ -7,6 +7,7 @@ namespace OpenSim.Data.MySQL public bool Locked; private readonly Mutex m_lock = new Mutex(false); public MySQLManager Manager; + public string Running; public void GetLock() { diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs index ecd534a..2937ea8 100644 --- a/OpenSim/Data/MySQL/MySQLUserData.cs +++ b/OpenSim/Data/MySQL/MySQLUserData.cs @@ -71,7 +71,7 @@ namespace OpenSim.Data.MySQL throw new PluginNotInitialisedException(Name); } - public MySQLSuperManager GetLockedConnection() + public MySQLSuperManager GetLockedConnection(string why) { int lockedCons = 0; while (true) @@ -86,6 +86,7 @@ namespace OpenSim.Data.MySQL if (!x.Locked) { x.GetLock(); + x.Running = why; return x; } @@ -96,6 +97,11 @@ namespace OpenSim.Data.MySQL System.Threading.Thread.Sleep(1000); // Wait some time before searching them again. m_log.Debug( "WARNING: All threads are in use. Probable cause: Something didnt release a mutex properly, or high volume of requests inbound."); + m_log.Debug("Current connections-in-use dump:"); + foreach (KeyValuePair kvp in m_dbconnections) + { + m_log.Debug(kvp.Value.Running); + } } } } @@ -167,7 +173,7 @@ namespace OpenSim.Data.MySQL // see IUserDataPlugin public override UserProfileData GetUserByName(string user, string last) { - MySQLSuperManager dbm = GetLockedConnection(); + MySQLSuperManager dbm = GetLockedConnection("GetUserByName"); try { @@ -202,7 +208,7 @@ namespace OpenSim.Data.MySQL public override void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) { - MySQLSuperManager dbm = GetLockedConnection(); + MySQLSuperManager dbm = GetLockedConnection("AddNewUserFriend"); int dtvalue = Util.UnixTimeSinceEpoch(); @@ -246,7 +252,7 @@ namespace OpenSim.Data.MySQL public override void RemoveUserFriend(UUID friendlistowner, UUID friend) { - MySQLSuperManager dbm = GetLockedConnection(); + MySQLSuperManager dbm = GetLockedConnection("RemoveUserFriend"); Dictionary param = new Dictionary(); param["?ownerID"] = friendlistowner.ToString(); @@ -280,7 +286,7 @@ namespace OpenSim.Data.MySQL public override void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) { - MySQLSuperManager dbm = GetLockedConnection(); + MySQLSuperManager dbm = GetLockedConnection("UpdateUserFriendPerms"); Dictionary param = new Dictionary(); param["?ownerID"] = friendlistowner.ToString(); @@ -311,7 +317,7 @@ namespace OpenSim.Data.MySQL public override List GetUserFriendList(UUID friendlistowner) { - MySQLSuperManager dbm = GetLockedConnection(); + MySQLSuperManager dbm = GetLockedConnection("GetUserFriendList"); List Lfli = new List(); Dictionary param = new Dictionary(); @@ -367,7 +373,7 @@ namespace OpenSim.Data.MySQL public override List GeneratePickerResults(UUID queryID, string query) { - MySQLSuperManager dbm = GetLockedConnection(); + MySQLSuperManager dbm = GetLockedConnection("GeneratePickerResults"); List returnlist = new List(); @@ -457,7 +463,7 @@ namespace OpenSim.Data.MySQL /// User profile data public override UserProfileData GetUserByUUID(UUID uuid) { - MySQLSuperManager dbm = GetLockedConnection(); + MySQLSuperManager dbm = GetLockedConnection("GetUserByUUID"); try { Dictionary param = new Dictionary(); @@ -514,7 +520,7 @@ namespace OpenSim.Data.MySQL /// is it still used ? public override void StoreWebLoginKey(UUID AgentID, UUID WebLoginKey) { - MySQLSuperManager dbm = GetLockedConnection(); + MySQLSuperManager dbm = GetLockedConnection("StoreWebLoginKey"); Dictionary param = new Dictionary(); param["?UUID"] = AgentID.ToString(); @@ -546,7 +552,7 @@ namespace OpenSim.Data.MySQL /// The users session public override UserAgentData GetAgentByUUID(UUID uuid) { - MySQLSuperManager dbm = GetLockedConnection(); + MySQLSuperManager dbm = GetLockedConnection("GetAgentByUUID"); try { @@ -587,7 +593,7 @@ namespace OpenSim.Data.MySQL { return; } - MySQLSuperManager dbm = GetLockedConnection(); + MySQLSuperManager dbm = GetLockedConnection("AddNewUserProfile"); try { @@ -621,7 +627,7 @@ namespace OpenSim.Data.MySQL if (agent.ProfileID == zero || agent.SessionID == zero) return; - MySQLSuperManager dbm = GetLockedConnection(); + MySQLSuperManager dbm = GetLockedConnection("AddNewUserAgent"); try { dbm.Manager.insertAgentRow(agent); @@ -643,7 +649,7 @@ namespace OpenSim.Data.MySQL /// The profile data to use to update the DB public override bool UpdateUserProfile(UserProfileData user) { - MySQLSuperManager dbm = GetLockedConnection(); + MySQLSuperManager dbm = GetLockedConnection("UpdateUserProfile"); try { dbm.Manager.updateUserRow(user.ID, user.FirstName, user.SurName, user.PasswordHash, user.PasswordSalt, @@ -695,7 +701,7 @@ namespace OpenSim.Data.MySQL /// public override AvatarAppearance GetUserAppearance(UUID user) { - MySQLSuperManager dbm = GetLockedConnection(); + MySQLSuperManager dbm = GetLockedConnection("GetUserAppearance"); try { Dictionary param = new Dictionary(); @@ -740,7 +746,7 @@ namespace OpenSim.Data.MySQL // override public override void UpdateUserAppearance(UUID user, AvatarAppearance appearance) { - MySQLSuperManager dbm = GetLockedConnection(); + MySQLSuperManager dbm = GetLockedConnection("UpdateUserAppearance"); try { appearance.Owner = user; @@ -779,7 +785,7 @@ namespace OpenSim.Data.MySQL public Hashtable GetUserAttachments(UUID agentID) { - MySQLSuperManager dbm = GetLockedConnection(); + MySQLSuperManager dbm = GetLockedConnection("GetUserAttachments"); Dictionary param = new Dictionary(); param["?uuid"] = agentID.ToString(); @@ -810,7 +816,7 @@ namespace OpenSim.Data.MySQL public void UpdateUserAttachments(UUID agentID, Hashtable data) { - MySQLSuperManager dbm = GetLockedConnection(); + MySQLSuperManager dbm = GetLockedConnection("UpdateUserAttachments"); try { dbm.Manager.writeAttachments(agentID, data); @@ -823,7 +829,7 @@ namespace OpenSim.Data.MySQL public override void ResetAttachments(UUID userID) { - MySQLSuperManager dbm = GetLockedConnection(); + MySQLSuperManager dbm = GetLockedConnection("ResetAttachments"); Dictionary param = new Dictionary(); param["?uuid"] = userID.ToString(); -- cgit v1.1