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

Assertion `0' failed in on 2nd SP call when in_to_exists=off

    XMLWordPrintable

Details

    Description

      Very closely related it seems to MDEV-23828, however in_to_exists is off here (note the comment in that bug). MDEV-23919 Also looks related, but that bug is only present in older versions.

      CREATE PROCEDURE p () SELECT * FROM t WHERE (c) IN (SELECT c FROM t);
      SET @@optimizer_switch='semijoin=off,in_to_exists=off';
      CREATE TABLE t (c INT) ENGINE=InnoDB;
      CALL p ();
      CREATE TEMPORARY TABLE t (c BLOB) ENGINE=InnoDB;
      CALL p ();
      

      Leads to:

      11.0.1 f2dc4d4c10ac36a73b5c1eb765352d3aee808d66 (Debug)

      mariadbd: /test/11.0_dbg/sql/item_subselect.cc:5266: bool subselect_hash_sj_engine::init(List<Item>*, uint): Assertion `0' failed.
      

      11.0.1 f2dc4d4c10ac36a73b5c1eb765352d3aee808d66 (Debug)

      Core was generated by `/test/MD180223-mariadb-11.0.1-linux-x86_64-dbg/bin/mariadbd --no-defaults --cor'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=22466505619008)
          at ./nptl/pthread_kill.c:44
      [Current thread is 1 (Thread 0x146ee4163640 (LWP 2152997))]
      (gdb) bt
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=22466505619008) at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=22466505619008) at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=22466505619008, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
      #3  0x0000146f0a009476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
      #4  0x0000146f09fef7f3 in __GI_abort () at ./stdlib/abort.c:79
      #5  0x0000146f09fef71b in __assert_fail_base (fmt=0x146f0a1a4150 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x556b9d5c0ae1 "0", file=0x556b9d5ba1e8 "/test/11.0_dbg/sql/item_subselect.cc", line=5266, function=<optimized out>) at ./assert/assert.c:92
      #6  0x0000146f0a000e96 in __GI___assert_fail (assertion=0x556b9d5c0ae1 "0", file=0x556b9d5ba1e8 "/test/11.0_dbg/sql/item_subselect.cc", line=5266, function=0x556b9d5bb658 "bool subselect_hash_sj_engine::init(List<Item>*, uint)") at ./assert/assert.c:101
      #7  0x0000556b9cce1bcf in subselect_hash_sj_engine::init (this=this@entry=0x146e10098d38, tmp_columns=0x146e10045118, subquery_id=2) at /test/11.0_dbg/sql/item_subselect.cc:5266
      #8  0x0000556b9cce1f58 in Item_in_subselect::setup_mat_engine (this=this@entry=0x146e10044a98) at /test/11.0_dbg/sql/item_subselect.cc:3667
      #9  0x0000556b9cac03ec in JOIN::choose_subquery_plan (this=this@entry=0x146e100977c0, join_tables=1) at /test/11.0_dbg/sql/opt_subselect.cc:6835
      #10 0x0000556b9c98c214 in make_join_statistics (join=join@entry=0x146e100977c0, tables_list=@0x146e10045078: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x146e10097dc0, last = 0x146e10097dc0, elements = 1}, <No data fields>}, keyuse_array=keyuse_array@entry=0x146e10097b28) at /test/11.0_dbg/sql/sql_select.cc:6110
      #11 0x0000556b9c9934b9 in JOIN::optimize_inner (this=this@entry=0x146e100977c0) at /test/11.0_dbg/sql/sql_select.cc:2569
      #12 0x0000556b9c9939bc in JOIN::optimize (this=this@entry=0x146e100977c0) at /test/11.0_dbg/sql/sql_select.cc:1897
      #13 0x0000556b9c8d9bf2 in st_select_lex::optimize_unflattened_subqueries (this=0x146e10041d58, const_only=const_only@entry=false) at /test/11.0_dbg/sql/sql_lex.cc:4905
      #14 0x0000556b9cabdbab in JOIN::optimize_unflattened_subqueries (this=this@entry=0x146e10096fe8) at /test/11.0_dbg/sql/opt_subselect.cc:5794
      #15 0x0000556b9c991085 in JOIN::optimize_stage2 (this=this@entry=0x146e10096fe8) at /test/11.0_dbg/sql/sql_select.cc:3174
      #16 0x0000556b9c99350f in JOIN::optimize_inner (this=this@entry=0x146e10096fe8) at /test/11.0_dbg/sql/sql_select.cc:2595
      #17 0x0000556b9c9939bc in JOIN::optimize (this=this@entry=0x146e10096fe8) at /test/11.0_dbg/sql/sql_select.cc:1897
      #18 0x0000556b9c993ac5 in mysql_select (thd=thd@entry=0x146e10000d58, tables=0x146e10042370, fields=@0x146e10042010: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x146e10042328, last = 0x146e10042328, elements = 1}, <No data fields>}, conds=0x146e100928c0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2164526848, result=0x146e10096fc0, unit=0x146e10042f18, select_lex=0x146e10041d58) at /test/11.0_dbg/sql/sql_select.cc:5132
      #19 0x0000556b9c99428b in handle_select (thd=thd@entry=0x146e10000d58, lex=lex@entry=0x146e10042e40, result=result@entry=0x146e10096fc0, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/11.0_dbg/sql/sql_select.cc:608
      #20 0x0000556b9c8f9e8d in execute_sqlcom_select (thd=thd@entry=0x146e10000d58, all_tables=0x146e10042370) at /test/11.0_dbg/sql/sql_parse.cc:6267
      #21 0x0000556b9c9054af in mysql_execute_command (thd=0x146e10000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/11.0_dbg/sql/sql_parse.cc:3949
      #22 0x0000556b9c8433c2 in sp_instr_stmt::exec_core (this=0x146e10044c98, thd=<optimized out>, nextp=0x146ee4161374) at /test/11.0_dbg/sql/sp_head.cc:3857
      #23 0x0000556b9c8505d4 in sp_lex_keeper::reset_lex_and_exec_core (this=this@entry=0x146e10044ce0, thd=thd@entry=0x146e10000d58, nextp=nextp@entry=0x146ee4161374, open_tables=open_tables@entry=false, instr=instr@entry=0x146e10044c98) at /test/11.0_dbg/sql/sp_head.cc:3582
      #24 0x0000556b9c850d43 in sp_instr_stmt::execute (this=0x146e10044c98, thd=0x146e10000d58, nextp=0x146ee4161374) at /test/11.0_dbg/sql/sp_head.cc:3763
      #25 0x0000556b9c849338 in sp_head::execute (this=this@entry=0x146e10040e20, thd=thd@entry=0x146e10000d58, merge_da_on_success=merge_da_on_success@entry=true) at /test/11.0_dbg/sql/sp_head.cc:1459
      #26 0x0000556b9c84b5da in sp_head::execute_procedure (this=0x146e10040e20, thd=thd@entry=0x146e10000d58, args=0x146e10005ed8) at /test/11.0_dbg/sql/sp_head.cc:2446
      #27 0x0000556b9c8f9473 in do_execute_sp (thd=thd@entry=0x146e10000d58, sp=sp@entry=0x146e10040e20) at /test/11.0_dbg/sql/sql_parse.cc:3026
      #28 0x0000556b9c8fdc00 in Sql_cmd_call::execute (this=0x146e100131e8, thd=0x146e10000d58) at /test/11.0_dbg/sql/sql_parse.cc:3271
      #29 0x0000556b9c90adb6 in mysql_execute_command (thd=thd@entry=0x146e10000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/11.0_dbg/sql/sql_parse.cc:6003
      #30 0x0000556b9c90c7cf in mysql_parse (thd=thd@entry=0x146e10000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x146ee41622c0) at /test/11.0_dbg/sql/sql_parse.cc:8002
      #31 0x0000556b9c90e963 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x146e10000d58, packet=packet@entry=0x146e1000ae19 "CALL p ()", packet_length=packet_length@entry=9, blocking=blocking@entry=true) at /test/11.0_dbg/sql/sql_class.h:242
      #32 0x0000556b9c9107bc in do_command (thd=0x146e10000d58, blocking=blocking@entry=true) at /test/11.0_dbg/sql/sql_parse.cc:1407
      #33 0x0000556b9ca616e2 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x556ba0253528, put_in_cache=put_in_cache@entry=true) at /test/11.0_dbg/sql/sql_connect.cc:1416
      #34 0x0000556b9ca61941 in handle_one_connection (arg=0x556ba0253528) at /test/11.0_dbg/sql/sql_connect.cc:1318
      #35 0x0000146f0a05bb43 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #36 0x0000146f0a0eda00 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Bug confirmed present in:
      MariaDB: 10.3.38 (dbg), 10.4.29 (dbg), 10.5.20 (dbg), 10.6.13 (dbg), 10.7.8 (dbg), 10.8.8 (dbg), 10.9.6 (dbg), 10.10.4 (dbg), 10.11.2 (dbg), 11.0.1 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.3.38 (opt), 10.4.29 (opt), 10.5.20 (opt), 10.6.13 (opt), 10.7.8 (opt), 10.8.8 (opt), 10.9.6 (opt), 10.10.4 (opt), 10.11.2 (opt), 11.0.1 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.40 (dbg), 5.7.40 (opt), 8.0.31 (dbg), 8.0.31 (opt)

      Attachments

        Issue Links

          Activity

            People

              shulga Dmitry Shulga
              Roel Roel Van de Paar
              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.