Attention: I am only getting the crash on a VALGRIND build
cmake . -DCMAKE_BUILD_TYPE=Debug -DWITH_VALGRIND=YES
See also MDEV-7688 , MDEV-7689 , MDEV-7696 , MDEV-7751 - they all are somewhat similar, probably there are duplicates among them; but effects are different everywhere.
The problem appeared in 5.5 tree with the following revision:
revno: 4255
revision-id: sanja@askmonty.org-20140731071110-4uyuza0ykesfxe1b
parent: monty@mariadb.org-20140730102752-3ilbpvmbhr2r9a4x
committer: sanja@askmonty.org
branch nick: work-maria-5.5-MDEV-6441
timestamp: Thu 2014-07-31 10:11:10 +0300
message:
MDEV-6441: memory leak
mysql_derived_prepare() was executed on the statement memory.
Now it is executed on the runtime memory.
All bugs induced by this were fixed.
Stack trace from 5.5 commit 34f37aa0c0aa87cfb6908500e937516ff37ea6f0
#3 <signal handler called>
#4 0x00000000008066e9 in Item_field::used_tables (this=0x7f205c046198) at sql/item.cc:2720
#5 0x000000000077c7b7 in optimize_semijoin_nests (join=0x7f205c053c18, all_table_map=127) at sql/opt_subselect.cc:2193
#6 0x000000000066fbed in make_join_statistics (join=0x7f205c053c18, tables_list=..., conds=0x7f205c047958, keyuse_array=0x7f205c053f50) at sql/sql_select.cc:3790
#7 0x0000000000666b44 in JOIN::optimize (this=0x7f205c053c18) at sql/sql_select.cc:1229
#8 0x000000000066d551 in mysql_select (thd=0x7f205cd18000, rref_pointer_array=0x7f205c0e0a88, tables=0x7f205c050c18, wild_num=0, fields=..., conds=0x7f205c047958, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184064, result=0x7f205c044058, unit=0x7f205c0e00c8, select_lex=0x7f205c0e07c8) at sql/sql_select.cc:3080
#9 0x0000000000663e63 in handle_select (thd=0x7f205cd18000, lex=0x7f205c0e0018, result=0x7f205c044058, setup_tables_done_option=0) at sql/sql_select.cc:319
#10 0x000000000063c293 in execute_sqlcom_select (thd=0x7f205cd18000, all_tables=0x7f205c050c18) at sql/sql_parse.cc:4689
#11 0x000000000063546c in mysql_execute_command (thd=0x7f205cd18000) at sql/sql_parse.cc:2234
#12 0x0000000000656b1b in Prepared_statement::execute (this=0x7f205c0d6600, expanded_query=0x7f205cbb4c50, open_cursor=false) at sql/sql_prepare.cc:3928
#13 0x0000000000655c32 in Prepared_statement::execute_loop (this=0x7f205c0d6600, expanded_query=0x7f205cbb4c50, open_cursor=false, packet=0x0, packet_end=0x0) at sql/sql_prepare.cc:3587
#14 0x0000000000653d56 in mysql_sql_stmt_execute (thd=0x7f205cd18000) at sql/sql_prepare.cc:2737
#15 0x000000000063549a in mysql_execute_command (thd=0x7f205cd18000) at sql/sql_parse.cc:2244
#16 0x000000000063ed98 in mysql_parse (thd=0x7f205cd18000, rawbuf=0x7f205c01c0d8 "EXECUTE stmt", length=12, parser_state=0x7f205cbb5610) at sql/sql_parse.cc:5909
#17 0x00000000006329b3 in dispatch_command (command=COM_QUERY, thd=0x7f205cd18000, packet=0x7f205cd8c001 "EXECUTE stmt", packet_length=12) at sql/sql_parse.cc:1079
#18 0x0000000000631b3f in do_command (thd=0x7f205cd18000) at sql/sql_parse.cc:793
#19 0x0000000000739b14 in do_handle_one_connection (thd_arg=0x7f205cd18000) at sql/sql_connect.cc:1266
#20 0x00000000007395d3 in handle_one_connection (arg=0x7f205cd18000) at sql/sql_connect.cc:1181
#21 0x0000000000b836e3 in pfs_spawn_thread (arg=0x7f2060fed760) at storage/perfschema/pfs.cc:1015
#22 0x00007f2062d6cb50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#23 0x00007f206167a70d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
Test case
SET sql_mode = ONLY_FULL_GROUP_BY;
CREATE TABLE t1 (a INT , f1 INT , f2 INT , f3 INT , f4 INT , f5 INT , f6 INT , f7 INT , f8 INT , f9 INT ) ENGINE=MyISAM;
CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (4, 2, 2, 2, 2, 2, 1, 1, 0, 0),(6, 1, 2, 2, 1, 1, 2, 2, 0, 0);
CREATE TABLE t2 (b INT ) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1),(8);
CREATE TABLE t3 (c INT ) ENGINE=MyISAM;
INSERT INTO t3 VALUES (8),(3);
PREPARE stmt FROM "
SELECT a, ( b + a ), a, b,
( SELECT MIN(a) FROM t1, t2 WHERE b <> from_sq1.b ) AS select_sq
FROM ( SELECT t2.* FROM t2, t3 ) AS from_sq1, ( SELECT * FROM t1 ) AS from_sq2
WHERE 0 IN (
SELECT a FROM t1
WHERE a IN (
SELECT t1.a FROM t1, v1, t2
WHERE b = v1.a
)
)
" ;
EXECUTE stmt;
EXECUTE stmt;
relates to
MDEV-7688
Server crashes in TABLE_LIST::is_view_or_derived on 2nd execution of PS with ONLY_FULL_GROUP_BY
Closed
MDEV-7689
Server crashes in Item_subselect::recalc_used_tables on 2nd execution of PS with view, ONLY_FULL_GROUP_BY, HAVING subquery
Closed
MDEV-7696
Server goes into an endless loop on 2nd execution of PS with ONLY_FULL_GROUP_BY, subqueries
Closed
MDEV-7751
Server crashes in TABLE_LIST::reset_const_table on 2nd execution of PS with ONLY_FULL_GROUP_BY, view, subqueries
Closed
MDEV-7688
Server crashes in TABLE_LIST::is_view_or_derived on 2nd execution of PS with ONLY_FULL_GROUP_BY
Closed
MDEV-7689
Server crashes in Item_subselect::recalc_used_tables on 2nd execution of PS with view, ONLY_FULL_GROUP_BY, HAVING subquery
Closed
MDEV-7696
Server goes into an endless loop on 2nd execution of PS with ONLY_FULL_GROUP_BY, subqueries
Closed
MDEV-7751
Server crashes in TABLE_LIST::reset_const_table on 2nd execution of PS with ONLY_FULL_GROUP_BY, view, subqueries
Closed
Show 3 more links (3 relates to)
{"report":{"fcp":944.3999999761581,"ttfb":382.59999999403954,"pageVisibility":"visible","entityId":50400,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"9cf01d2e-17a3-4109-b9dd-7ded48bb2f58","navigationType":0,"readyForUser":1045.199999988079,"redirectCount":0,"resourceLoadedEnd":1342.8999999761581,"resourceLoadedStart":388.5,"resourceTiming":[{"duration":30.799999982118607,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":388.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":388.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":419.2999999821186,"responseStart":0,"secureConnectionStart":0},{"duration":30.900000005960464,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/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":388.7999999821186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":388.7999999821186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":419.69999998807907,"responseStart":0,"secureConnectionStart":0},{"duration":85.19999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":389,"connectEnd":389,"connectStart":389,"domainLookupEnd":389,"domainLookupStart":389,"fetchStart":389,"redirectEnd":0,"redirectStart":0,"requestStart":389,"responseEnd":474.19999998807907,"responseStart":474.19999998807907,"secureConnectionStart":389},{"duration":135,"initiatorType":"script","name":"https://jira.mariadb.org/s/c32eb0da7ad9831253f8397e6cc26afd-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/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":389.09999999403954,"connectEnd":389.09999999403954,"connectStart":389.09999999403954,"domainLookupEnd":389.09999999403954,"domainLookupStart":389.09999999403954,"fetchStart":389.09999999403954,"redirectEnd":0,"redirectStart":0,"requestStart":389.09999999403954,"responseEnd":524.0999999940395,"responseStart":524.0999999940395,"secureConnectionStart":389.09999999403954},{"duration":138.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/bc0bcb146314416123c992714ee00ff7-CDN/lu2bv2/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":389.2999999821186,"connectEnd":389.2999999821186,"connectStart":389.2999999821186,"domainLookupEnd":389.2999999821186,"domainLookupStart":389.2999999821186,"fetchStart":389.2999999821186,"redirectEnd":0,"redirectStart":0,"requestStart":389.2999999821186,"responseEnd":527.7999999821186,"responseStart":527.7999999821186,"secureConnectionStart":389.2999999821186},{"duration":138.7999999821186,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":389.5,"connectEnd":389.5,"connectStart":389.5,"domainLookupEnd":389.5,"domainLookupStart":389.5,"fetchStart":389.5,"redirectEnd":0,"redirectStart":0,"requestStart":389.5,"responseEnd":528.2999999821186,"responseStart":528.2999999821186,"secureConnectionStart":389.5},{"duration":139.19999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":389.69999998807907,"connectEnd":389.69999998807907,"connectStart":389.69999998807907,"domainLookupEnd":389.69999998807907,"domainLookupStart":389.69999998807907,"fetchStart":389.69999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":389.69999998807907,"responseEnd":528.8999999761581,"responseStart":528.8999999761581,"secureConnectionStart":389.69999998807907},{"duration":228.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bv2/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":389.89999997615814,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":389.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":618.3999999761581,"responseStart":0,"secureConnectionStart":0},{"duration":139.59999999403954,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":390,"connectEnd":390,"connectStart":390,"domainLookupEnd":390,"domainLookupStart":390,"fetchStart":390,"redirectEnd":0,"redirectStart":0,"requestStart":390,"responseEnd":529.5999999940395,"responseStart":529.5999999940395,"secureConnectionStart":390},{"duration":228.40000000596046,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bv2/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":390.19999998807907,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":390.19999998807907,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":618.5999999940395,"responseStart":0,"secureConnectionStart":0},{"duration":139.90000000596046,"initiatorType":"script","name":"https://jira.mariadb.org/s/719848dd97ebe0663199f49a3936487a-CDN/lu2bv2/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":390.39999997615814,"connectEnd":390.39999997615814,"connectStart":390.39999997615814,"domainLookupEnd":390.39999997615814,"domainLookupStart":390.39999997615814,"fetchStart":390.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":390.39999997615814,"responseEnd":530.2999999821186,"responseStart":530.2999999821186,"secureConnectionStart":390.39999997615814},{"duration":412.19999998807907,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":398.5,"connectEnd":398.5,"connectStart":398.5,"domainLookupEnd":398.5,"domainLookupStart":398.5,"fetchStart":398.5,"redirectEnd":0,"redirectStart":0,"requestStart":398.5,"responseEnd":810.6999999880791,"responseStart":810.5999999940395,"secureConnectionStart":398.5},{"duration":930.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":398.59999999403954,"connectEnd":398.59999999403954,"connectStart":398.59999999403954,"domainLookupEnd":398.59999999403954,"domainLookupStart":398.59999999403954,"fetchStart":398.59999999403954,"redirectEnd":0,"redirectStart":0,"requestStart":398.59999999403954,"responseEnd":1329.0999999940395,"responseStart":1329.0999999940395,"secureConnectionStart":398.59999999403954},{"duration":181.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":630.2999999821186,"connectEnd":630.2999999821186,"connectStart":630.2999999821186,"domainLookupEnd":630.2999999821186,"domainLookupStart":630.2999999821186,"fetchStart":630.2999999821186,"redirectEnd":0,"redirectStart":0,"requestStart":630.2999999821186,"responseEnd":811.7999999821186,"responseStart":811.7999999821186,"secureConnectionStart":630.2999999821186},{"duration":448.69999998807907,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2bv2/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":894.1999999880791,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":894.1999999880791,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1342.8999999761581,"responseStart":0,"secureConnectionStart":0},{"duration":440.7000000178814,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/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":895.2999999821186,"connectEnd":895.2999999821186,"connectStart":895.2999999821186,"domainLookupEnd":895.2999999821186,"domainLookupStart":895.2999999821186,"fetchStart":895.2999999821186,"redirectEnd":0,"redirectStart":0,"requestStart":895.2999999821186,"responseEnd":1336,"responseStart":1336,"secureConnectionStart":895.2999999821186},{"duration":446.59999999403954,"initiatorType":"script","name":"https://jira.mariadb.org/s/53a43b6764f587426c7bb9a150184c00-CDN/lu2bv2/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":895.6999999880791,"connectEnd":895.6999999880791,"connectStart":895.6999999880791,"domainLookupEnd":895.6999999880791,"domainLookupStart":895.6999999880791,"fetchStart":895.6999999880791,"redirectEnd":0,"redirectStart":0,"requestStart":895.6999999880791,"responseEnd":1342.2999999821186,"responseStart":1342.2999999821186,"secureConnectionStart":895.6999999880791}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":202,"responseStart":383,"responseEnd":397,"domLoading":386,"domInteractive":1357,"domContentLoadedEventStart":1357,"domContentLoadedEventEnd":1402,"domComplete":2650,"loadEventStart":2650,"loadEventEnd":2652,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1330.8999999761581},{"name":"bigPipe.sidebar-id.end","time":1331.7999999821186},{"name":"bigPipe.activity-panel-pipe-id.start","time":1332},{"name":"bigPipe.activity-panel-pipe-id.end","time":1334.3999999761581},{"name":"activityTabFullyLoaded","time":1410.0999999940395}],"measures":[],"correlationId":"beb7df568b3d9c","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":111,"dbReadsTimeInMs":18,"dbConnsTimeInMs":28,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}