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

Assertion `thd->lex == sp_instr_lex' failed in LEX* sp_lex_instr::parse_expr(THD*, sp_head*, LEX*)

    XMLWordPrintable

Details

    Description

      DELIMITER $$
      CREATE OR REPLACE PROCEDURE p1()
        BEGIN
          DECLARE c CURSOR FOR SELECT * FROM foo;
          OPEN c;
          CLOSE c;
        END;
      $$
       
      DELIMITER ;
      CALL p1;
      create table foo (id int);
      CALL p1;
      CALL p1;
      

      Leads to

      11.2.0 8a0eabc65d2ae06fd66542160ae3bbc7b475371c (Debug)

      mariadbd: /test/mtest/MDEV-5816/11.2_dbg/sql/sp_instr.cc:742: LEX* sp_lex_instr::parse_expr(THD*, sp_head*, LEX*): Assertion `thd->lex == sp_instr_lex' failed.
      

      11.2.0 8a0eabc65d2ae06fd66542160ae3bbc7b475371c (Debug)

      Core was generated by `/test/mtest/MDEV-5816/MD060723-mariadb-11.2.0-linux-x86_64-dbg/bin/mariadbd --n'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      [Current thread is 1 (Thread 0x150da0054700 (LWP 1745812))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x0000150db820a859 in __GI_abort () at abort.c:79
      #2  0x0000150db820a729 in __assert_fail_base (fmt=0x150db83a0588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x56391340a5f0 "thd->lex == sp_instr_lex", file=0x56391340a6a8 "/test/mtest/MDEV-5816/11.2_dbg/sql/sp_instr.cc", line=742, function=<optimized out>) at assert.c:92
      #3  0x0000150db821bfd6 in __GI___assert_fail (assertion=assertion@entry=0x56391340a5f0 "thd->lex == sp_instr_lex", file=file@entry=0x56391340a6a8 "/test/mtest/MDEV-5816/11.2_dbg/sql/sp_instr.cc", line=line@entry=742, function=function@entry=0x56391340ab28 "LEX* sp_lex_instr::parse_expr(THD*, sp_head*, LEX*)") at assert.c:101
      #4  0x00005639129db9ae in sp_lex_instr::parse_expr (this=this@entry=0x150d4001e268, thd=thd@entry=0x150d40000d48, sp=0x150d4001c768, sp_instr_lex=0x150d4001e700) at /test/mtest/MDEV-5816/11.2_dbg/sql/sp_instr.cc:742
      #5  0x00005639129dbcc0 in sp_lex_keeper::validate_lex_and_exec_core (this=this@entry=0x150d4001e2a0, thd=thd@entry=0x150d40000d48, nextp=nextp@entry=0x150da0052334, open_tables=open_tables@entry=false, instr=instr@entry=0x150d4001e268) at /test/mtest/MDEV-5816/11.2_dbg/sql/sp_instr.cc:448
      #6  0x00005639129dc002 in sp_lex_keeper::cursor_reset_lex_and_exec_core (this=this@entry=0x150d4001e2a0, thd=thd@entry=0x150d40000d48, nextp=nextp@entry=0x150da0052334, open_tables=open_tables@entry=false, instr=instr@entry=0x150d4001e268) at /test/mtest/MDEV-5816/11.2_dbg/sql/sp_instr.cc:530
      #7  0x00005639129dc0b3 in sp_instr_copen::execute (this=0x150d4001e368, thd=0x150d40000d48, nextp=0x150da0052334) at /test/mtest/MDEV-5816/11.2_dbg/sql/sp_instr.cc:1729
      #8  0x000056391270a544 in sp_head::execute (this=this@entry=0x150d4001c768, thd=thd@entry=0x150d40000d48, merge_da_on_success=merge_da_on_success@entry=true) at /test/mtest/MDEV-5816/11.2_dbg/sql/sp_head.cc:1280
      #9  0x000056391270c8cd in sp_head::execute_procedure (this=0x150d4001c768, thd=thd@entry=0x150d40000d48, args=0x150d40005ee8) at /test/mtest/MDEV-5816/11.2_dbg/sql/sp_head.cc:2267
      #10 0x00005639127c52fb in do_execute_sp (thd=thd@entry=0x150d40000d48, sp=sp@entry=0x150d4001c768) at /test/mtest/MDEV-5816/11.2_dbg/sql/sql_parse.cc:3024
      #11 0x00005639127ca84e in Sql_cmd_call::execute (this=0x150d40013260, thd=0x150d40000d48) at /test/mtest/MDEV-5816/11.2_dbg/sql/sql_parse.cc:3269
      #12 0x00005639127d69d2 in mysql_execute_command (thd=thd@entry=0x150d40000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/mtest/MDEV-5816/11.2_dbg/sql/sql_parse.cc:5766
      #13 0x00005639127bff0b in mysql_parse (thd=thd@entry=0x150d40000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x150da0053300) at /test/mtest/MDEV-5816/11.2_dbg/sql/sql_parse.cc:7769
      #14 0x00005639127cd5d6 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x150d40000d48, packet=packet@entry=0x150d4000ae89 "CALL p1", packet_length=packet_length@entry=7, blocking=blocking@entry=true) at /test/mtest/MDEV-5816/11.2_dbg/sql/sql_class.h:1371
      #15 0x00005639127cfaad in do_command (thd=0x150d40000d48, blocking=blocking@entry=true) at /test/mtest/MDEV-5816/11.2_dbg/sql/sql_parse.cc:1405
      #16 0x00005639129363df in do_handle_one_connection (connect=<optimized out>, connect@entry=0x563914fb3238, put_in_cache=put_in_cache@entry=true) at /test/mtest/MDEV-5816/11.2_dbg/sql/sql_connect.cc:1416
      #17 0x00005639129368ae in handle_one_connection (arg=0x563914fb3238) at /test/mtest/MDEV-5816/11.2_dbg/sql/sql_connect.cc:1318
      #18 0x0000150db871b609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #19 0x0000150db8307133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Attachments

        Issue Links

          Activity

            People

              shulga Dmitry Shulga
              ramesh Ramesh Sivaraman
              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.