The initial description is below.
Simplified test case:
CREATE TABLE t1 (
|
f1 enum('1','2','3','4','5')
|
) ENGINE=MyISAM;
|
INSERT INTO t1 VALUES (1),(2);
|
|
SELECT AVG(f1) FROM t1;
|
mysqld: decimal.c:1467: decimal_bin_size: Assertion `scale >= 0 && precision > 0 && scale <= precision' failed.
|
[ERROR] mysqld got signal 6 ;
|
#5 0x00007fcabef28b8b in __GI_abort () at abort.c:91
|
#6 0x00007fcabef1e0ee in __assert_fail_base (fmt=<optimized out>, assertion=0xed6e58 "scale >= 0 && precision > 0 && scale <= precision", file=0xed6c00 "decimal.c", line=<optimized out>, function=<optimized out>) at assert.c:94
|
#7 0x00007fcabef1e192 in __GI___assert_fail (assertion=0xed6e58 "scale >= 0 && precision > 0 && scale <= precision", file=0xed6c00 "decimal.c", line=1467, function=0xed7050 "decimal_bin_size") at assert.c:103
|
#8 0x0000000000bd6de1 in decimal_bin_size (precision=27, scale=31) at decimal.c:1467
|
#9 0x00000000005a9eb4 in my_decimal_get_binary_size (precision=27, scale=31) at my_decimal.h:236
|
#10 0x00000000005a2334 in Item_sum_avg::fix_length_and_dec (this=0x7fcaa40190e8) at item_sum.cc:1243
|
#11 0x00000000005a02d9 in Item_sum_num::fix_fields (this=0x7fcaa40190e8, thd=0x29f88b8, ref=0x7fcaa40192b8) at item_sum.cc:596
|
#12 0x00000000006ed7a9 in setup_fields (thd=0x29f88b8, ref_pointer_array=0x7fcaa4019ce0, fields=..., mark_used_columns=MARK_COLUMNS_READ, sum_func_list=0x7fcaa4019ad0, allow_sum_func=true) at sql_base.cc:7858
|
#13 0x0000000000706181 in JOIN::prepare (this=0x7fcaa40197d8, rref_pointer_array=0x29fb5a8, tables_init=0x7fcaa4019310, wild_num=0, conds_init=0x0, og_num=0, order_init=0x0, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x29fb350, unit_arg=0x29fae48) at sql_select.cc:666
|
#14 0x000000000070eadb in mysql_select (thd=0x29f88b8, rref_pointer_array=0x29fb5a8, tables=0x7fcaa4019310, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147764736, result=0x7fcaa40197b8, unit=0x29fae48, select_lex=0x29fb350) at sql_select.cc:2970
|
#15 0x0000000000705605 in handle_select (thd=0x29f88b8, lex=0x29fada8, result=0x7fcaa40197b8, setup_tables_done_option=0) at sql_select.cc:288
|
#16 0x0000000000691912 in execute_sqlcom_select (thd=0x29f88b8, all_tables=0x7fcaa4019310) at sql_parse.cc:5172
|
#17 0x00000000006886da in mysql_execute_command (thd=0x29f88b8) at sql_parse.cc:2305
|
#18 0x000000000069439c in mysql_parse (thd=0x29f88b8, rawbuf=0x7fcaa4018f40 "SELECT AVG(f1) FROM t1", length=22, found_semicolon=0x7fcabdda17e0) at sql_parse.cc:6173
|
#19 0x0000000000685df7 in dispatch_command (command=COM_QUERY, thd=0x29f88b8, packet=0x2a72b69 "SELECT AVG(f1) FROM t1", packet_length=22) at sql_parse.cc:1243
|
#20 0x0000000000685068 in do_command (thd=0x29f88b8) at sql_parse.cc:923
|
#21 0x0000000000681f02 in handle_one_connection (arg=0x29f88b8) at sql_connect.cc:1231
|
#22 0x00007fcabfab9e9a in start_thread (arg=0x7fcabdda2700) at pthread_create.c:308
|
#23 0x00007fcabefe2cbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
|
Reproducible with the default optimizer_switch as well as with all OFF values.
revision-id: psergey@askmonty.org-20130301042335-x16j7uo1dwxxgqs9
|
revno: 3632
|
branch-nick: 5.3
|
Also reproducible on current 5.5, 10.0.
Not reproducible on 5.2, mysql/5.5, mysql/5.6.
=========================================
Initial description
In the attachment, I have:
1. a schema with sample data and 2 queries that run on it causing MariaDB to crash.
2. Own compiled MariaDB mysqld 5.5.29 win32 binary in debug mode using CMAKE and VS2012 32-bit compiler which also shows issue.
3. my.ini from crashing environment
4. core dump of debug version
5. err file containing stack trace.
Sometimes it will return a result once or twice before crashing.
Crash is 100% reproducible.
5.5.28a and 5.5.29 exhibit issue, own built 5.5.29 from source on windows with CMAKE and VS2012 C++ compiler (32-bit) with full debug symbols also crashes.
This is my first MySQL-related bug report, I hope I've done everything right.
{"report":{"fcp":765,"ttfb":276.6999999284744,"pageVisibility":"visible","entityId":23206,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"349386e7-7504-46fe-b589-d77594e35113","navigationType":0,"readyForUser":904.6000000238419,"redirectCount":0,"resourceLoadedEnd":794.2999999523163,"resourceLoadedStart":281.60000002384186,"resourceTiming":[{"duration":13,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":281.60000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":281.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":294.60000002384186,"responseStart":0,"secureConnectionStart":0},{"duration":13,"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":282,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":282,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":295,"responseStart":0,"secureConnectionStart":0},{"duration":75.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":282,"connectEnd":282,"connectStart":282,"domainLookupEnd":282,"domainLookupStart":282,"fetchStart":282,"redirectEnd":0,"redirectStart":0,"requestStart":282,"responseEnd":357.60000002384186,"responseStart":357.60000002384186,"secureConnectionStart":282},{"duration":178.69999992847443,"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":282.10000002384186,"connectEnd":282.10000002384186,"connectStart":282.10000002384186,"domainLookupEnd":282.10000002384186,"domainLookupStart":282.10000002384186,"fetchStart":282.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":282.10000002384186,"responseEnd":460.7999999523163,"responseStart":460.7999999523163,"secureConnectionStart":282.10000002384186},{"duration":182.20000004768372,"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":282.1999999284744,"connectEnd":282.1999999284744,"connectStart":282.1999999284744,"domainLookupEnd":282.1999999284744,"domainLookupStart":282.1999999284744,"fetchStart":282.1999999284744,"redirectEnd":0,"redirectStart":0,"requestStart":282.1999999284744,"responseEnd":464.39999997615814,"responseStart":464.39999997615814,"secureConnectionStart":282.1999999284744},{"duration":182.5,"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":282.39999997615814,"connectEnd":282.39999997615814,"connectStart":282.39999997615814,"domainLookupEnd":282.39999997615814,"domainLookupStart":282.39999997615814,"fetchStart":282.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":282.39999997615814,"responseEnd":464.89999997615814,"responseStart":464.89999997615814,"secureConnectionStart":282.39999997615814},{"duration":182.79999995231628,"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":282.39999997615814,"connectEnd":282.39999997615814,"connectStart":282.39999997615814,"domainLookupEnd":282.39999997615814,"domainLookupStart":282.39999997615814,"fetchStart":282.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":282.39999997615814,"responseEnd":465.1999999284744,"responseStart":465.1999999284744,"secureConnectionStart":282.39999997615814},{"duration":183.10000002384186,"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":282.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":282.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":465.60000002384186,"responseStart":0,"secureConnectionStart":0},{"duration":183,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":282.60000002384186,"connectEnd":282.60000002384186,"connectStart":282.60000002384186,"domainLookupEnd":282.60000002384186,"domainLookupStart":282.60000002384186,"fetchStart":282.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":282.60000002384186,"responseEnd":465.60000002384186,"responseStart":465.60000002384186,"secureConnectionStart":282.60000002384186},{"duration":183.30000007152557,"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":282.6999999284744,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":282.6999999284744,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":466,"responseStart":0,"secureConnectionStart":0},{"duration":183.30000007152557,"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":282.7999999523163,"connectEnd":282.7999999523163,"connectStart":282.7999999523163,"domainLookupEnd":282.7999999523163,"domainLookupStart":282.7999999523163,"fetchStart":282.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":282.7999999523163,"responseEnd":466.10000002384186,"responseStart":466.10000002384186,"secureConnectionStart":282.7999999523163},{"duration":437.89999997615814,"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":288.39999997615814,"connectEnd":288.39999997615814,"connectStart":288.39999997615814,"domainLookupEnd":288.39999997615814,"domainLookupStart":288.39999997615814,"fetchStart":288.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":288.39999997615814,"responseEnd":726.2999999523163,"responseStart":726.2999999523163,"secureConnectionStart":288.39999997615814},{"duration":449.7000000476837,"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":288.6999999284744,"connectEnd":288.6999999284744,"connectStart":288.6999999284744,"domainLookupEnd":288.6999999284744,"domainLookupStart":288.6999999284744,"fetchStart":288.6999999284744,"redirectEnd":0,"redirectStart":0,"requestStart":288.6999999284744,"responseEnd":738.3999999761581,"responseStart":738.3999999761581,"secureConnectionStart":288.6999999284744},{"duration":217.70000004768372,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":508.89999997615814,"connectEnd":508.89999997615814,"connectStart":508.89999997615814,"domainLookupEnd":508.89999997615814,"domainLookupStart":508.89999997615814,"fetchStart":508.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":508.89999997615814,"responseEnd":726.6000000238419,"responseStart":726.6000000238419,"secureConnectionStart":508.89999997615814},{"duration":5.899999976158142,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":758.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":758.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":764.3999999761581,"responseStart":0,"secureConnectionStart":0},{"duration":3.8000000715255737,"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":781.7999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":781.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":785.6000000238419,"responseStart":0,"secureConnectionStart":0},{"duration":4.699999928474426,"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":782.6000000238419,"connectEnd":782.6000000238419,"connectStart":782.6000000238419,"domainLookupEnd":782.6000000238419,"domainLookupStart":782.6000000238419,"fetchStart":782.6000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":782.6000000238419,"responseEnd":787.2999999523163,"responseStart":787.2999999523163,"secureConnectionStart":782.6000000238419},{"duration":11.399999976158142,"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":782.8999999761581,"connectEnd":782.8999999761581,"connectStart":782.8999999761581,"domainLookupEnd":782.8999999761581,"domainLookupStart":782.8999999761581,"fetchStart":782.8999999761581,"redirectEnd":0,"redirectStart":0,"requestStart":782.8999999761581,"responseEnd":794.2999999523163,"responseStart":794.1999999284744,"secureConnectionStart":782.8999999761581}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":91,"responseStart":277,"responseEnd":288,"domLoading":280,"domInteractive":977,"domContentLoadedEventStart":977,"domContentLoadedEventEnd":1026,"domComplete":1291,"loadEventStart":1291,"loadEventEnd":1292,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":945.6000000238419},{"name":"bigPipe.sidebar-id.end","time":946.3999999761581},{"name":"bigPipe.activity-panel-pipe-id.start","time":946.6000000238419},{"name":"bigPipe.activity-panel-pipe-id.end","time":948},{"name":"activityTabFullyLoaded","time":1045.6999999284744}],"measures":[],"correlationId":"ef7a2002975124","effectiveType":"4g","downlink":9,"rtt":0,"serverDuration":100,"dbReadsTimeInMs":10,"dbConnsTimeInMs":18,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Reduced test suite:
CREATE TABLE t1 (
f enum('1','2','3','4','5') DEFAULT NULL
);
insert into t1 (f) values ('5'),('5');
SELECT
1,
IFNULL(FLOOR(AVG(f)), 0) AS avg_grade
FROM
t1
GROUP BY 1;