We have a MariaDB server that sometimes seems to get an indefinite table lock. The only way to solve it is to kill MariaDB and restart it. It "randomly happens", so I suspect it may be a race condition. The replication thread get's stuck in state "After opening tables". The lock seems to be caused by a query on an unrelated database with 3 million MyISAM tables (not receiving data via replication) in state "Opening tables". These databases are completely separated, so they shouldn't cause a lock between each other.
Processlist shows:
root@server ~ # mysql -e "show full processlist"
|
+----------+----------------------+-----------------------+----------------------+---------+---------+----------------------------------+-------------------------------------------------------+----------+
|
| Id | User | Host | db | Command | Time | State | Info | Progress |
|
+----------+----------------------+-----------------------+----------------------+---------+---------+----------------------------------+-------------------------------------------------------+----------+
|
| 2 | system user | | NULL | Connect | 1116538 | Waiting for master to send event | NULL | 0.000 |
|
| 3 | system user | | replication_database | Connect | 264121 | After opening tables | COMMIT | 0.000 |
|
| 37332419 | user1 | localhost | large_database | Killed | 264121 | Opening tables | DELETE FROM `my_domain` WHERE date<'2016-04-29' | 0.000 |
|
| 48692447 | root | localhost | NULL | Query | 0 | init | show full processlist | 0.000 |
|
+----------+----------------------+-----------------------+----------------------+---------+---------+----------------------------------+-------------------------------------------------------+----------+
|
root@server ~ #
|
{"report":{"fcp":954,"ttfb":309,"pageVisibility":"visible","entityId":56802,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"db08f4ff-fb42-419e-8d8f-a78fd2e6b107","navigationType":0,"readyForUser":1038.5,"redirectCount":0,"resourceLoadedEnd":704.5,"resourceLoadedStart":313.69999998807907,"resourceTiming":[{"duration":42.80000001192093,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":313.69999998807907,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":313.69999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":356.5,"responseStart":0,"secureConnectionStart":0},{"duration":42.90000003576279,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":314,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":314,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":356.9000000357628,"responseStart":0,"secureConnectionStart":0},{"duration":245.4000000357628,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":314.19999998807907,"connectEnd":314.19999998807907,"connectStart":314.19999998807907,"domainLookupEnd":314.19999998807907,"domainLookupStart":314.19999998807907,"fetchStart":314.19999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":358.5,"responseEnd":559.6000000238419,"responseStart":386.9000000357628,"secureConnectionStart":314.19999998807907},{"duration":367.2999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":314.4000000357628,"connectEnd":314.4000000357628,"connectStart":314.4000000357628,"domainLookupEnd":314.4000000357628,"domainLookupStart":314.4000000357628,"fetchStart":314.4000000357628,"redirectEnd":0,"redirectStart":0,"requestStart":359,"responseEnd":681.6999999880791,"responseStart":405.60000002384186,"secureConnectionStart":314.4000000357628},{"duration":75.10000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":318.80000001192093,"connectEnd":318.80000001192093,"connectStart":318.80000001192093,"domainLookupEnd":318.80000001192093,"domainLookupStart":318.80000001192093,"fetchStart":318.80000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":360.10000002384186,"responseEnd":393.9000000357628,"responseStart":391.80000001192093,"secureConnectionStart":318.80000001192093},{"duration":77.40000003576279,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":319,"connectEnd":319,"connectStart":319,"domainLookupEnd":319,"domainLookupStart":319,"fetchStart":319,"redirectEnd":0,"redirectStart":0,"requestStart":360.60000002384186,"responseEnd":396.4000000357628,"responseStart":392.80000001192093,"secureConnectionStart":319},{"duration":77.89999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":319.10000002384186,"connectEnd":319.10000002384186,"connectStart":319.10000002384186,"domainLookupEnd":319.10000002384186,"domainLookupStart":319.10000002384186,"fetchStart":319.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":362.69999998807907,"responseEnd":397,"responseStart":394.10000002384186,"secureConnectionStart":319.10000002384186},{"duration":42.299999952316284,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":319.4000000357628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":319.4000000357628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":361.69999998807907,"responseStart":0,"secureConnectionStart":0},{"duration":77.80000001192093,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":319.5,"connectEnd":319.5,"connectStart":319.5,"domainLookupEnd":319.5,"domainLookupStart":319.5,"fetchStart":319.5,"redirectEnd":0,"redirectStart":0,"requestStart":366.60000002384186,"responseEnd":397.30000001192093,"responseStart":394.5,"secureConnectionStart":319.5},{"duration":42.60000002384186,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":319.69999998807907,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":319.69999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":362.30000001192093,"responseStart":0,"secureConnectionStart":0},{"duration":80.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":319.80000001192093,"connectEnd":319.80000001192093,"connectStart":319.80000001192093,"domainLookupEnd":319.80000001192093,"domainLookupStart":319.80000001192093,"fetchStart":319.80000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":367.19999998807907,"responseEnd":400.4000000357628,"responseStart":395.19999998807907,"secureConnectionStart":319.80000001192093},{"duration":381.80000001192093,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":322.69999998807907,"connectEnd":322.69999998807907,"connectStart":322.69999998807907,"domainLookupEnd":322.69999998807907,"domainLookupStart":322.69999998807907,"fetchStart":322.69999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":438.69999998807907,"responseEnd":704.5,"responseStart":699.5,"secureConnectionStart":322.69999998807907},{"duration":379.5999999642372,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":323.4000000357628,"connectEnd":323.4000000357628,"connectStart":323.4000000357628,"domainLookupEnd":323.4000000357628,"domainLookupStart":323.4000000357628,"fetchStart":323.4000000357628,"redirectEnd":0,"redirectStart":0,"requestStart":503.19999998807907,"responseEnd":703,"responseStart":696.3000000119209,"secureConnectionStart":323.4000000357628},{"duration":151.60000002384186,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":706.6999999880791,"connectEnd":706.6999999880791,"connectStart":706.6999999880791,"domainLookupEnd":706.6999999880791,"domainLookupStart":706.6999999880791,"fetchStart":706.6999999880791,"redirectEnd":0,"redirectStart":0,"requestStart":827.1999999880791,"responseEnd":858.3000000119209,"responseStart":857.8000000119209,"secureConnectionStart":706.6999999880791}],"fetchStart":0,"domainLookupStart":49,"domainLookupEnd":104,"connectStart":104,"connectEnd":125,"secureConnectionStart":113,"requestStart":126,"responseStart":309,"responseEnd":323,"domLoading":312,"domInteractive":1139,"domContentLoadedEventStart":1139,"domContentLoadedEventEnd":1186,"domComplete":1836,"loadEventStart":1836,"loadEventEnd":1836,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1112.199999988079},{"name":"bigPipe.sidebar-id.end","time":1113.1000000238419},{"name":"bigPipe.activity-panel-pipe-id.start","time":1113.199999988079},{"name":"bigPipe.activity-panel-pipe-id.end","time":1115.300000011921},{"name":"activityTabFullyLoaded","time":1204.9000000357628}],"measures":[],"correlationId":"b588da97bcbb09","effectiveType":"4g","downlink":9.3,"rtt":0,"serverDuration":107,"dbReadsTimeInMs":14,"dbConnsTimeInMs":22,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
New backtrace attached. Unfortunately mysqld started "hanging" shortly afterwards and became unresponsive to "kill -6". In the end I had to force kill it with "kill -9" which didn't produce a core dump. I did get a core dump from another slave that had the exact same issue (same position), however not running with the special binary. Let me know if that should be uploaded, hopefully the new backtrace provides sufficient information.