Note: The test case is non-deterministic. Run with --repeat=N, allow big enough N before giving up, as the probability is unclear. Also, try to adjust SELECT SLEEP in the test case one or another way. It currently fails for me within ~5-10 attempts with the SLEEP and within ~20-30 attempts without SLEEP, but I suppose it can vary a lot on different machines and builds.
--source include/have_innodb.inc
|
|
SET @stats= @@innodb_stats_persistent;
|
SET GLOBAL innodb_stats_persistent= ON;
|
|
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
|
--connect (con1,localhost,root,,test)
|
CREATE TABLE t2 (b INT) ENGINE=InnoDB;
|
HANDLER t2 OPEN;
|
--send
|
TRUNCATE TABLE t1;
|
|
--connection default
|
SELECT SLEEP(0.00001);
|
SET lock_wait_timeout= 1;
|
--error ER_LOCK_WAIT_TIMEOUT
|
ALTER TABLE t2 ADD COLUMN c INT;
|
|
# Cleanup
|
--connection con1
|
--reap
|
--disconnect con1
|
--connection default
|
DROP TABLE t1, t2;
|
SET GLOBAL innodb_stats_persistent= @stats;
|
10.4 37570e84
|
#3 <signal handler called>
|
#4 0x000055c27d6e566a in ha_innobase::store_lock (this=0x7f77d0028328, thd=0x7f77cc000b00, to=0x7f77cc014728, lock_type=TL_IGNORE) at /data/src/10.4/storage/innobase/handler/ha_innodb.cc:16258
|
#5 0x000055c27d5ca73b in get_lock_data (thd=0x7f77cc000b00, table_ptr=0x7f7828161a30, count=1, flags=2) at /data/src/10.4/sql/lock.cc:789
|
#6 0x000055c27d5c9ea5 in mysql_lock_abort_for_thread (thd=0x7f77cc000b00, table=0x7f77d00274c0) at /data/src/10.4/sql/lock.cc:613
|
#7 0x000055c27d0b4041 in THD::notify_shared_lock (this=0x7f77cc000b00, ctx_in_use=0x7f77d0000bd0, needs_thr_lock_abort=true) at /data/src/10.4/sql/sql_class.cc:2053
|
#8 0x000055c27d2bc019 in MDL_lock::notify_conflicting_locks (this=0x7f77cc1487f0, ctx=0x7f77cc000c20) at /data/src/10.4/sql/mdl.cc:574
|
#9 0x000055c27d2b91fe in MDL_context::acquire_lock (this=0x7f77cc000c20, mdl_request=0x7f7828161c90, lock_wait_timeout=1) at /data/src/10.4/sql/mdl.cc:2292
|
#10 0x000055c27d2b9cec in MDL_context::upgrade_shared_lock (this=0x7f77cc000c20, mdl_ticket=0x7f77cc011930, new_type=MDL_EXCLUSIVE, lock_wait_timeout=1) at /data/src/10.4/sql/mdl.cc:2523
|
#11 0x000055c27d2150b2 in mysql_inplace_alter_table (thd=0x7f77cc000b00, table_list=0x7f77cc013210, table=0x7f77cc150550, altered_table=0x7f7828162820, ha_alter_info=0x7f7828162790, inplace_supported=HA_ALTER_INPLACE_INSTANT, target_mdl_request=0x7f78281635f0, alter_ctx=0x7f7828164120) at /data/src/10.4/sql/sql_table.cc:7625
|
#12 0x000055c27d21c24a in mysql_alter_table (thd=0x7f77cc000b00, new_db=0x7f77cc0052b8, new_name=0x7f77cc0056c0, create_info=0x7f7828164d10, table_list=0x7f77cc013210, alter_info=0x7f7828164c50, order_num=0, order=0x0, ignore=false) at /data/src/10.4/sql/sql_table.cc:10086
|
#13 0x000055c27d2b38ab in Sql_cmd_alter_table::execute (this=0x7f77cc0139e8, thd=0x7f77cc000b00) at /data/src/10.4/sql/sql_alter.cc:508
|
#14 0x000055c27d133b13 in mysql_execute_command (thd=0x7f77cc000b00) at /data/src/10.4/sql/sql_parse.cc:6094
|
#15 0x000055c27d1391e7 in mysql_parse (thd=0x7f77cc000b00, rawbuf=0x7f77cc013128 "ALTER TABLE t2 ADD COLUMN c INT", length=31, parser_state=0x7f7828166170, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7912
|
#16 0x000055c27d12447a in dispatch_command (command=COM_QUERY, thd=0x7f77cc000b00, packet=0x7f77cc19dbb1 "ALTER TABLE t2 ADD COLUMN c INT", packet_length=31, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1841
|
#17 0x000055c27d122b07 in do_command (thd=0x7f77cc000b00) at /data/src/10.4/sql/sql_parse.cc:1359
|
#18 0x000055c27d2aa1bb in do_handle_one_connection (connect=0x55c2810e6820) at /data/src/10.4/sql/sql_connect.cc:1412
|
#19 0x000055c27d2a9f0a in handle_one_connection (arg=0x55c2810e6820) at /data/src/10.4/sql/sql_connect.cc:1316
|
#20 0x000055c27dca9209 in pfs_spawn_thread (arg=0x55c281065180) at /data/src/10.4/storage/perfschema/pfs.cc:1862
|
#21 0x00007f782fd0a4a4 in start_thread (arg=0x7f7828167700) at pthread_create.c:456
|
#22 0x00007f782e251d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
|
Reproducible on 10.2-10.5, on all of debug, non-debug and ASAN builds.
Couldn't reproduce on 10.1.
Couldn't reproduce without persistent statistics.
ASAN builds also fail with SEGV on the test case above, but earlier heap-use-after-free was also observed during concurrent tests:
10.4 78829a5780d
|
==24341==ERROR: AddressSanitizer: heap-use-after-free on address 0x621000287a38 at pc 0x55e1dd15574d bp 0x7f67792cce70 sp 0x7f67792cce60
|
READ of size 8 at 0x621000287a38 thread T40
|
#0 0x55e1dd15574c in ha_innobase::store_lock(THD*, st_thr_lock_data**, thr_lock_type) /home/travis/src/storage/innobase/handler/ha_innodb.cc:16339
|
#1 0x55e1dcedc804 in get_lock_data(THD*, TABLE**, unsigned int, unsigned int) /home/travis/src/sql/lock.cc:794
|
#2 0x55e1dcedaf2c in mysql_lock_abort_for_thread(THD*, TABLE*) /home/travis/src/sql/lock.cc:618
|
#3 0x55e1dc3e4327 in THD::notify_shared_lock(MDL_context_owner*, bool) /home/travis/src/sql/sql_class.cc:2042
|
#4 0x55e1dc84b65a in MDL_lock::notify_conflicting_locks(MDL_context*) /home/travis/src/sql/mdl.cc:574
|
#5 0x55e1dc845cee in MDL_context::acquire_lock(MDL_request*, double) /home/travis/src/sql/mdl.cc:2292
|
#6 0x55e1dc846f28 in MDL_context::upgrade_shared_lock(MDL_ticket*, enum_mdl_type, double) /home/travis/src/sql/mdl.cc:2523
|
#7 0x55e1dc6eb6b1 in mysql_inplace_alter_table /home/travis/src/sql/sql_table.cc:7454
|
#8 0x55e1dc6f8ad3 in mysql_alter_table(THD*, st_mysql_const_lex_string const*, st_mysql_const_lex_string const*, HA_CREATE_INFO*, TABLE_LIST*, Alter_info*, unsigned int, st_order*, bool) /home/travis/src/sql/sql_table.cc:9692
|
#9 0x55e1dc83ae60 in Sql_cmd_alter_table::execute(THD*) /home/travis/src/sql/sql_alter.cc:499
|
#10 0x55e1dc4f02a1 in mysql_execute_command(THD*) /home/travis/src/sql/sql_parse.cc:6345
|
#11 0x55e1dc4faae9 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /home/travis/src/sql/sql_parse.cc:8156
|
#12 0x55e1dc4d376a in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /home/travis/src/sql/sql_parse.cc:1842
|
#13 0x55e1dc4d094b in do_command(THD*) /home/travis/src/sql/sql_parse.cc:1395
|
#14 0x55e1dc82becb in do_handle_one_connection(CONNECT*) /home/travis/src/sql/sql_connect.cc:1398
|
#15 0x55e1dc82b89f in handle_one_connection /home/travis/src/sql/sql_connect.cc:1301
|
#16 0x7f681d5106b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9)
|
#17 0x7f681c7a141c in clone (/lib/x86_64-linux-gnu/libc.so.6+0x10741c)
|
ASAN:SIGSEGV
|
{"report":{"fcp":906.0999999046326,"ttfb":266.40000009536743,"pageVisibility":"visible","entityId":72161,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"2f696dba-f18c-409a-ab84-1c008aa14d71","navigationType":0,"readyForUser":995.7000000476837,"redirectCount":0,"resourceLoadedEnd":1064.5999999046326,"resourceLoadedStart":271.7000000476837,"resourceTiming":[{"duration":83.79999995231628,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":271.7000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":271.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":355.5,"responseStart":0,"secureConnectionStart":0},{"duration":83.69999980926514,"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":271.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":271.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":355.59999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":94.10000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":272.09999990463257,"connectEnd":272.09999990463257,"connectStart":272.09999990463257,"domainLookupEnd":272.09999990463257,"domainLookupStart":272.09999990463257,"fetchStart":272.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":272.09999990463257,"responseEnd":366.2000000476837,"responseStart":366.2000000476837,"secureConnectionStart":272.09999990463257},{"duration":313.2000000476837,"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":272.2000000476837,"connectEnd":272.2000000476837,"connectStart":272.2000000476837,"domainLookupEnd":272.2000000476837,"domainLookupStart":272.2000000476837,"fetchStart":272.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":272.2000000476837,"responseEnd":585.4000000953674,"responseStart":585.4000000953674,"secureConnectionStart":272.2000000476837},{"duration":316.7000000476837,"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":272.2999999523163,"connectEnd":272.2999999523163,"connectStart":272.2999999523163,"domainLookupEnd":272.2999999523163,"domainLookupStart":272.2999999523163,"fetchStart":272.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":272.2999999523163,"responseEnd":589,"responseStart":589,"secureConnectionStart":272.2999999523163},{"duration":317.09999990463257,"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":272.40000009536743,"connectEnd":272.40000009536743,"connectStart":272.40000009536743,"domainLookupEnd":272.40000009536743,"domainLookupStart":272.40000009536743,"fetchStart":272.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":272.40000009536743,"responseEnd":589.5,"responseStart":589.5,"secureConnectionStart":272.40000009536743},{"duration":317.80000019073486,"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":272.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":272.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":590.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":317.2000000476837,"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":272.59999990463257,"connectEnd":272.59999990463257,"connectStart":272.59999990463257,"domainLookupEnd":272.59999990463257,"domainLookupStart":272.59999990463257,"fetchStart":272.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":272.59999990463257,"responseEnd":589.7999999523163,"responseStart":589.7999999523163,"secureConnectionStart":272.59999990463257},{"duration":317.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":272.7000000476837,"connectEnd":272.7000000476837,"connectStart":272.7000000476837,"domainLookupEnd":272.7000000476837,"domainLookupStart":272.7000000476837,"fetchStart":272.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":272.7000000476837,"responseEnd":590.2000000476837,"responseStart":590.2000000476837,"secureConnectionStart":272.7000000476837},{"duration":317.7999999523163,"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":272.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":272.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":590.7000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":317.90000009536743,"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":273,"connectEnd":273,"connectStart":273,"domainLookupEnd":273,"domainLookupStart":273,"fetchStart":273,"redirectEnd":0,"redirectStart":0,"requestStart":273,"responseEnd":590.9000000953674,"responseStart":590.7999999523163,"secureConnectionStart":273},{"duration":476.2999999523163,"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":290.90000009536743,"connectEnd":290.90000009536743,"connectStart":290.90000009536743,"domainLookupEnd":290.90000009536743,"domainLookupStart":290.90000009536743,"fetchStart":290.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":290.90000009536743,"responseEnd":767.2000000476837,"responseStart":767.2000000476837,"secureConnectionStart":290.90000009536743},{"duration":769,"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":295.59999990463257,"connectEnd":295.59999990463257,"connectStart":295.59999990463257,"domainLookupEnd":295.59999990463257,"domainLookupStart":295.59999990463257,"fetchStart":295.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":295.59999990463257,"responseEnd":1064.5999999046326,"responseStart":1064.5999999046326,"secureConnectionStart":295.59999990463257},{"duration":117.79999995231628,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":513.7999999523163,"connectEnd":513.7999999523163,"connectStart":513.7999999523163,"domainLookupEnd":513.7999999523163,"domainLookupStart":513.7999999523163,"fetchStart":513.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":513.7999999523163,"responseEnd":631.5999999046326,"responseStart":631.5999999046326,"secureConnectionStart":513.7999999523163},{"duration":316.10000014305115,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2bu7/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","startTime":634.7999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":634.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":950.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":478.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/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","startTime":635.7000000476837,"connectEnd":635.7000000476837,"connectStart":635.7000000476837,"domainLookupEnd":635.7000000476837,"domainLookupStart":635.7000000476837,"fetchStart":635.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":635.7000000476837,"responseEnd":1114.2000000476837,"responseStart":1114.2000000476837,"secureConnectionStart":635.7000000476837},{"duration":482.60000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/s/f51ef5507eea4c158f257c66c93b2a3f-CDN/lu2bu7/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","startTime":636.0999999046326,"connectEnd":636.0999999046326,"connectStart":636.0999999046326,"domainLookupEnd":636.0999999046326,"domainLookupStart":636.0999999046326,"fetchStart":636.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":636.0999999046326,"responseEnd":1118.7000000476837,"responseStart":1118.7000000476837,"secureConnectionStart":636.0999999046326},{"duration":219.90000009536743,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":899.5999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":899.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1119.5,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":117,"responseStart":267,"responseEnd":296,"domLoading":270,"domInteractive":1082,"domContentLoadedEventStart":1082,"domContentLoadedEventEnd":1123,"domComplete":1839,"loadEventStart":1839,"loadEventEnd":1841,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1066.5999999046326},{"name":"bigPipe.sidebar-id.end","time":1067.5},{"name":"bigPipe.activity-panel-pipe-id.start","time":1067.5999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":1069.9000000953674},{"name":"activityTabFullyLoaded","time":1131.2000000476837}],"measures":[],"correlationId":"20fbac487fb28f","effectiveType":"4g","downlink":9.4,"rtt":0,"serverDuration":80,"dbReadsTimeInMs":12,"dbConnsTimeInMs":19,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}