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

Assertion `! thd->in_sub_stmt' failed in sp_instr_stmt::exec_core

    XMLWordPrintable

    Details

      Description

      USE test;
      CREATE TABLE t(a INT) PARTITION BY KEY (a);
      CREATE TRIGGER tr AFTER UPDATE ON t FOR EACH ROW DROP SERVER IF EXISTS s;
      INSERT INTO t VALUES(0);
      UPDATE t SET a = 1;
      

      Leads to:

      10.5.4 6877ef9a7c9c7ee55d67e4baaf4e8f7b874c9f89

      mysqld: /test/10.5_dbg/sql/sql_parse.cc:3743: int mysql_execute_command(THD*): Assertion `! thd->in_sub_stmt' failed.
      

      10.5.4 6877ef9a7c9c7ee55d67e4baaf4e8f7b874c9f89

      Core was generated by `/test/MD060620-mariadb-10.5.4-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      [Current thread is 1 (Thread 0x14b6ac10c700 (LWP 2140268))]
      (gdb) bt
      (gdb) (gdb) #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      #1  0x000055d427f3600d in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
      #2  0x000055d4276dfbbc in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:330
      #3  <signal handler called>
      #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
      #5  0x000014b6b4a41801 in __GI_abort () at abort.c:79
      #6  0x000014b6b4a3139a in __assert_fail_base (fmt=0x14b6b4bb87d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55d4280b6820 "! thd->in_sub_stmt", file=file@entry=0x55d4280b5708 "/test/10.5_dbg/sql/sql_parse.cc", line=line@entry=3743, function=function@entry=0x55d4280b8da0 <mysql_execute_command(THD*)::__PRETTY_FUNCTION__> "int mysql_execute_command(THD*)") at assert.c:92
      #7  0x000014b6b4a31412 in __GI___assert_fail (assertion=assertion@entry=0x55d4280b6820 "! thd->in_sub_stmt", file=file@entry=0x55d4280b5708 "/test/10.5_dbg/sql/sql_parse.cc", line=line@entry=3743, function=function@entry=0x55d4280b8da0 <mysql_execute_command(THD*)::__PRETTY_FUNCTION__> "int mysql_execute_command(THD*)") at assert.c:101
      #8  0x000055d427434e2e in mysql_execute_command (thd=0x14b693015088) at /test/10.5_dbg/sql/sql_parse.cc:3743
      #9  0x000055d4273689a7 in sp_instr_stmt::exec_core (this=0x14b6930fbdd0, thd=<optimized out>, nextp=0x14b6ac109ec4) at /test/10.5_dbg/sql/sp_head.cc:3761
      #10 0x000055d427374577 in sp_lex_keeper::reset_lex_and_exec_core (this=this@entry=0x14b6930fbe18, thd=thd@entry=0x14b693015088, nextp=nextp@entry=0x14b6ac109ec4, open_tables=open_tables@entry=false, instr=instr@entry=0x14b6930fbdd0) at /test/10.5_dbg/sql/sp_head.cc:3488
      #11 0x000055d42737511d in sp_instr_stmt::execute (this=0x14b6930fbdd0, thd=0x14b693015088, nextp=0x14b6ac109ec4) at /test/10.5_dbg/sql/sp_head.cc:3667
      #12 0x000055d42736dfee in sp_head::execute (this=this@entry=0x14b6930fb0a0, thd=thd@entry=0x14b693015088, merge_da_on_success=merge_da_on_success@entry=false) at /test/10.5_dbg/sql/sp_head.cc:1432
      #13 0x000055d42736f200 in sp_head::execute_trigger (this=0x14b6930fb0a0, thd=thd@entry=0x14b693015088, db_name=<optimized out>, table_name=0x14b6930e8a20, grant_info=grant_info@entry=0x14b693047130) at /test/10.5_dbg/sql/sp_head.cc:1909
      #14 0x000055d427514d06 in Table_triggers_list::process_triggers (this=0x14b693045530, thd=thd@entry=0x14b693015088, event=event@entry=TRG_EVENT_UPDATE, time_type=time_type@entry=TRG_ACTION_AFTER, old_row_is_record1=old_row_is_record1@entry=true) at /test/10.5_dbg/sql/sql_trigger.cc:2227
      #15 0x000055d42752cedf in mysql_update (thd=thd@entry=0x14b693015088, table_list=<optimized out>, fields=@0x14b6930199f8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14b693074a50, last = 0x14b693074a50, elements = 1}, <No data fields>}, values=@0x14b693019f70: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14b693074a60, last = 0x14b693074a60, elements = 1}, <No data fields>}, conds=<optimized out>, order_num=<optimized out>, order=<optimized out>, limit=18446744073709551615, ignore=<optimized out>, found_return=<optimized out>, updated_return=<optimized out>) at /test/10.5_dbg/sql/sql_update.cc:1116
      #16 0x000055d4274367e6 in mysql_execute_command (thd=thd@entry=0x14b693015088) at /test/10.5_dbg/sql/sql_parse.cc:4401
      #17 0x000055d427442322 in mysql_parse (thd=thd@entry=0x14b693015088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14b6ac10b350, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7992
      #18 0x000055d42742ee1c in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14b693015088, packet=packet@entry=0x14b693067089 "UPDATE t SET a = 1", packet_length=packet_length@entry=18, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1874
      #19 0x000055d42742d5f6 in do_command (thd=0x14b693015088) at /test/10.5_dbg/sql/sql_parse.cc:1355
      #20 0x000055d4275889f9 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x14b696115808, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1411
      #21 0x000055d427589115 in handle_one_connection (arg=arg@entry=0x14b696115808) at /test/10.5_dbg/sql/sql_connect.cc:1313
      #22 0x000055d4279e8104 in pfs_spawn_thread (arg=0x14b6b3445888) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
      #23 0x000014b6b57246db in start_thread (arg=0x14b6ac10c700) at pthread_create.c:463
      #24 0x000014b6b4b2288f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.1.46 (dbg), 10.2.33 (dbg), 10.3.24 (dbg), 10.4.14 (dbg), 10.5.4 (dbg)
      MySQL: 5.5.62 (dbg), 5.6.47 (dbg)

      Bug confirmed not present in:
      MariaDB: 10.1.46 (opt), 10.2.33 (opt), 10.3.24 (opt), 10.4.14 (opt), 10.5.4 (opt)
      MySQL: 5.5.62 (opt), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

        Attachments

          Activity

            People

            Assignee:
            sanja Oleksandr Byelkin
            Reporter:
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Git Integration