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

Assertion `strncmp(str->ptr() + str->length() - 5, "cast(", 5) == 0' failed in Item_dyncol_get::print

    XMLWordPrintable

    Details

      Description

      ATTENTION: The test case is for reproducing purposes only, don't put it into a regression suite! Create a proper one instead, with debug sync if necessary.

      The test case is non-deterministic. It has a loop to avoid running with --repeat. With the current 10K loops it either fails or passes in a few seconds. If it doesn't fail for you, try to increase the number of loops.

      CREATE TABLE t1 (a INT) ENGINE=InnoDB;
       
      --connect (con1,localhost,root,,test)
      --let $conid= `select connection_id()`
      --delimiter $
      --send
        BEGIN NOT ATOMIC
          DECLARE CONTINUE HANDLER FOR 1054 BEGIN END;
          LOOP
            SELECT * FROM t1 WHERE x = 1;
          END LOOP;
        END $
      --delimiter ;
       
      --connection default
      --let $run= 10000
      while ($run)
      {
        SELECT * FROM t1 WHERE COLUMN_GET( COLUMN_CREATE( 1, 2 ), 3 AS INT );
        --dec $run
      }
       
      # Cleanup
      --eval KILL $conid
      DROP TABLE t1;
      

      10.2 b0df247d

      mysqld: /data/src/10.2/sql/item_strfunc.cc:5194: virtual void Item_dyncol_get::print(String*, enum_query_type): Assertion `strncmp(str->ptr() + str->length() - 5, "cast(", 5) == 0' failed.
      200723 19:34:18 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f7e56e48f12 in __GI___assert_fail (assertion=0x55dcf59f0a40 "strncmp(str->ptr() + str->length() - 5, \"cast(\", 5) == 0", file=0x55dcf59f0520 "/data/src/10.2/sql/item_strfunc.cc", line=5194, function=0x55dcf59f2200 <Item_dyncol_get::print(String*, enum_query_type)::__PRETTY_FUNCTION__> "virtual void Item_dyncol_get::print(String*, enum_query_type)") at assert.c:101
      #8  0x000055dcf51ad52f in Item_dyncol_get::print (this=0x7f7e40013030, str=0x7f7e5117b280, query_type=QT_EXPLAIN) at /data/src/10.2/sql/item_strfunc.cc:5194
      #9  0x000055dcf516d719 in Item_func_signed::print (this=0x7f7e400130f0, str=0x7f7e5117b280, query_type=QT_EXPLAIN) at /data/src/10.2/sql/item_func.cc:1079
      #10 0x000055dcf51272d3 in dbug_print_item (item=0x7f7e400130f0) at /data/src/10.2/sql/item.cc:10835
      #11 0x000055dcf4eb93cd in JOIN::prepare (this=0x7f7e40013298, tables_init=0x7f7e400126a0, wild_num=1, conds_init=0x7f7e400130f0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7f7e40004e28, unit_arg=0x7f7e400046e8) at /data/src/10.2/sql/sql_select.cc:711
      #12 0x000055dcf4ec437c in mysql_select (thd=0x7f7e40000af0, tables=0x7f7e400126a0, wild_num=1, fields=..., conds=0x7f7e400130f0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f7e40013278, unit=0x7f7e400046e8, select_lex=0x7f7e40004e28) at /data/src/10.2/sql/sql_select.cc:3811
      #13 0x000055dcf4eb85ec in handle_select (thd=0x7f7e40000af0, lex=0x7f7e40004628, result=0x7f7e40013278, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:361
      #14 0x000055dcf4e84036 in execute_sqlcom_select (thd=0x7f7e40000af0, all_tables=0x7f7e400126a0) at /data/src/10.2/sql/sql_parse.cc:6218
      #15 0x000055dcf4e7a8b7 in mysql_execute_command (thd=0x7f7e40000af0) at /data/src/10.2/sql/sql_parse.cc:3524
      #16 0x000055dcf4e87d6d in mysql_parse (thd=0x7f7e40000af0, rawbuf=0x7f7e40012458 "SELECT * FROM t1 WHERE COLUMN_GET( COLUMN_CREATE( 1, 2 ), 3 AS INT )", length=68, parser_state=0x7f7e5117c610, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7733
      #17 0x000055dcf4e76099 in dispatch_command (command=COM_QUERY, thd=0x7f7e40000af0, packet=0x7f7e4008d451 "SELECT * FROM t1 WHERE COLUMN_GET( COLUMN_CREATE( 1, 2 ), 3 AS INT )", packet_length=68, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1824
      #18 0x000055dcf4e74b14 in do_command (thd=0x7f7e40000af0) at /data/src/10.2/sql/sql_parse.cc:1377
      #19 0x000055dcf4fcaaef in do_handle_one_connection (connect=0x55dcf7f77ca0) at /data/src/10.2/sql/sql_connect.cc:1336
      #20 0x000055dcf4fca85a in handle_one_connection (arg=0x55dcf7f77ca0) at /data/src/10.2/sql/sql_connect.cc:1241
      #21 0x000055dcf57e0f12 in pfs_spawn_thread (arg=0x55dcf7ec4a70) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #22 0x00007f7e58dd14a4 in start_thread (arg=0x7f7e5117d700) at pthread_create.c:456
      #23 0x00007f7e56f05d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      The table engine seems unimportant, reproducible with at least MyISAM, InnoDB, Aria.
      No obvious problem on a non-debug build.

        Attachments

          Activity

            People

            Assignee:
            sanja Oleksandr Byelkin
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Git Integration