Type:
Bug
Priority:
Major
Resolution:
Fixed
Affects Version/s:
None
Component/s:
None
Program terminated with signal 11, Segmentation fault.
#0 0x00000000005c1d10 in Item_ref::real_item (this=0x0) at 5.5/sql/item.h:2979
2979 Item *real_item()
#0 0x00000000005c1d10 in Item_ref::real_item (this=0x0) at 5.5/sql/item.h:2979
#1 0x00000000005c1d51 in Item_ref::real_item (this=0x7fb4f8025b80) at 5.5/sql/item.h:2981
...
...
#8846 0x00000000005c1d51 in Item_ref::real_item (this=0x7fb4f8025b80) at 5.5/sql/item.h:2981
#8847 0x00000000005c1d51 in Item_ref::real_item (this=0x7fb4f8025b80) at 5.5/sql/item.h:2981
#8848 0x00000000007ef0db in Item_direct_view_ref::replace_equal_field (this=0x7fb4f8025b80, arg=0x7fb5009972b0 " \254\002\370\264\177") at 5.5/sql/item.cc:8040
#8849 0x00000000007ec17c in Item_ref::transform (this=0x7fb4f8025b80, transformer=&virtual Item::replace_equal_field(unsigned char*), arg=0x7fb5009972b0 " \254\002\370\264\177") at 5.5/sql/item.cc:6995
#8850 0x000000000065ef26 in substitute_for_best_equal_field (context_tab=0x7fb4f802cbf0, cond=0x7fb4f8025b80, cond_equal=0x7fb4f8023a28, table_join_idx=0x7fb4f802be58) at 5.5/sql/sql_select.cc:12487
#8851 0x0000000000642844 in JOIN::optimize (this=0x7fb4f8024338) at 5.5/sql/sql_select.cc:1353
#8852 0x0000000000648949 in mysql_select (thd=0x2801f70, rref_pointer_array=0x2805bc8, tables=0x7fb4f8020198, wild_num=1, fields=..., conds=0x7fb4f8023938, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748612, result=0x7fb4f8023b10, unit=0x2805288, select_lex=0x2805960) at 5.5/sql/sql_select.cc:3055
#8853 0x0000000000678d0a in mysql_explain_union (thd=0x2801f70, unit=0x2805288, result=0x7fb4f8023b10) at 5.5/sql/sql_select.cc:22664
#8854 0x0000000000617c62 in execute_sqlcom_select (thd=0x2801f70, all_tables=0x7fb4f8020198) at 5.5/sql/sql_parse.cc:4622
#8855 0x0000000000610895 in mysql_execute_command (thd=0x2801f70) at 5.5/sql/sql_parse.cc:2205
#8856 0x000000000061a6e6 in mysql_parse (thd=0x2801f70, rawbuf=0x7fb4f80074c8 "EXPLAIN SELECT * FROM ( SELECT * FROM t1 ) AS table1, ( SELECT DISTINCT * FROM t2 ) AS table2 \nWHERE b = a AND a <> ANY ( SELECT 9 )", length=132, parser_state=0x7fb500998500) at 5.5/sql/sql_parse.cc:5769
#8857 0x000000000060dd5f in dispatch_command (command=COM_QUERY, thd=0x2801f70, packet=0x2873151 "", packet_length=132) at 5.5/sql/sql_parse.cc:1071
#8858 0x000000000060cf6f in do_command (thd=0x2801f70) at 5.5/sql/sql_parse.cc:794
#8859 0x0000000000714cb1 in do_handle_one_connection (thd_arg=0x2801f70) at 5.5/sql/sql_connect.cc:1266
#8860 0x0000000000714698 in handle_one_connection (arg=0x2801f70) at 5.5/sql/sql_connect.cc:1181
#8861 0x0000000000964564 in pfs_spawn_thread (arg=0x2847620) at 5.5/storage/perfschema/pfs.cc:1015
#8862 0x00007fb504884e9a in start_thread (arg=0x7fb500999700) at pthread_create.c:308
#8863 0x00007fb503b78cbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
bzr version-info
revision-id: sergii@pisem.net-20130910090414-fr6p4sqb1cm3uimh
date: 2013-09-10 11:04:14 +0200
build-date: 2013-09-13 03:33:05 +0400
revno: 3887
branch-nick: 5.5
Started happening from revno 3880 (mysql-5.5.33 merge). Does not crash on mysql-5.5.
Test case:
SET optimizer_switch = 'derived_merge=on,derived_with_keys=on,in_to_exists=on' ;
CREATE TABLE t1 (a INT ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (8);
CREATE TABLE t2 (b INT ) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1),(7);
EXPLAIN SELECT * FROM ( SELECT * FROM t1 ) AS table1, ( SELECT DISTINCT * FROM t2 ) AS table2
WHERE b = a AND a <> ANY ( SELECT 9 );
Also crashes with views instead of select subqueries (merge view for table1 and any view for table2).
Elena Stepanova
made changes -
2013-09-13 02:37
Field
Original Value
New Value
Sergei Golubchik
made changes -
2013-09-14 00:23
Assignee
Timour Katchaounov
[ timour
]
Sergei Golubchik
[ serg
]
Sergei Golubchik
made changes -
2013-09-14 01:05
Resolution
Fixed
[ 1
]
Status
In Progress
[ 3
]
Closed
[ 6
]
Sergei Golubchik
made changes -
2014-06-13 15:06
Workflow
defaullt
[ 28915
]
MariaDB v2
[ 44603
]
Sergei Golubchik
made changes -
2021-12-06 21:39
Workflow
MariaDB v3
[ 63956
]
MariaDB v4
[ 147030
]
{"report":{"fcp":1081.3999996185303,"ttfb":397.3999996185303,"pageVisibility":"visible","entityId":25615,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"fb9e036a-3db5-4a93-a587-b20079443cb8","navigationType":0,"readyForUser":1214.3000001907349,"redirectCount":0,"resourceLoadedEnd":831.5999994277954,"resourceLoadedStart":404.8999996185303,"resourceTiming":[{"duration":85.90000057220459,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":404.8999996185303,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":404.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":490.80000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":86,"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":405.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":405.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":491.30000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":270.1000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":405.3999996185303,"connectEnd":405.3999996185303,"connectStart":405.3999996185303,"domainLookupEnd":405.3999996185303,"domainLookupStart":405.3999996185303,"fetchStart":405.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":497.0999994277954,"responseEnd":675.5,"responseStart":512.3000001907349,"secureConnectionStart":405.3999996185303},{"duration":386.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":405.5999994277954,"connectEnd":405.5999994277954,"connectStart":405.5999994277954,"domainLookupEnd":405.5999994277954,"domainLookupStart":405.5999994277954,"fetchStart":405.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":501.69999980926514,"responseEnd":791.6999998092651,"responseStart":519.3000001907349,"secureConnectionStart":405.5999994277954},{"duration":121.19999980926514,"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":405.80000019073486,"connectEnd":405.80000019073486,"connectStart":405.80000019073486,"domainLookupEnd":405.80000019073486,"domainLookupStart":405.80000019073486,"fetchStart":405.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":507.19999980926514,"responseEnd":527,"responseStart":525,"secureConnectionStart":405.80000019073486},{"duration":121.80000019073486,"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":406,"connectEnd":406,"connectStart":406,"domainLookupEnd":406,"domainLookupStart":406,"fetchStart":406,"redirectEnd":0,"redirectStart":0,"requestStart":508,"responseEnd":527.8000001907349,"responseStart":525.6999998092651,"secureConnectionStart":406},{"duration":125.39999961853027,"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":406.19999980926514,"connectEnd":406.19999980926514,"connectStart":406.19999980926514,"domainLookupEnd":406.19999980926514,"domainLookupStart":406.19999980926514,"fetchStart":406.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":513.0999994277954,"responseEnd":531.5999994277954,"responseStart":530.3000001907349,"secureConnectionStart":406.19999980926514},{"duration":105.19999980926514,"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":406.3999996185303,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":406.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":511.5999994277954,"responseStart":0,"secureConnectionStart":0},{"duration":131.20000076293945,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":406.5999994277954,"connectEnd":406.5999994277954,"connectStart":406.5999994277954,"domainLookupEnd":406.5999994277954,"domainLookupStart":406.5999994277954,"fetchStart":406.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":516.5999994277954,"responseEnd":537.8000001907349,"responseStart":535.3000001907349,"secureConnectionStart":406.5999994277954},{"duration":105.30000019073486,"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":406.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":406.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":512,"responseStart":0,"secureConnectionStart":0},{"duration":134.60000038146973,"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":406.8999996185303,"connectEnd":406.8999996185303,"connectStart":406.8999996185303,"domainLookupEnd":406.8999996185303,"domainLookupStart":406.8999996185303,"fetchStart":406.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":517.0999994277954,"responseEnd":541.5,"responseStart":533.8999996185303,"secureConnectionStart":406.8999996185303},{"duration":420.5999994277954,"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":410.30000019073486,"connectEnd":410.30000019073486,"connectStart":410.30000019073486,"domainLookupEnd":410.30000019073486,"domainLookupStart":410.30000019073486,"fetchStart":410.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":626.8000001907349,"responseEnd":830.8999996185303,"responseStart":823.8999996185303,"secureConnectionStart":410.30000019073486},{"duration":421.19999980926514,"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":410.3999996185303,"connectEnd":410.3999996185303,"connectStart":410.3999996185303,"domainLookupEnd":410.3999996185303,"domainLookupStart":410.3999996185303,"fetchStart":410.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":694.3000001907349,"responseEnd":831.5999994277954,"responseStart":826.0999994277954,"secureConnectionStart":410.3999996185303},{"duration":167.19999980926514,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":829.1999998092651,"connectEnd":829.1999998092651,"connectStart":829.1999998092651,"domainLookupEnd":829.1999998092651,"domainLookupStart":829.1999998092651,"fetchStart":829.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":960.5,"responseEnd":996.3999996185303,"responseStart":995,"secureConnectionStart":829.1999998092651}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":225,"responseStart":398,"responseEnd":409,"domLoading":401,"domInteractive":1287,"domContentLoadedEventStart":1287,"domContentLoadedEventEnd":1339,"domComplete":2442,"loadEventStart":2442,"loadEventEnd":2442,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1260.3999996185303},{"name":"bigPipe.sidebar-id.end","time":1261.1999998092651},{"name":"bigPipe.activity-panel-pipe-id.start","time":1261.3999996185303},{"name":"bigPipe.activity-panel-pipe-id.end","time":1264},{"name":"activityTabFullyLoaded","time":1355.5999994277954}],"measures":[],"correlationId":"def404a6e4157a","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":106,"dbReadsTimeInMs":17,"dbConnsTimeInMs":25,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
The cause for the crash is a stack overflow because of infinite recursion in Item_ref::real_item.
The reason is an Item_direct_view_ref view object whose 'ref' member points to itself.
I put debug_assert in few places to check for this situation, and apparently the problem is in
substitute_for_best_equal_field who creates this recursion. Still analyzing where exactly.