#5 0x00007ff2f213d3fa in abort () from /lib/x86_64-linux-gnu/libc.so.6
#6 0x00007ff2eabb442b in mem_heap_check (heap=0x7ff2de368800) at /data/src/10.0/storage/innobase/mem/mem0dbg.cc:680
#7 0x00007ff2eaabbf3d in mem_heap_free_func (heap=0x7ff2de368800, file_name=0x7ff2eace01c0 "/data/src/10.0/storage/innobase/include/dict0mem.h", line=872) at /data/src/10.0/storage/innobase/include/mem0mem.ic:482
#8 0x00007ff2eaace2d4 in dict_foreign_free (foreign=0x7ff2de368878) at /data/src/10.0/storage/innobase/include/dict0mem.h:872
#9 0x00007ff2eaac5ac5 in dict_foreign_remove_from_cache (foreign=0x7ff2de368878) at /data/src/10.0/storage/innobase/dict/dict0dict.cc:3284
#10 0x00007ff2eab67d98 in innobase_update_foreign_cache (ctx=0x7ff2de0f9468, user_thd=0x7ff2e6769070) at /data/src/10.0/storage/innobase/handler/handler0alter.cc:4991
#11 0x00007ff2eab694a3 in ha_innodb::commit_inplace_alter_table (this=0x7ff2de07e888, altered_table=0x7ff2de1bc070, ha_alter_info=0x7ff2f41f7220, commit=true) at /data/src/10.0/storage/innobase/handler/handler0alter.cc:6017
#12 0x000000000084512d in handler::ha_commit_inplace_alter_table (this=0x7ff2de07e888, altered_table=0x7ff2de1bc070, ha_alter_info=0x7ff2f41f7220, commit=true) at /data/src/10.0/sql/handler.cc:4228
#13 0x00000000007029c6 in mysql_inplace_alter_table (thd=0x7ff2e6769070, table_list=0x7ff2de0f81a8, table=0x7ff2de09e470, altered_table=0x7ff2de1bc070, ha_alter_info=0x7ff2f41f7220, inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE, target_mdl_request=0x7ff2f41f6c70, alter_ctx=0x7ff2f41f7800) at /data/src/10.0/sql/sql_table.cc:7176
#14 0x0000000000706ffc in mysql_alter_table (thd=0x7ff2e6769070, new_db=0x7ff2de0f8788 "test", new_name=0x0, create_info=0x7ff2f41f84e0, table_list=0x7ff2de0f81a8, alter_info=0x7ff2f41f8450, order_num=0, order=0x0, ignore=false) at /data/src/10.0/sql/sql_table.cc:8982
#15 0x0000000000770361 in Sql_cmd_alter_table::execute (this=0x7ff2de0f87e0, thd=0x7ff2e6769070) at /data/src/10.0/sql/sql_alter.cc:312
#16 0x0000000000654d27 in mysql_execute_command (thd=0x7ff2e6769070) at /data/src/10.0/sql/sql_parse.cc:5125
#17 0x000000000065837e in mysql_parse (thd=0x7ff2e6769070, rawbuf=0x7ff2de0f8088 "ALTER TABLE t2 DROP FOREIGN KEY fk1, DROP FOREIGN KEY fk1", length=57, parser_state=0x7ff2f41f9640) at /data/src/10.0/sql/sql_parse.cc:6644
#18 0x000000000064ac38 in dispatch_command (command=COM_QUERY, thd=0x7ff2e6769070, packet=0x7ff2ec230071 "ALTER TABLE t2 DROP FOREIGN KEY fk1, DROP FOREIGN KEY fk1", packet_length=57) at /data/src/10.0/sql/sql_parse.cc:1301
#19 0x0000000000649f2c in do_command (thd=0x7ff2e6769070) at /data/src/10.0/sql/sql_parse.cc:1003
#20 0x000000000076bab4 in do_handle_one_connection (thd_arg=0x7ff2e6769070) at /data/src/10.0/sql/sql_connect.cc:1377
#21 0x000000000076b826 in handle_one_connection (arg=0x7ff2e6769070) at /data/src/10.0/sql/sql_connect.cc:1292
#22 0x0000000000acd6ea in pfs_spawn_thread (arg=0x7ff2e6719670) at /data/src/10.0/storage/perfschema/pfs.cc:1861
#23 0x00007ff2f3e38494 in start_thread (arg=0x7ff2f41fa700) at pthread_create.c:333
#24 0x00007ff2f21f193f in clone () from /lib/x86_64-linux-gnu/libc.so.6
Non-debug builds don't show any obvious symptoms, but non-debug ASAN build does:
10.4 a8eb0c76bf RelWithDebInfo ASAN
==14835==ERROR: AddressSanitizer: heap-use-after-free on address 0x616000073038 at pc 0x5645b6ca6932 bp 0x7f34f2f34fb0 sp 0x7f34f2f34fa8
READ of size 8 at 0x616000073038 thread T27
#0 0x5645b6ca6931 in dict_foreign_remove_from_cache(dict_foreign_t*) /data/src/10.4/storage/innobase/dict/dict0dict.cc:3198
#1 0x5645b68656ce in innobase_update_foreign_cache /data/src/10.4/storage/innobase/handler/handler0alter.cc:9389
#2 0x5645b686e2a9 in ha_innobase::commit_inplace_alter_table(TABLE*, Alter_inplace_info*, bool) /data/src/10.4/storage/innobase/handler/handler0alter.cc:10907
#3 0x5645b5867f8a in mysql_inplace_alter_table /data/src/10.4/sql/sql_table.cc:7590
5.5 doesn't crash (maybe it doesn't have the assertion failure), but it also fails:
mysqltest: At line 5: query 'ALTER TABLE t2 DROP FOREIGN KEY fk1, DROP FOREIGN KEY fk1' failed: 1025: Error on rename of './test/t2' to './test/#sql2-35c7-2' (errno: 152)
Attachments
Issue Links
relates to
MDEV-18222InnoDB: Failing assertion: heap->magic_n == MEM_BLOCK_MAGIC_N or ASAN heap-use-after-free in dict_foreign_remove_from_cache upon CHANGE COLUMN
In 10.0+, we can simply filter out duplicate foreign key definitions in ha_innobase::prepare_inplace_alter_table().
In 5.5, the code is completely different, and I would not fix this unless there is a strong demand.
Marko Mäkelä
added a comment - In 10.0+, we can simply filter out duplicate foreign key definitions in ha_innobase::prepare_inplace_alter_table() .
In 5.5, the code is completely different, and I would not fix this unless there is a strong demand.
The variable fk_evict should have been declared as std::set instead of std::list, in order to avoid duplicates.
Marko Mäkelä
added a comment - This double-free was introduced by a merge of the following change from MySQL 5.6.23 into 10.0.17,10.1.4,10.2.0,10.3.0 (InnoDB 5.6.23) and 10.0.18,10.1.5 (XtraDB 5.6.23-72.1) :
Bug #20031243 CREATE TABLE FAILS TO CHECK IF FOREIGN KEY COLUMN NULL/NOT NULL MISMATCH
The variable fk_evict should have been declared as std::set instead of std::list , in order to avoid duplicates.
People
Marko Mäkelä
Elena Stepanova
Votes:
0Vote for this issue
Watchers:
2Start 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":1319.2999999523163,"ttfb":297,"pageVisibility":"visible","entityId":71907,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"becdf91e-b854-41b4-842b-46bd6e750379","navigationType":0,"readyForUser":1420.2999999523163,"redirectCount":0,"resourceLoadedEnd":1652.7000000476837,"resourceLoadedStart":302.10000014305115,"resourceTiming":[{"duration":529.6999998092651,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":302.10000014305115,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":302.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":831.7999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":529.8000001907349,"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":302.2999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":302.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":832.1000001430511,"responseStart":0,"secureConnectionStart":0},{"duration":539,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":302.5,"connectEnd":302.5,"connectStart":302.5,"domainLookupEnd":302.5,"domainLookupStart":302.5,"fetchStart":302.5,"redirectEnd":0,"redirectStart":0,"requestStart":302.5,"responseEnd":841.5,"responseStart":841.4000000953674,"secureConnectionStart":302.5},{"duration":578,"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":302.7000000476837,"connectEnd":302.7000000476837,"connectStart":302.7000000476837,"domainLookupEnd":302.7000000476837,"domainLookupStart":302.7000000476837,"fetchStart":302.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":302.7000000476837,"responseEnd":880.7000000476837,"responseStart":880.7000000476837,"secureConnectionStart":302.7000000476837},{"duration":581.6000001430511,"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":303,"connectEnd":303,"connectStart":303,"domainLookupEnd":303,"domainLookupStart":303,"fetchStart":303,"redirectEnd":0,"redirectStart":0,"requestStart":303,"responseEnd":884.6000001430511,"responseStart":884.6000001430511,"secureConnectionStart":303},{"duration":582,"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":303.10000014305115,"connectEnd":303.10000014305115,"connectStart":303.10000014305115,"domainLookupEnd":303.10000014305115,"domainLookupStart":303.10000014305115,"fetchStart":303.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":303.10000014305115,"responseEnd":885.1000001430511,"responseStart":885.1000001430511,"secureConnectionStart":303.10000014305115},{"duration":582.2000000476837,"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":303.2999999523163,"connectEnd":303.2999999523163,"connectStart":303.2999999523163,"domainLookupEnd":303.2999999523163,"domainLookupStart":303.2999999523163,"fetchStart":303.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":303.2999999523163,"responseEnd":885.5,"responseStart":885.5,"secureConnectionStart":303.2999999523163},{"duration":684.2999999523163,"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":303.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":303.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":987.7000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":582.2999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":303.7000000476837,"connectEnd":303.7000000476837,"connectStart":303.7000000476837,"domainLookupEnd":303.7000000476837,"domainLookupStart":303.7000000476837,"fetchStart":303.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":303.7000000476837,"responseEnd":886,"responseStart":886,"secureConnectionStart":303.7000000476837},{"duration":684.1000001430511,"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":303.7999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":303.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":987.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":582.7000000476837,"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":303.90000009536743,"connectEnd":303.90000009536743,"connectStart":303.90000009536743,"domainLookupEnd":303.90000009536743,"domainLookupStart":303.90000009536743,"fetchStart":303.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":303.90000009536743,"responseEnd":886.6000001430511,"responseStart":886.6000001430511,"secureConnectionStart":303.90000009536743},{"duration":901.7000000476837,"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":309.5,"connectEnd":309.5,"connectStart":309.5,"domainLookupEnd":309.5,"domainLookupStart":309.5,"fetchStart":309.5,"redirectEnd":0,"redirectStart":0,"requestStart":309.5,"responseEnd":1211.2000000476837,"responseStart":1211.2000000476837,"secureConnectionStart":309.5},{"duration":1326.3999998569489,"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":309.60000014305115,"connectEnd":309.60000014305115,"connectStart":309.60000014305115,"domainLookupEnd":309.60000014305115,"domainLookupStart":309.60000014305115,"fetchStart":309.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":309.60000014305115,"responseEnd":1636,"responseStart":1636,"secureConnectionStart":309.60000014305115},{"duration":211.09999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1000.6000001430511,"connectEnd":1000.6000001430511,"connectStart":1000.6000001430511,"domainLookupEnd":1000.6000001430511,"domainLookupStart":1000.6000001430511,"fetchStart":1000.6000001430511,"redirectEnd":0,"redirectStart":0,"requestStart":1000.6000001430511,"responseEnd":1211.7000000476837,"responseStart":1211.7000000476837,"secureConnectionStart":1000.6000001430511},{"duration":379.7999999523163,"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":1272.9000000953674,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1272.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1652.7000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":366,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1273.9000000953674,"connectEnd":1273.9000000953674,"connectStart":1273.9000000953674,"domainLookupEnd":1273.9000000953674,"domainLookupStart":1273.9000000953674,"fetchStart":1273.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":1273.9000000953674,"responseEnd":1639.9000000953674,"responseStart":1639.9000000953674,"secureConnectionStart":1273.9000000953674},{"duration":372.2000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/097ae97cb8fbec7d6ea4bbb1f26955b9-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/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.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":1274.4000000953674,"connectEnd":1274.4000000953674,"connectStart":1274.4000000953674,"domainLookupEnd":1274.4000000953674,"domainLookupStart":1274.4000000953674,"fetchStart":1274.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":1274.4000000953674,"responseEnd":1646.6000001430511,"responseStart":1646.6000001430511,"secureConnectionStart":1274.4000000953674}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":122,"responseStart":297,"responseEnd":304,"domLoading":300,"domInteractive":1676,"domContentLoadedEventStart":1676,"domContentLoadedEventEnd":1721,"domComplete":2395,"loadEventStart":2395,"loadEventEnd":2396,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1638},{"name":"bigPipe.sidebar-id.end","time":1638.9000000953674},{"name":"bigPipe.activity-panel-pipe-id.start","time":1639},{"name":"bigPipe.activity-panel-pipe-id.end","time":1640.2000000476837},{"name":"activityTabFullyLoaded","time":1738.7000000476837}],"measures":[],"correlationId":"777c55ea693b2b","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":102,"dbReadsTimeInMs":13,"dbConnsTimeInMs":22,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
In 10.0+, we can simply filter out duplicate foreign key definitions in ha_innobase::prepare_inplace_alter_table().
In 5.5, the code is completely different, and I would not fix this unless there is a strong demand.