Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-4241

Assertion failure: scale >= 0 && precision > 0 && scale <= precision in decimal_bin_size



    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 10.0.1, 5.5.29, 5.5.28a-galera, 5.3.12
    • 10.0.2, 5.5.31, 5.3.13
    • None
    • None


      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.




            sanja Oleksandr Byelkin
            ltltsmash892 Raif Atef
            0 Vote for this issue
            4 Start watching this issue



              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.