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

Server crash in my_decimal::operator= or unexpected ER_DUP_ENTRY upon comparison with INET6 and similar types

    XMLWordPrintable

Details

    Description

      CREATE TABLE t (a CHAR(36) NOT NULL, b INET6 NOT NULL, c DATETIME(6) NOT NULL);
      INSERT INTO t VALUES ('','::','2000-01-01'),('','::','1900-01-01');
      SELECT c + (b = a) AS f, GROUP_CONCAT(c) FROM t GROUP BY f;
       
      # Cleanup
      DROP TABLE t;
      

      10.5 dd62a285b88958dae9b9f3e49fdd0c55f6eced72

      #2  <signal handler called>
      #3  0x0000561df2833cd4 in my_decimal::operator= (rhs=..., this=0x7f05dc8082f0) at /data/bld/10.5-rel/sql/my_decimal.h:128
      #4  my_decimal2decimal (to=0x7f05dc8082f0, from=<optimized out>) at /data/bld/10.5-rel/sql/my_decimal.h:341
      #5  my_decimal::to_binary (this=0x0, bin=bin@entry=0x7f05cc1a2048 "  \032\314\005\177", prec=22, scale=6, mask=mask@entry=30) at /data/bld/10.5-rel/sql/my_decimal.cc:205
      #6  0x0000561df270d157 in Type_handler_decimal_result::make_sort_key_part (this=<optimized out>, to=0x7f05cc1a2048 "  \032\314\005\177", item=0x7f05cc011148, sort_field=0x7f05cc015808, tmp_buffer=<optimized out>) at /data/bld/10.5-rel/sql/filesort.cc:1317
      #7  0x0000561df270e022 in make_sortkey (to=0x7f05cc1a2048 "  \032\314\005\177", param=0x7f05dc808570) at /data/bld/10.5-rel/sql/filesort.cc:3029
      #8  make_sortkey (param=param@entry=0x7f05dc808570, to=0x7f05cc1a2048 "  \032\314\005\177", ref_pos=ref_pos@entry=0x7f05cc197758 "", using_packed_sortkeys=using_packed_sortkeys@entry=false) at /data/bld/10.5-rel/sql/filesort.cc:1350
      #9  0x0000561df2710bd9 in find_all_keys (found_rows=0x7f05cc103710, pq=0x0, tempfile=0x7f05dc808620, buffpek_pointers=0x7f05dc808710, fs_info=0x7f05cc1035a0, select=0x7f05cc014c38, param=0x7f05dc808570, thd=0x7f05cc000c68) at /data/bld/10.5-rel/sql/filesort.cc:966
      #10 filesort (thd=thd@entry=0x7f05cc000c68, table=table@entry=0x7f05cc0fa4e8, filesort=filesort@entry=0x7f05cc015070, tracker=0x7f05cc015780, join=join@entry=0x7f05cc012ad0, first_table_bit=<optimized out>) at /data/bld/10.5-rel/sql/filesort.cc:352
      #11 0x0000561df2566887 in create_sort_index (thd=0x7f05cc000c68, join=0x7f05cc012ad0, tab=tab@entry=0x7f05cc013fb8, fsort=0x7f05cc015070, fsort@entry=0x0) at /data/bld/10.5-rel/sql/sql_select.cc:24550
      #12 0x0000561df2566be7 in st_join_table::sort_table (this=this@entry=0x7f05cc013fb8) at /data/bld/10.5-rel/sql/sql_select.cc:22214
      #13 0x0000561df2566c82 in join_init_read_record (tab=0x7f05cc013fb8) at /data/bld/10.5-rel/sql/sql_select.cc:22153
      #14 0x0000561df2552825 in sub_select (join=0x7f05cc012ad0, join_tab=0x7f05cc013fb8, end_of_records=<optimized out>) at /data/bld/10.5-rel/sql/sql_select.cc:21207
      #15 0x0000561df257e11c in do_select (procedure=0x0, join=0x7f05cc012ad0) at /data/bld/10.5-rel/sql/sql_select.cc:20727
      #16 JOIN::exec_inner (this=this@entry=0x7f05cc012ad0) at /data/bld/10.5-rel/sql/sql_select.cc:4622
      #17 0x0000561df257e400 in JOIN::exec (this=this@entry=0x7f05cc012ad0) at /data/bld/10.5-rel/sql/sql_select.cc:4402
      #18 0x0000561df257c3f6 in mysql_select (thd=thd@entry=0x7f05cc000c68, tables=0x7f05cc0118c0, fields=..., conds=0x0, og_num=1, order=0x0, group=<optimized out>, having=<optimized out>, proc_param=<optimized out>, select_options=<optimized out>, result=<optimized out>, unit=<optimized out>, select_lex=<optimized out>) at /data/bld/10.5-rel/sql/sql_select.cc:4879
      #19 0x0000561df257cd9f in handle_select (thd=thd@entry=0x7f05cc000c68, lex=lex@entry=0x7f05cc004b90, result=result@entry=0x7f05cc012aa8, setup_tables_done_option=setup_tables_done_option@entry=0) at /data/bld/10.5-rel/sql/sql_select.cc:450
      #20 0x0000561df250c9c0 in execute_sqlcom_select (thd=thd@entry=0x7f05cc000c68, all_tables=0x7f05cc0118c0) at /data/bld/10.5-rel/sql/sql_parse.cc:6343
      #21 0x0000561df251921a in mysql_execute_command (thd=thd@entry=0x7f05cc000c68) at /data/bld/10.5-rel/sql/sql_parse.cc:4020
      #22 0x0000561df251a7b6 in mysql_parse (thd=0x7f05cc000c68, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/bld/10.5-rel/sql/sql_parse.cc:8121
      #23 0x0000561df251c4c5 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f05cc000c68, packet=packet@entry=0x7f05cc0080f9 "", packet_length=packet_length@entry=58, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/bld/10.5-rel/sql/sql_parse.cc:1992
      #24 0x0000561df251e1c0 in do_command (thd=0x7f05cc000c68) at /data/bld/10.5-rel/sql/sql_parse.cc:1375
      #25 0x0000561df2611912 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x561df61f0008, put_in_cache=put_in_cache@entry=true) at /data/bld/10.5-rel/sql/sql_connect.cc:1416
      #26 0x0000561df2611b7d in handle_one_connection (arg=arg@entry=0x561df61f0008) at /data/bld/10.5-rel/sql/sql_connect.cc:1318
      #27 0x0000561df2946b9b in pfs_spawn_thread (arg=0x561df5e16058) at /data/bld/10.5-rel/storage/perfschema/pfs.cc:2201
      #28 0x00007f05e20a8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #29 0x00007f05e212861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Reproducible on 10.5+, also with other types, e.g. UUID.
      The test case is not applicable to 10.4 due to INET6 type.

      With another aggregate function instead of GROUP_CONCAT an unexpected ER_DUP_ENTRY occurs:

      CREATE TABLE t (a CHAR(36) NOT NULL, b INET6 NOT NULL, c DATETIME(6) NOT NULL);
      INSERT INTO t VALUES ('','::','2000-01-01'),('','::','1900-01-01');
      SELECT c + (b = a) AS f, COUNT(c) FROM t GROUP BY f;
       
      # Cleanup
      DROP TABLE t;
      

      10.5 dd62a285b88958dae9b9f3e49fdd0c55f6eced72

      mysqltest: At line 3: query 'SELECT c + (b = a) AS f, COUNT(c) FROM t GROUP BY f' failed: 1062: Duplicate entry '0.000000' for key 'group_key'
      

      Attachments

        Activity

          People

            bar Alexander Barkov
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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