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":859.8999996185303,"ttfb":231.80000019073486,"pageVisibility":"visible","entityId":56802,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"b7389fb7-58e3-4068-af89-28d787338e94","navigationType":0,"readyForUser":946.1000003814697,"redirectCount":0,"resourceLoadedEnd":569.6999998092651,"resourceLoadedStart":245.19999980926514,"resourceTiming":[{"duration":38.30000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":245.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":245.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":283.5,"responseStart":0,"secureConnectionStart":0},{"duration":39.19999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/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":245.60000038146973,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":245.60000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":284.80000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":215.89999961853027,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":245.80000019073486,"connectEnd":245.80000019073486,"connectStart":245.80000019073486,"domainLookupEnd":245.80000019073486,"domainLookupStart":245.80000019073486,"fetchStart":245.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":289.8999996185303,"responseEnd":461.69999980926514,"responseStart":316.6000003814697,"secureConnectionStart":245.80000019073486},{"duration":323.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/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":246.5,"connectEnd":246.5,"connectStart":246.5,"domainLookupEnd":246.5,"domainLookupStart":246.5,"fetchStart":246.5,"redirectEnd":0,"redirectStart":0,"requestStart":289.5,"responseEnd":569.6999998092651,"responseStart":314.8999996185303,"secureConnectionStart":246.5},{"duration":82.59999942779541,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":246.80000019073486,"connectEnd":246.80000019073486,"connectStart":246.80000019073486,"domainLookupEnd":246.80000019073486,"domainLookupStart":246.80000019073486,"fetchStart":246.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":290.3999996185303,"responseEnd":329.3999996185303,"responseStart":328,"secureConnectionStart":246.80000019073486},{"duration":84.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":247,"connectEnd":247,"connectStart":247,"domainLookupEnd":247,"domainLookupStart":247,"fetchStart":247,"redirectEnd":0,"redirectStart":0,"requestStart":291.6000003814697,"responseEnd":331.19999980926514,"responseStart":329.69999980926514,"secureConnectionStart":247},{"duration":85.89999961853027,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":247.10000038146973,"connectEnd":247.10000038146973,"connectStart":247.10000038146973,"domainLookupEnd":247.10000038146973,"domainLookupStart":247.10000038146973,"fetchStart":247.10000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":292.1000003814697,"responseEnd":333,"responseStart":331.30000019073486,"secureConnectionStart":247.10000038146973},{"duration":42.39999961853027,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":247.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":247.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":289.69999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":87.90000057220459,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":247.39999961853027,"connectEnd":247.39999961853027,"connectStart":247.39999961853027,"domainLookupEnd":247.39999961853027,"domainLookupStart":247.39999961853027,"fetchStart":247.39999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":295.80000019073486,"responseEnd":335.30000019073486,"responseStart":333.19999980926514,"secureConnectionStart":247.39999961853027},{"duration":44,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/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":247.60000038146973,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":247.60000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":291.6000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":88,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/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":247.69999980926514,"connectEnd":247.69999980926514,"connectStart":247.69999980926514,"domainLookupEnd":247.69999980926514,"domainLookupStart":247.69999980926514,"fetchStart":247.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":296.1000003814697,"responseEnd":335.69999980926514,"responseStart":333.80000019073486,"secureConnectionStart":247.69999980926514},{"duration":314.0999994277954,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":250.30000019073486,"connectEnd":250.30000019073486,"connectStart":250.30000019073486,"domainLookupEnd":250.30000019073486,"domainLookupStart":250.30000019073486,"fetchStart":250.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":323.69999980926514,"responseEnd":564.3999996185303,"responseStart":557.5,"secureConnectionStart":250.30000019073486},{"duration":304.3999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":261.30000019073486,"connectEnd":261.30000019073486,"connectStart":261.30000019073486,"domainLookupEnd":261.30000019073486,"domainLookupStart":261.30000019073486,"fetchStart":261.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":336,"responseEnd":565.6999998092651,"responseStart":560.1000003814697,"secureConnectionStart":261.30000019073486},{"duration":127.10000038146973,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":611.1999998092651,"connectEnd":611.1999998092651,"connectStart":611.1999998092651,"domainLookupEnd":611.1999998092651,"domainLookupStart":611.1999998092651,"fetchStart":611.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":704.6999998092651,"responseEnd":738.3000001907349,"responseStart":737.6999998092651,"secureConnectionStart":611.1999998092651}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":58,"responseStart":232,"responseEnd":261,"domLoading":236,"domInteractive":1053,"domContentLoadedEventStart":1053,"domContentLoadedEventEnd":1116,"domComplete":1685,"loadEventStart":1685,"loadEventEnd":1686,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1025.1000003814697},{"name":"bigPipe.sidebar-id.end","time":1025.8999996185303},{"name":"bigPipe.activity-panel-pipe-id.start","time":1026},{"name":"bigPipe.activity-panel-pipe-id.end","time":1028.1999998092651},{"name":"activityTabFullyLoaded","time":1132.3000001907349}],"measures":[],"correlationId":"8c6c2da2798cf7","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":105,"dbReadsTimeInMs":12,"dbConnsTimeInMs":20,"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.