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

Assertion `inited==NONE || (inited==RND && scan)' failed in handler::ha_rnd_init upon EXPLAIN INSERT IGNORE

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10
    • Fix Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9
    • Component/s: Server
    • Labels:
      None

      Description

      CREATE TABLE t (f INT) ENGINE=MyISAM;
      INSERT INTO t VALUES (1),(2); # Optional, fails either way
       
      EXPLAIN INSERT IGNORE INTO t SELECT * FROM (SELECT * FROM t UNION SELECT * FROM t) sq;
       
      # Cleanup
      DROP TABLE t;
      

      10.3 92a32809

      mysqld: /data/src/10.3/sql/handler.h:3058: int handler::ha_rnd_init(bool): Assertion `inited==NONE || (inited==RND && scan)' failed.
      220716 21:17:00 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f794fffc662 in __GI___assert_fail (assertion=0x557036551f98 "inited==NONE || (inited==RND && scan)", file=0x557036551edf "/data/src/10.3/sql/handler.h", line=3058, function=0x557036551fc0 "int handler::ha_rnd_init(bool)") at assert.c:101
      No locals.
      #8  0x00005570358dd940 in handler::ha_rnd_init (this=0x7f7938036fb8, scan=false) at /data/src/10.3/sql/handler.h:3058
              result = 32633
              _db_stack_frame_ = {func = 0x557036553b34 "select_insert::prepare", file = 0x557036552f60 "/data/src/10.3/sql/sql_insert.cc", level = 2147483660, line = -1, prev = 0x7f794a022840}
              __PRETTY_FUNCTION__ = "int handler::ha_rnd_init(bool)"
      #9  0x0000557035c4e26d in handler::ha_rnd_init_with_error (this=0x7f7938036fb8, scan=false) at /data/src/10.3/sql/handler.cc:3073
              error = 32633
      #10 0x00005570358e8c21 in select_insert::prepare (this=0x7f7938017260, values=@0x7f79380134d8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7f7938014098, last = 0x7f7938014098, elements = 1}, <No data fields>}, u=0x7f79380137f0) at /data/src/10.3/sql/sql_insert.cc:3845
              lex = 0x7f7938004b80
              res = 0
              map = 0
              lex_current_select_save = 0x7f79380133b0
              _db_stack_frame_ = {func = 0x55703657a9d1 "st_select_lex_unit::prepare", file = 0x55703657a600 "/data/src/10.3/sql/sql_union.cc", level = 2147483659, line = -1, prev = 0x7f794a0229a0}
              __PRETTY_FUNCTION__ = "virtual int select_insert::prepare(List<Item>&, SELECT_LEX_UNIT*)"
      #11 0x0000557035a24844 in st_select_lex_unit::prepare (this=0x7f79380137f0, derived_arg=0x7f79380157e8, sel_result=0x7f7938017260, additional_options=268435460) at /data/src/10.3/sql/sql_union.cc:883
              lex_select_save = 0x7f79380133b0
              sl = 0x7f79380133b0
              first_sl = 0x7f79380133b0
              is_recursive = false
              is_rec_result_table_created = false
              union_part_count = 0
              tmp_result = 0x5570364de834 <_db_pargs_+20>
              is_union_select = 127
              have_except = false
              have_intersect = false
              instantiate_tmp_table = false
              single_tvc = false
              _db_stack_frame_ = {func = 0x55703656b0bb "mysql_explain_union", file = 0x557036567580 "/data/src/10.3/sql/sql_select.cc", level = 2147483658, line = -1, prev = 0x7f794a022a70}
              __PRETTY_FUNCTION__ = "bool st_select_lex_unit::prepare(TABLE_LIST*, select_result*, ulong)"
      #12 0x00005570359affad in mysql_explain_union (thd=0x7f7938000d90, unit=0x7f79380137f0, result=0x7f7938017260) at /data/src/10.3/sql/sql_select.cc:26475
              save_options = 0
              _db_stack_frame_ = {func = 0x55703656b05b "select_describe", file = 0x557036567580 "/data/src/10.3/sql/sql_select.cc", level = 2147483657, line = -1, prev = 0x7f794a022af0}
              res = false
              first = 0x7f79380133b0
      #13 0x00005570359afdbe in select_describe (join=0x7f7938017310, need_tmp_table=false, need_order=false, distinct=false, message=0x0) at /data/src/10.3/sql/sql_select.cc:26444
              unit = 0x7f79380137f0
              thd = 0x7f7938000d90
              result = 0x7f7938017260
              _db_stack_frame_ = {func = 0x5570365682a1 "JOIN::exec_inner", file = 0x557036567580 "/data/src/10.3/sql/sql_select.cc", level = 2147483656, line = -1, prev = 0x7f794a022b50}
              __PRETTY_FUNCTION__ = "void select_describe(JOIN*, bool, bool, bool, const char*)"
      #14 0x000055703597408c in JOIN::exec_inner (this=0x7f7938017310) at /data/src/10.3/sql/sql_select.cc:4116
              columns_list = 0x7f7938005500
              _db_stack_frame_ = {func = 0x557036568356 "mysql_select", file = 0x557036567580 "/data/src/10.3/sql/sql_select.cc", level = 2147483655, line = -1, prev = 0x7f794a022c30}
              __PRETTY_FUNCTION__ = "void JOIN::exec_inner()"
      #15 0x00005570359735ec in JOIN::exec (this=0x7f7938017310) at /data/src/10.3/sql/sql_select.cc:3942
      No locals.
      #16 0x0000557035974915 in mysql_select (thd=0x7f7938000d90, tables=0x7f79380157e8, wild_num=1, fields=@0x7f7938005500: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7f79380133a0, last = 0x7f79380133a0, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184068, result=0x7f7938017260, unit=0x7f7938004c40, select_lex=0x7f79380053d8) at /data/src/10.3/sql/sql_select.cc:4351
              err = 0
              free_join = false
              _db_stack_frame_ = {func = 0x55703656b0bb "mysql_explain_union", file = 0x557036567580 "/data/src/10.3/sql/sql_select.cc", level = 2147483654, line = -1, prev = 0x7f794a022cf0}
              join = 0x7f7938017310
      #17 0x00005570359b00fb in mysql_explain_union (thd=0x7f7938000d90, unit=0x7f7938004c40, result=0x7f7938017260) at /data/src/10.3/sql/sql_select.cc:26486
              _db_stack_frame_ = {func = 0x55703655c288 "mysql_execute_command", file = 0x55703655b668 "/data/src/10.3/sql/sql_parse.cc", level = 2147483653, line = -1, prev = 0x7f794a022ed0}
              res = false
              first = 0x7f79380053d8
      #18 0x0000557035926121 in mysql_execute_command (thd=0x7f7938000d90) at /data/src/10.3/sql/sql_parse.cc:4618
              second_table = 0x7f79380157e8
              sel_result = 0x7f7938017260
              explain = true
              res = 0
              up_result = 0
              lex = 0x7f7938004b80
              select_lex = 0x7f79380053d8
              first_table = 0x7f7938012c28
              all_tables = 0x7f7938012c28
              unit = 0x7f7938004c40
              have_table_map_for_update = false
              rpl_filter = 0x388364de44a
              _db_stack_frame_ = {func = 0x55703655d560 "mysql_parse", file = 0x55703655b668 "/data/src/10.3/sql/sql_parse.cc", level = 2147483652, line = -1, prev = 0x7f794a023400}
              __PRETTY_FUNCTION__ = "int mysql_execute_command(THD*)"
              orig_binlog_format = BINLOG_FORMAT_MIXED
              orig_current_stmt_binlog_format = BINLOG_FORMAT_STMT
      #19 0x00005570359311aa in mysql_parse (thd=0x7f7938000d90, rawbuf=0x7f7938012ad8 "EXPLAIN INSERT IGNORE INTO t SELECT * FROM (SELECT * FROM t UNION SELECT * FROM t) sq", length=85, parser_state=0x7f794a0235b0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7870
              found_semicolon = 0x0
              error = 32633
              lex = 0x7f7938004b80
              err = false
              _db_stack_frame_ = {func = 0x55703655baf2 "dispatch_command", file = 0x55703655b668 "/data/src/10.3/sql/sql_parse.cc", level = 2147483651, line = -1, prev = 0x7f794a023590}
              __PRETTY_FUNCTION__ = "void mysql_parse(THD*, char*, uint, Parser_state*, bool, bool)"
      #20 0x000055703591d9df in dispatch_command (command=COM_QUERY, thd=0x7f7938000d90, packet=0x7f7938008f31 "EXPLAIN INSERT IGNORE INTO t SELECT * FROM (SELECT * FROM t UNION SELECT * FROM t) sq", packet_length=85, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1852
              packet_end = 0x7f7938012b2d ""
              parser_state = {m_lip = {lookahead_token = -1, lookahead_yylval = 0x0, m_thd = 0x7f7938000d90, m_ptr = 0x7f7938012b2e "\004", m_tok_start = 0x7f7938012b2e "\004", m_tok_end = 0x7f7938012b2e "\004", m_end_of_query = 0x7f7938012b2d "", m_tok_start_prev = 0x7f7938012b2d "", m_buf = 0x7f7938012ad8 "EXPLAIN INSERT IGNORE INTO t SELECT * FROM (SELECT * FROM t UNION SELECT * FROM t) sq", m_buf_length = 85, m_echo = true, m_echo_saved = 12, m_cpp_buf = 0x7f7938012b88 "EXPLAIN INSERT IGNORE INTO t SELECT * FROM (SELECT * FROM t UNION SELECT * FROM t) sq", m_cpp_ptr = 0x7f7938012bdd "", m_cpp_tok_start = 0x7f7938012bdd "", m_cpp_tok_start_prev = 0x7f7938012bdd "", m_cpp_tok_end = 0x7f7938012bdd "", m_body_utf8 = 0x0, m_body_utf8_ptr = 0x10000364b8c01 <error: Cannot access memory at address 0x10000364b8c01>, m_cpp_utf8_processed_ptr = 0x0, next_state = MY_LEX_END, found_semicolon = 0x0, ignore_space = false, stmt_prepare_mode = false, multi_statements = true, yylineno = 1, m_digest = 0x0, in_comment = NO_COMMENT, in_comment_saved = PRESERVE_COMMENT, m_cpp_text_start = 0x7f7938012bdb "sq", m_cpp_text_end = 0x7f7938012bdd "", m_underscore_cs = 0x0}, m_yacc = {yacc_yyss = 0x0, yacc_yyvs = 0x0, m_set_signal_info = {m_item = {0x0 <repeats 12 times>}}, m_lock_type = TL_READ_DEFAULT, m_mdl_type = MDL_SHARED_READ}, m_digest_psi = 0x7f7938004658}
              net = 0x7f7938001098
              error = false
              do_end_of_statement = true
              _db_stack_frame_ = {func = 0x55703655b87d "do_command", file = 0x55703655b668 "/data/src/10.3/sql/sql_parse.cc", level = 2147483650, line = -1, prev = 0x7f794a023df0}
              drop_more_results = false
              __PRETTY_FUNCTION__ = "bool dispatch_command(enum_server_command, THD*, char*, uint, bool, bool)"
              res = <optimized out>
      #21 0x000055703591c39d in do_command (thd=0x7f7938000d90) at /data/src/10.3/sql/sql_parse.cc:1398
              return_value = false
              packet = 0x7f7938008f30 "\003EXPLAIN INSERT IGNORE INTO t SELECT * FROM (SELECT * FROM t UNION SELECT * FROM t) sq"
              packet_length = 86
              net = 0x7f7938001098
              command = COM_QUERY
              _db_stack_frame_ = {func = 0x5570368dd850 "?func", file = 0x5570368dd856 "?file", level = 2147483649, line = -1, prev = 0x0}
              __PRETTY_FUNCTION__ = "bool do_command(THD*)"
      #22 0x0000557035a99956 in do_handle_one_connection (connect=0x557039686170) at /data/src/10.3/sql/sql_connect.cc:1403
              create_user = true
              thr_create_utime = 4417686414174
              thd = 0x7f7938000d90
      #23 0x0000557035a996c1 in handle_one_connection (arg=0x557039686170) at /data/src/10.3/sql/sql_connect.cc:1308
              connect = 0x557039686170
      #24 0x0000557036448dd0 in pfs_spawn_thread (arg=0x557039786a40) at /data/src/10.3/storage/perfschema/pfs.cc:1869
              typed_arg = 0x557039786a40
              user_arg = 0x557039686170
              user_start_routine = 0x557035a99691 <handle_one_connection(void*)>
              pfs = 0x7f794e2f36c0
              klass = 0x557039479280
      #25 0x00007f7950195ea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
              ret = <optimized out>
              pd = <optimized out>
              unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140158909433600, -2486699838689889949, 140727770967070, 140727770967071, 140158909431744, 311296, 2562517056001814883, 2562503766322721123}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
              not_first_call = 0
      #26 0x00007f79500c5def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Reproducible on 10.3-10.10 debug builds with at least MyISAM and Aria.
      Also reproducible with a view instead of a FROM subquery.
      Not reproducible with InnoDB.
      No obvious problems on a non-debug build, and here is the output it produces:

      EXPLAIN INSERT IGNORE INTO t SELECT * FROM (SELECT * FROM t UNION SELECT * FROM t) sq;
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
      1	PRIMARY	<derived2>	ALL	NULL	NULL	NULL	NULL	4	
      2	DERIVED	t	ALL	NULL	NULL	NULL	NULL	2	
      3	UNION	t	ALL	NULL	NULL	NULL	NULL	2	
      NULL	UNION RESULT	<union2,3>	ALL	NULL	NULL	NULL	NULL	NULL	
      

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:

                Git Integration

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