Type:
Bug
Priority:
Blocker
Resolution:
Fixed
Affects Version/s:
N/A
MDEV-27058 introduced a deadlock between trx_purge_truncate_history() and buf_pool_t::release_freed_page() . The former function is holding buf_pool.flush_list_mutex while waiting for a page X-latch:
mysql_mutex_lock(&buf_pool.flush_list_mutex);
for (buf_page_t *bpage= UT_LIST_GET_LAST(buf_pool.flush_list); bpage; )
{
…
bpage->lock.x_lock();
At the same time, buf_pool_t::release_freed_page() may hold a U-latch on this page while waiting for buf_pool.flush_list_mutex .
Before MDEV-27058 , there was no problem here, because we would first buffer-fix the block, then release buf_pool.flush_list_mutex and only then acquire the block X-latch.
To fix this, we may invoke bpage->lock.x_lock_try() instead. If it fails, we may release and reacquire buf_pool.flush_list_mutex and restart the scan.
Because MDEV-27058 was not part of any release yet, this regression does not affect any release.
{"report":{"fcp":1746.6999998092651,"ttfb":734.0999994277954,"pageVisibility":"visible","entityId":106324,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"8b0336e3-3020-4d4d-8cf4-321d73915238","navigationType":0,"readyForUser":1834.5999994277954,"redirectCount":0,"resourceLoadedEnd":3031,"resourceLoadedStart":740,"resourceTiming":[{"duration":469,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":740,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":740,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1209,"responseStart":0,"secureConnectionStart":0},{"duration":469.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":740.3000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":740.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1209.8000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":533.8000001907349,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":740.5,"connectEnd":740.5,"connectStart":740.5,"domainLookupEnd":740.5,"domainLookupStart":740.5,"fetchStart":740.5,"redirectEnd":0,"redirectStart":0,"requestStart":740.5,"responseEnd":1274.3000001907349,"responseStart":1274.3000001907349,"secureConnectionStart":740.5},{"duration":606.3000001907349,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":740.5999994277954,"connectEnd":740.5999994277954,"connectStart":740.5999994277954,"domainLookupEnd":740.5999994277954,"domainLookupStart":740.5999994277954,"fetchStart":740.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":740.5999994277954,"responseEnd":1346.8999996185303,"responseStart":1346.8999996185303,"secureConnectionStart":740.5999994277954},{"duration":610.1000003814697,"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":740.8999996185303,"connectEnd":740.8999996185303,"connectStart":740.8999996185303,"domainLookupEnd":740.8999996185303,"domainLookupStart":740.8999996185303,"fetchStart":740.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":740.8999996185303,"responseEnd":1351,"responseStart":1351,"secureConnectionStart":740.8999996185303},{"duration":610.4000005722046,"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":741.0999994277954,"connectEnd":741.0999994277954,"connectStart":741.0999994277954,"domainLookupEnd":741.0999994277954,"domainLookupStart":741.0999994277954,"fetchStart":741.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":741.0999994277954,"responseEnd":1351.5,"responseStart":1351.5,"secureConnectionStart":741.0999994277954},{"duration":610.6999998092651,"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":741.1999998092651,"connectEnd":741.1999998092651,"connectStart":741.1999998092651,"domainLookupEnd":741.1999998092651,"domainLookupStart":741.1999998092651,"fetchStart":741.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":741.1999998092651,"responseEnd":1351.8999996185303,"responseStart":1351.8999996185303,"secureConnectionStart":741.1999998092651},{"duration":680.9000005722046,"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":741.3999996185303,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":741.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1422.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":610.8000001907349,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":741.5999994277954,"connectEnd":741.5999994277954,"connectStart":741.5999994277954,"domainLookupEnd":741.5999994277954,"domainLookupStart":741.5999994277954,"fetchStart":741.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":741.5999994277954,"responseEnd":1352.3999996185303,"responseStart":1352.3999996185303,"secureConnectionStart":741.5999994277954},{"duration":681,"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":741.6999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":741.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1422.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":611.0999994277954,"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":741.8000001907349,"connectEnd":741.8000001907349,"connectStart":741.8000001907349,"domainLookupEnd":741.8000001907349,"domainLookupStart":741.8000001907349,"fetchStart":741.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":741.8000001907349,"responseEnd":1352.8999996185303,"responseStart":1352.8999996185303,"secureConnectionStart":741.8000001907349},{"duration":1515.8000001907349,"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":743.0999994277954,"connectEnd":743.0999994277954,"connectStart":743.0999994277954,"domainLookupEnd":743.0999994277954,"domainLookupStart":743.0999994277954,"fetchStart":743.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":743.0999994277954,"responseEnd":2258.8999996185303,"responseStart":2258.8999996185303,"secureConnectionStart":743.0999994277954},{"duration":2287.9000005722046,"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":743.0999994277954,"connectEnd":743.0999994277954,"connectStart":743.0999994277954,"domainLookupEnd":743.0999994277954,"domainLookupStart":743.0999994277954,"fetchStart":743.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":743.0999994277954,"responseEnd":3031,"responseStart":3031,"secureConnectionStart":743.0999994277954},{"duration":854.3000001907349,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1438.5,"connectEnd":1438.5,"connectStart":1438.5,"domainLookupEnd":1438.5,"domainLookupStart":1438.5,"fetchStart":1438.5,"redirectEnd":0,"redirectStart":0,"requestStart":1438.5,"responseEnd":2292.800000190735,"responseStart":2292.699999809265,"secureConnectionStart":1438.5},{"duration":1298.1000003814697,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1739.0999994277954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1739.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":3037.199999809265,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":567,"responseStart":734,"responseEnd":737,"domLoading":738,"domInteractive":3059,"domContentLoadedEventStart":3059,"domContentLoadedEventEnd":3109,"domComplete":3453,"loadEventStart":3453,"loadEventEnd":3454,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":3038.199999809265},{"name":"bigPipe.sidebar-id.end","time":3039.0999994277954},{"name":"bigPipe.activity-panel-pipe-id.start","time":3039.300000190735},{"name":"bigPipe.activity-panel-pipe-id.end","time":3040.5},{"name":"activityTabFullyLoaded","time":3123.5}],"measures":[],"correlationId":"a86abb8b4cfe81","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":110,"dbReadsTimeInMs":19,"dbConnsTimeInMs":29,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
The hang was repeatable by running
./mtr --parallel=auto --repeat=10 innodb.undo_truncate_recover,4k{,,,,,,,,,,,,,,}
on NVMe storage (not RAM disk). The fix was validated with --repeat=30.