{"action":"closed","issue":{"url":"https://api.github.com/repos/TrinityCore/TrinityCore/issues/16605","repository_url":"https://api.github.com/repos/TrinityCore/TrinityCore","labels_url":"https://api.github.com/repos/TrinityCore/TrinityCore/issues/16605/labels{/name}","comments_url":"https://api.github.com/repos/TrinityCore/TrinityCore/issues/16605/comments","events_url":"https://api.github.com/repos/TrinityCore/TrinityCore/issues/16605/events","html_url":"https://github.com/TrinityCore/TrinityCore/issues/16605","id":133502202,"number":16605,"title":"[3.3.5] Core: InstanceSaveManager::_ResetOrWarnAll cause worldserver frozen","user":{"login":"shenhuyong","id":4745890,"avatar_url":"https://avatars.githubusercontent.com/u/4745890?v=3","gravatar_id":"","url":"https://api.github.com/users/shenhuyong","html_url":"https://github.com/shenhuyong","followers_url":"https://api.github.com/users/shenhuyong/followers","following_url":"https://api.github.com/users/shenhuyong/following{/other_user}","gists_url":"https://api.github.com/users/shenhuyong/gists{/gist_id}","starred_url":"https://api.github.com/users/shenhuyong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shenhuyong/subscriptions","organizations_url":"https://api.github.com/users/shenhuyong/orgs","repos_url":"https://api.github.com/users/shenhuyong/repos","events_url":"https://api.github.com/users/shenhuyong/events{/privacy}","received_events_url":"https://api.github.com/users/shenhuyong/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/TrinityCore/TrinityCore/labels/Comp-Core","name":"Comp-Core","color":"FF6600"},{"url":"https://api.github.com/repos/TrinityCore/TrinityCore/labels/HasBacktrace","name":"HasBacktrace","color":"02e10c"}],"state":"closed","locked":false,"assignee":{"login":"Treeston","id":14020072,"avatar_url":"https://avatars.githubusercontent.com/u/14020072?v=3","gravatar_id":"","url":"https://api.github.com/users/Treeston","html_url":"https://github.com/Treeston","followers_url":"https://api.github.com/users/Treeston/followers","following_url":"https://api.github.com/users/Treeston/following{/other_user}","gists_url":"https://api.github.com/users/Treeston/gists{/gist_id}","starred_url":"https://api.github.com/users/Treeston/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Treeston/subscriptions","organizations_url":"https://api.github.com/users/Treeston/orgs","repos_url":"https://api.github.com/users/Treeston/repos","events_url":"https://api.github.com/users/Treeston/events{/privacy}","received_events_url":"https://api.github.com/users/Treeston/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2016-02-14T03:39:16Z","updated_at":"2016-02-14T14:41:02Z","closed_at":"2016-02-14T14:41:02Z","body":"After rev. 62aff401f687b56d720a320778950e82b65fbd8b\r\nIt implement handling of CMSG_SET_SAVED_INSTANCE_EXTEND.\r\nI kill a boss in Icecrown Citadel, and I used \".debug raidreset 631\" command, I found a deadlock in the mysql transaction  from InstanceSaveManager::_ResetOrWarnAll.\r\nIt will cause worldserver frozen sometimes.\r\n\r\nThis is the SQL debug log:\r\n\r\n`[1 ms] SQL: START TRANSACTION`\r\n`[1 ms] SQL(p): SELECT guid FROM character_instance WHERE instance = 2 and permanent = 1`\r\n`[1 ms] SQL(p): UPDATE instance_reset SET resettime = 1455501600 WHERE mapid = 631 AND difficulty = 0`\r\n`[1 ms] SQL: START TRANSACTION`\r\n`[2 ms] SQL(p): UPDATE instance_reset SET resettime = 1455501600 WHERE mapid = 631 AND difficulty = 1`\r\n`[27 ms] SQL(p): DELETE FROM character_instance USING character_instance LEFT JOIN instance ON character_instance.instance = id WHERE (extendState = 0 or permanent = 0) and map = 631 and difficulty = 0`\r\n`[21 ms] SQL(p): DELETE FROM character_instance USING character_instance LEFT JOIN instance ON character_instance.instance = id WHERE (extendState = 0 or permanent = 0) and map = 631 and difficulty = 1`\r\n`[27 ms] SQL(p): SELECT guid FROM character_instance WHERE instance = 2 and permanent = 1`\r\n`[0 ms] SQL(p): DELETE FROM group_instance USING group_instance LEFT JOIN instance ON group_instance.instance = id WHERE map = 631 and difficulty = 0`\r\n`[0 ms] SQL(p): DELETE FROM group_instance USING group_instance LEFT JOIN instance ON group_instance.instance = id WHERE map = 631 and difficulty = 1`\r\n`[1 ms] SQL: START TRANSACTION`\r\n`SQL(p): DELETE FROM instance WHERE map = 631 and difficulty = 1 and (SELECT guid FROM character_instance WHERE extendState != 0 AND instance = id LIMIT 1) IS NULL`\r\n` [ERROR]: [1213] Deadlock found when trying to get lock; try restarting transaction`\r\n`[1 ms] SQL(p): UPDATE instance_reset SET resettime = 1455501600 WHERE mapid = 631 AND difficulty = 2`\r\n`[1 ms] SQL(p): SELECT guid FROM character_instance WHERE instance = 2 and permanent = 1`\r\n`[12 ms] SQL(p): DELETE FROM instance WHERE map = 631 and difficulty = 0 and (SELECT guid FROM character_instance WHERE extendState != 0 AND instance = id LIMIT 1) IS NULL`\r\n`Transaction aborted. 4 queries not executed.`\r\n`[1 ms] SQL: START TRANSACTION`\r\n`[1 ms] SQL: ROLLBACK`\r\n`[1 ms] SQL: START TRANSACTION`"}}