This testcase:
SET @@SESSION.max_sort_length=2000000;
|
USE INFORMATION_SCHEMA;
|
SELECT * FROM tables t JOIN columns c ON t.table_schema=c.table_schema WHERE c.table_schema=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.columns GROUP BY column_type) GROUP BY t.table_name;
|
Leads to:
Core was generated by `/data/MD140320-mariadb-10.4.13-linux-x86_64-opt/bin/mysqld --no-defaults --core'.
|
Program terminated with signal SIGSEGV, Segmentation fault.
|
#0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=11)
|
at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
|
57 ../sysdeps/unix/sysv/linux/pthread_kill.c: No such file or directory.
|
[Current thread is 1 (Thread 0x7f2ebdbde700 (LWP 18246))]
|
(gdb) bt
|
#0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=11)
|
at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
|
#1 0x000055e9e382a987 in my_write_core (sig=sig@entry=11) at /data/git/10.4_opt/mysys/stacktrace.c:481
|
#2 0x000055e9e329de3a in handle_fatal_signal (sig=11) at /data/git/10.4_opt/sql/signal_handler.cc:343
|
#3 <signal handler called>
|
#4 0x000055e9e30ca011 in next_breadth_first_tab (tab=0x7f2e76cf7800, n_top_tabs_count=2,
|
first_top_tab=0x7f2e76cf70b0) at /data/git/10.4_opt/sql/sql_select.cc:9921
|
#5 JOIN::cleanup (this=this@entry=0x7f2e76c516b0, full=full@entry=true)
|
at /data/git/10.4_opt/sql/sql_select.cc:13766
|
#6 0x000055e9e30ca6f6 in JOIN::destroy (this=0x7f2e76c516b0) at /data/git/10.4_opt/sql/sql_select.cc:4481
|
#7 0x000055e9e312a4d8 in st_select_lex::cleanup (this=this@entry=0x7f2e76c3f208)
|
at /data/git/10.4_opt/sql/sql_union.cc:2070
|
#8 0x000055e9e30e3392 in mysql_select (thd=thd@entry=0x7f2e76c12008, tables=0x7f2e76c3f7d8, wild_num=1,
|
fields=..., conds=<optimized out>, og_num=1, order=0x0, group=0x7f2e76c42f88, having=0x0,
|
proc_param=0x0, select_options=2684619520, result=0x7f2e76c51688, unit=0x7f2e76c15d70,
|
select_lex=0x7f2e76c3f208) at /data/git/10.4_opt/sql/sql_select.cc:4688
|
#9 0x000055e9e30e35a1 in handle_select (thd=thd@entry=0x7f2e76c12008, lex=lex@entry=0x7f2e76c15cb0,
|
result=result@entry=0x7f2e76c51688, setup_tables_done_option=setup_tables_done_option@entry=0)
|
at /data/git/10.4_opt/sql/sql_select.cc:410
|
#10 0x000055e9e307f681 in execute_sqlcom_select (thd=thd@entry=0x7f2e76c12008, all_tables=0x7f2e76c3f7d8)
|
at /data/git/10.4_opt/sql/sql_parse.cc:6359
|
#11 0x000055e9e3088747 in mysql_execute_command (thd=thd@entry=0x7f2e76c12008)
|
at /data/git/10.4_opt/sql/sql_parse.cc:3898
|
#12 0x000055e9e308f37a in mysql_parse (thd=thd@entry=0x7f2e76c12008, rawbuf=<optimized out>, length=184,
|
parser_state=parser_state@entry=0x7f2ebdbdd140, is_com_multi=is_com_multi@entry=false,
|
is_next_command=is_next_command@entry=false) at /data/git/10.4_opt/sql/sql_parse.cc:7900
|
#13 0x000055e9e3091939 in dispatch_command (command=command@entry=COM_QUERY,
|
thd=thd@entry=0x7f2e76c12008,
|
packet=packet@entry=0x7f2e76c32009 "SELECT * FROM tables t JOIN columns c ON t.table_schema=c.table_schema WHERE c.table_schema=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.columns GROUP BY column_type) GROUP BY t.table_name", packet_length=packet_length@entry=184, is_com_multi=is_com_multi@entry=false,
|
is_next_command=is_next_command@entry=false) at /data/git/10.4_opt/sql/sql_parse.cc:1841
|
#14 0x000055e9e3093220 in do_command (thd=0x7f2e76c12008) at /data/git/10.4_opt/sql/sql_parse.cc:1359
|
#15 0x000055e9e316fb2e in do_handle_one_connection (connect=connect@entry=0x7f2ebac31748)
|
at /data/git/10.4_opt/sql/sql_connect.cc:1412
|
#16 0x000055e9e316fbed in handle_one_connection (arg=0x7f2ebac31748)
|
at /data/git/10.4_opt/sql/sql_connect.cc:1316
|
#17 0x00007f2ebcb676db in start_thread (arg=0x7f2ebdbde700) at pthread_create.c:463
|
#18 0x00007f2ebb80d88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
|
Bug confirmed present in:
MariaDB: 10.2.32 (dbg), 10.2.32 (opt), 10.3.23 (dbg), 10.3.23 (opt), 10.4.13 (dbg), 10.4.13 (opt), 10.5.2 (dbg), 10.5.2 (opt)
Bug confirmed not present in:
MariaDB: 10.1.45 (dbg), 10.1.45 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)
A few observations;
- Lowering the SESSION.max_sort_length stops the bug from occurring.
10.4.13>SET @@SESSION.max_sort_length=200000; # <- one less zero
|
Query OK, 0 rows affected (0.000 sec)
|
10.4.13>USE INFORMATION_SCHEMA;
|
Database changed
|
10.4.13>SELECT * FROM tables t JOIN columns c ON t.table_schema=c.table_schema WHERE c.table_schema=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.columns GROUP BY column_type) GROUP BY t.table_name;
|
ERROR 1242 (21000): Subquery returns more than 1 row
|
|
10.4.13>SET @@SESSION.max_sort_length=2000000;
|
Query OK, 0 rows affected (0.000 sec)
|
10.4.13>SELECT * FROM tables t JOIN columns c ON t.table_schema=c.table_schema WHERE c.table_schema=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.columns GROUP BY column_type) GROUP BY t.table_name;
|
ERROR 2013 (HY000): Lost connection to MySQL server during query
|
- Removing the second GROUP BY stops this bug from occurring:
10.4.13>SET @@SESSION.max_sort_length=2000000;
|
Query OK, 0 rows affected (0.000 sec)
|
10.4.13>USE INFORMATION_SCHEMA;
|
Database changed
|
10.4.13>SELECT * FROM tables t JOIN columns c ON t.table_schema=c.table_schema WHERE c.table_schema=(SELECT COUNT(*) FROM INFORMATION_SCHEMA.columns GROUP BY column_type);
|
ERROR 1038 (HY001): Out of sort memory, consider increasing server sort buffer size
|
{"report":{"fcp":852.9000005722046,"ttfb":247.20000076293945,"pageVisibility":"visible","entityId":84481,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"7d6fc85e-e114-4585-b0e1-079094397037","navigationType":0,"readyForUser":935.4000005722046,"redirectCount":0,"resourceLoadedEnd":1013.9000005722046,"resourceLoadedStart":252.20000076293945,"resourceTiming":[{"duration":118.89999961853027,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":252.20000076293945,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":252.20000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":371.1000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":118.80000019073486,"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":252.4000005722046,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":252.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":371.20000076293945,"responseStart":0,"secureConnectionStart":0},{"duration":152.20000076293945,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":252.5,"connectEnd":252.5,"connectStart":252.5,"domainLookupEnd":252.5,"domainLookupStart":252.5,"fetchStart":252.5,"redirectEnd":0,"redirectStart":0,"requestStart":252.5,"responseEnd":404.70000076293945,"responseStart":404.70000076293945,"secureConnectionStart":252.5},{"duration":238.69999980926514,"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":252.70000076293945,"connectEnd":252.70000076293945,"connectStart":252.70000076293945,"domainLookupEnd":252.70000076293945,"domainLookupStart":252.70000076293945,"fetchStart":252.70000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":252.70000076293945,"responseEnd":491.4000005722046,"responseStart":491.4000005722046,"secureConnectionStart":252.70000076293945},{"duration":235.0999994277954,"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":252.70000076293945,"connectEnd":252.70000076293945,"connectStart":252.70000076293945,"domainLookupEnd":252.70000076293945,"domainLookupStart":252.70000076293945,"fetchStart":252.70000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":252.70000076293945,"responseEnd":487.80000019073486,"responseStart":487.80000019073486,"secureConnectionStart":252.70000076293945},{"duration":239,"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":252.80000019073486,"connectEnd":252.80000019073486,"connectStart":252.80000019073486,"domainLookupEnd":252.80000019073486,"domainLookupStart":252.80000019073486,"fetchStart":252.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":252.80000019073486,"responseEnd":491.80000019073486,"responseStart":491.80000019073486,"secureConnectionStart":252.80000019073486},{"duration":239.5,"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":253,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":253,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":492.5,"responseStart":0,"secureConnectionStart":0},{"duration":239.10000038146973,"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":253,"connectEnd":253,"connectStart":253,"domainLookupEnd":253,"domainLookupStart":253,"fetchStart":253,"redirectEnd":0,"redirectStart":0,"requestStart":253,"responseEnd":492.1000003814697,"responseStart":492.1000003814697,"secureConnectionStart":253},{"duration":239.29999923706055,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":253.20000076293945,"connectEnd":253.20000076293945,"connectStart":253.20000076293945,"domainLookupEnd":253.20000076293945,"domainLookupStart":253.20000076293945,"fetchStart":253.20000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":253.20000076293945,"responseEnd":492.5,"responseStart":492.5,"secureConnectionStart":253.20000076293945},{"duration":239.60000038146973,"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":253.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":253.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":492.9000005722046,"responseStart":0,"secureConnectionStart":0},{"duration":239.5999994277954,"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":253.4000005722046,"connectEnd":253.4000005722046,"connectStart":253.4000005722046,"domainLookupEnd":253.4000005722046,"domainLookupStart":253.4000005722046,"fetchStart":253.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":253.4000005722046,"responseEnd":493,"responseStart":493,"secureConnectionStart":253.4000005722046},{"duration":395,"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":258.80000019073486,"connectEnd":258.80000019073486,"connectStart":258.80000019073486,"domainLookupEnd":258.80000019073486,"domainLookupStart":258.80000019073486,"fetchStart":258.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":258.80000019073486,"responseEnd":653.8000001907349,"responseStart":653.8000001907349,"secureConnectionStart":258.80000019073486},{"duration":754.8000001907349,"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":259.1000003814697,"connectEnd":259.1000003814697,"connectStart":259.1000003814697,"domainLookupEnd":259.1000003814697,"domainLookupStart":259.1000003814697,"fetchStart":259.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":259.1000003814697,"responseEnd":1013.9000005722046,"responseStart":1013.9000005722046,"secureConnectionStart":259.1000003814697},{"duration":96.70000076293945,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":557.5,"connectEnd":557.5,"connectStart":557.5,"domainLookupEnd":557.5,"domainLookupStart":557.5,"fetchStart":557.5,"redirectEnd":0,"redirectStart":0,"requestStart":557.5,"responseEnd":654.2000007629395,"responseStart":654.2000007629395,"secureConnectionStart":557.5},{"duration":255,"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":808.8000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":808.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1063.8000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":254.89999961853027,"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":809.6000003814697,"connectEnd":809.6000003814697,"connectStart":809.6000003814697,"domainLookupEnd":809.6000003814697,"domainLookupStart":809.6000003814697,"fetchStart":809.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":809.6000003814697,"responseEnd":1064.5,"responseStart":1064.5,"secureConnectionStart":809.6000003814697},{"duration":258.8999996185303,"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":809.9000005722046,"connectEnd":809.9000005722046,"connectStart":809.9000005722046,"domainLookupEnd":809.9000005722046,"domainLookupStart":809.9000005722046,"fetchStart":809.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":809.9000005722046,"responseEnd":1068.8000001907349,"responseStart":1068.8000001907349,"secureConnectionStart":809.9000005722046},{"duration":223.5,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":846.6000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":846.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1070.1000003814697,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":76,"responseStart":247,"responseEnd":259,"domLoading":251,"domInteractive":1028,"domContentLoadedEventStart":1028,"domContentLoadedEventEnd":1066,"domComplete":1760,"loadEventStart":1760,"loadEventEnd":1761,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1015.7000007629395},{"name":"bigPipe.sidebar-id.end","time":1016.5},{"name":"bigPipe.activity-panel-pipe-id.start","time":1016.7000007629395},{"name":"bigPipe.activity-panel-pipe-id.end","time":1019},{"name":"activityTabFullyLoaded","time":1074.8000001907349}],"measures":[],"correlationId":"33de6aad0ade25","effectiveType":"4g","downlink":9.7,"rtt":0,"serverDuration":94,"dbReadsTimeInMs":11,"dbConnsTimeInMs":18,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}