#13 0x561f7a824a9d in do_command(THD*) /data/src/10.4/sql/sql_parse.cc:1359
#14 0x561f7abfd0ef in do_handle_one_connection(CONNECT*) /data/src/10.4/sql/sql_connect.cc:1412
#15 0x561f7abfc991 in handle_one_connection /data/src/10.4/sql/sql_connect.cc:1316
#16 0x561f7c23a47c in pfs_spawn_thread /data/src/10.4/storage/perfschema/pfs.cc:1869
#17 0x7fabc5247fa2 in start_thread /build/glibc-vjB4T1/glibc-2.28/nptl/pthread_create.c:486
SUMMARY: AddressSanitizer: 824 byte(s) leaked in 2 allocation(s).
Reproducible on 10.4, 10.5.
The test case is not applicable to 10.3, ALTER fails with ER_BLOB_KEY_WITHOUT_LENGTH instead. If I add the error to the suppression list, there is no leak detected upon shutdown.
The ADD FOREIGN KEY should imply ADD INDEX(a), which in MDEV-371 (10.4) creates an indexed virtual column.
There should be an equivalent test case for 10.2 that would add a virtual column and index. I think that we must first figure out what triggers the error, and then try to remove the MDEV-371 dependency of the test case, to port the test to 10.2.
Marko Mäkelä
added a comment - The ADD FOREIGN KEY should imply ADD INDEX(a) , which in MDEV-371 (10.4) creates an indexed virtual column.
There should be an equivalent test case for 10.2 that would add a virtual column and index. I think that we must first figure out what triggers the error, and then try to remove the MDEV-371 dependency of the test case, to port the test to 10.2.
Here is a test case which ends with a seemingly identical leak and doesn't involve BLOB indexes. It does involve XA instead, I'm not sure it's any better, but at least it makes the test applicable to all versions, and all of 10.1-10.5 are affected.
--source include/have_innodb.inc
CREATETABLE t1 (pk INT, a INT, PRIMARYKEY (pk)) ENGINE=InnoDB;
XA START 'xid';
INSERTINTO t1 VALUES (1,2);
--error ER_XAER_RMFAIL
CREATETABLE x ASSELECT * FROM t1;
--connect (con1,localhost,root,,test)
SET foreign_key_checks= OFF, innodb_lock_wait_timeout= 1;
--error ER_LOCK_WAIT_TIMEOUT
ALTERTABLE t1 ADDFOREIGNKEY f (a) REFERENCES t1 (pk), LOCK=EXCLUSIVE;
elenst, thank you! The test case is relying on an MDL bug (similar to MDEV-15532 and others), and I think that it will leave the first transaction active inside InnoDB while wrongly letting the DDL operation in the second connection to proceed. I think that it is an adequate regression test. We can worry about replacing it when the MDL bug has been fixed. One possible refinement would be to move the transaction to XA PREPARE state and then kill and restart the server, to have it recover with an InnoDB table IX lock for the table, but no MDL. And even that refinement would eventually stop working when we fix the recovery so that MDL will be resurrected for the recovered transactions.
Marko Mäkelä
added a comment - elenst , thank you! The test case is relying on an MDL bug (similar to MDEV-15532 and others), and I think that it will leave the first transaction active inside InnoDB while wrongly letting the DDL operation in the second connection to proceed. I think that it is an adequate regression test. We can worry about replacing it when the MDL bug has been fixed. One possible refinement would be to move the transaction to XA PREPARE state and then kill and restart the server, to have it recover with an InnoDB table IX lock for the table, but no MDL. And even that refinement would eventually stop working when we fix the recovery so that MDL will be resurrected for the recovered transactions.
It seems to me that the leaked memory must have been allocated in ha_innobase::prepare_inplace_alter_table() before invoking prepare_inplace_alter_table_dict().
As far as I can tell, you are suggesting to add the loop to the function prepare_inplace_alter_table_dict() soon after the error_handled: label. There seems to be at least one code path that would bypass that code by executing goto err_exit. I think that a more appropriate place for the code would be near the end of the function, right before the delete ctx.
I think that this change should be small and low-risk enough to be put to the 10.1 version.
Marko Mäkelä
added a comment - It seems to me that the leaked memory must have been allocated in ha_innobase::prepare_inplace_alter_table() before invoking prepare_inplace_alter_table_dict() .
As far as I can tell, you are suggesting to add the loop to the function prepare_inplace_alter_table_dict() soon after the error_handled: label. There seems to be at least one code path that would bypass that code by executing goto err_exit . I think that a more appropriate place for the code would be near the end of the function, right before the delete ctx .
I think that this change should be small and low-risk enough to be put to the 10.1 version.
People
Thirunarayanan Balathandayuthapani
Elena Stepanova
Votes:
0Vote for this issue
Watchers:
3Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":1354.5999999046326,"ttfb":236.90000009536743,"pageVisibility":"visible","entityId":85659,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"72f362bb-beec-4416-bdc1-b3eda6f6ad94","navigationType":0,"readyForUser":1449.0999999046326,"redirectCount":0,"resourceLoadedEnd":1546.1999998092651,"resourceLoadedStart":248.69999980926514,"resourceTiming":[{"duration":532.4000000953674,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":248.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":248.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":781.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":532.4000000953674,"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":249.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":249.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":781.5,"responseStart":0,"secureConnectionStart":0},{"duration":541,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":249.30000019073486,"connectEnd":249.30000019073486,"connectStart":249.30000019073486,"domainLookupEnd":249.30000019073486,"domainLookupStart":249.30000019073486,"fetchStart":249.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":249.30000019073486,"responseEnd":790.3000001907349,"responseStart":790.3000001907349,"secureConnectionStart":249.30000019073486},{"duration":652.1000003814697,"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":250.19999980926514,"connectEnd":250.19999980926514,"connectStart":250.19999980926514,"domainLookupEnd":250.19999980926514,"domainLookupStart":250.19999980926514,"fetchStart":250.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":250.19999980926514,"responseEnd":902.3000001907349,"responseStart":902.3000001907349,"secureConnectionStart":250.19999980926514},{"duration":663.2999997138977,"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":250.40000009536743,"connectEnd":250.40000009536743,"connectStart":250.40000009536743,"domainLookupEnd":250.40000009536743,"domainLookupStart":250.40000009536743,"fetchStart":250.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":250.40000009536743,"responseEnd":913.6999998092651,"responseStart":913.6999998092651,"secureConnectionStart":250.40000009536743},{"duration":663.6999998092651,"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":250.5,"connectEnd":250.5,"connectStart":250.5,"domainLookupEnd":250.5,"domainLookupStart":250.5,"fetchStart":250.5,"redirectEnd":0,"redirectStart":0,"requestStart":250.5,"responseEnd":914.1999998092651,"responseStart":914.1999998092651,"secureConnectionStart":250.5},{"duration":663.7999997138977,"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":250.80000019073486,"connectEnd":250.80000019073486,"connectStart":250.80000019073486,"domainLookupEnd":250.80000019073486,"domainLookupStart":250.80000019073486,"fetchStart":250.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":250.80000019073486,"responseEnd":914.5999999046326,"responseStart":914.5999999046326,"secureConnectionStart":250.80000019073486},{"duration":697,"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":250.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":250.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":947.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":664.0999999046326,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":251,"connectEnd":251,"connectStart":251,"domainLookupEnd":251,"domainLookupStart":251,"fetchStart":251,"redirectEnd":0,"redirectStart":0,"requestStart":251,"responseEnd":915.0999999046326,"responseStart":915.0999999046326,"secureConnectionStart":251},{"duration":696.6999998092651,"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":251.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":251.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":948,"responseStart":0,"secureConnectionStart":0},{"duration":664.4000000953674,"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":251.40000009536743,"connectEnd":251.40000009536743,"connectStart":251.40000009536743,"domainLookupEnd":251.40000009536743,"domainLookupStart":251.40000009536743,"fetchStart":251.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":251.40000009536743,"responseEnd":915.8000001907349,"responseStart":915.8000001907349,"secureConnectionStart":251.40000009536743},{"duration":1292.2000002861023,"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":253.09999990463257,"connectEnd":253.09999990463257,"connectStart":253.09999990463257,"domainLookupEnd":253.09999990463257,"domainLookupStart":253.09999990463257,"fetchStart":253.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":253.09999990463257,"responseEnd":1545.3000001907349,"responseStart":1545.3000001907349,"secureConnectionStart":253.09999990463257},{"duration":1274.2999997138977,"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":271.90000009536743,"connectEnd":271.90000009536743,"connectStart":271.90000009536743,"domainLookupEnd":271.90000009536743,"domainLookupStart":271.90000009536743,"fetchStart":271.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":271.90000009536743,"responseEnd":1546.1999998092651,"responseStart":1546.1999998092651,"secureConnectionStart":271.90000009536743},{"duration":114.2000002861023,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":960.5999999046326,"connectEnd":960.5999999046326,"connectStart":960.5999999046326,"domainLookupEnd":960.5999999046326,"domainLookupStart":960.5999999046326,"fetchStart":960.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":960.5999999046326,"responseEnd":1074.8000001907349,"responseStart":1074.8000001907349,"secureConnectionStart":960.5999999046326},{"duration":393.40000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1250.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1250.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1643.9000000953674,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":40,"responseStart":236,"responseEnd":273,"domLoading":240,"domInteractive":1589,"domContentLoadedEventStart":1589,"domContentLoadedEventEnd":1643,"domComplete":2421,"loadEventStart":2421,"loadEventEnd":2422,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1551.5},{"name":"bigPipe.sidebar-id.end","time":1552.3000001907349},{"name":"bigPipe.activity-panel-pipe-id.start","time":1552.4000000953674},{"name":"bigPipe.activity-panel-pipe-id.end","time":1557.0999999046326},{"name":"activityTabFullyLoaded","time":1657.5999999046326}],"measures":[],"correlationId":"4f08a0952128c2","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":124,"dbReadsTimeInMs":13,"dbConnsTimeInMs":22,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
The ADD FOREIGN KEY should imply ADD INDEX(a), which in
MDEV-371(10.4) creates an indexed virtual column.There should be an equivalent test case for 10.2 that would add a virtual column and index. I think that we must first figure out what triggers the error, and then try to remove the
MDEV-371dependency of the test case, to port the test to 10.2.