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

SIGSEGV in sp_process_definer on second execution of trigger using a prepared statement.

    XMLWordPrintable

Details

    Description

      CREATE TABLE t(a INT) ENGINE=INNODB;
      PREPARE s FROM 'CREATE TRIGGER tr AFTER DELETE ON t FOR EACH ROW SET @a=1';
      EXECUTE s;
      EXECUTE s;
      

      Leads to

      11.0.1 6252a281b5020d28685777c11ee27688a9db3d66 (Optimized)

      Core was generated by `/test/GAL_MD080223-mariadb-11.0.1-linux-x86_64-opt/bin/mysqld --defaults-file=/'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
      [Current thread is 1 (Thread 0x148718d06700 (LWP 3792904))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
      #1  0x0000562b327e8baf in my_write_core (sig=sig@entry=11) at /test/11.0_opt/mysys/stacktrace.c:424
      #2  0x0000562b3234b4f0 in handle_fatal_signal (sig=11) at /test/11.0_opt/sql/signal_handler.cc:357
      #3  <signal handler called>
      #4  __strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:101
      #5  0x0000562b3210a225 in sp_process_definer (thd=thd@entry=0x1486d4000c58) at /test/11.0_opt/sql/sql_parse.cc:2817
      #6  0x0000562b321c861d in Table_triggers_list::create_trigger (this=0x1486d4032880, thd=0x1486d4000c58, tables=0x1486d40232d8, stmt_query=0x148718d03f50, ddl_log_state=0x148718d03f70, ddl_log_state_tmp_file=0x148718d03f90) at /test/11.0_opt/sql/sql_trigger.cc:923
      #7  0x0000562b321cb3ef in mysql_create_or_drop_trigger (thd=thd@entry=0x1486d4000c58, tables=0x1486d40232d8, create=create@entry=true) at /test/11.0_opt/sql/sql_trigger.cc:661
      #8  0x0000562b3210d905 in mysql_execute_command (thd=0x1486d4000c58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=true) at /test/11.0_opt/sql/sql_parse.cc:5829
      #9  0x0000562b3212dd1a in Prepared_statement::execute (this=0x1486d4020938, expanded_query=<optimized out>, open_cursor=false) at /test/11.0_opt/sql/sql_prepare.cc:5225
      #10 0x0000562b3212df41 in Prepared_statement::execute_loop (packet=<optimized out>, packet_end=<optimized out>, open_cursor=<optimized out>, expanded_query=0x148718d04de0, this=0x1486d4020938) at /test/11.0_opt/sql/sql_prepare.cc:4648
      #11 Prepared_statement::execute_loop (this=0x1486d4020938, expanded_query=0x148718d04de0, open_cursor=<optimized out>, packet=<optimized out>, packet_end=<optimized out>) at /test/11.0_opt/sql/sql_prepare.cc:4597
      #12 0x0000562b3212e26b in mysql_sql_stmt_execute (thd=thd@entry=0x1486d4000c58) at /test/11.0_opt/sql/sql_prepare.cc:3690
      #13 0x0000562b3210e0fd in mysql_execute_command (thd=0x1486d4000c58, is_called_from_prepared_stmt=<optimized out>) at /test/11.0_opt/sql/sql_parse.cc:3965
      #14 0x0000562b320fbf76 in mysql_parse (rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>, thd=0x1486d4000c58) at /test/11.0_opt/sql/sql_parse.cc:8000
      #15 mysql_parse (thd=0x1486d4000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /test/11.0_opt/sql/sql_parse.cc:7922
      #16 0x0000562b320fb821 in wsrep_mysql_parse (thd=0x1486d4000c58, rawbuf=0x1486d4010760 "EXECUTE s", length=9, parser_state=0x148718d05400) at /test/11.0_opt/sql/sql_parse.cc:7811
      #17 0x0000562b32108edd in dispatch_command (command=COM_QUERY, thd=0x1486d4000c58, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /test/11.0_opt/sql/sql_parse.cc:1977
      #18 0x0000562b32109b4e in do_command (thd=0x1486d4000c58, blocking=blocking@entry=true) at /test/11.0_opt/sql/sql_parse.cc:1407
      #19 0x0000562b322242b7 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x562b353e4a48, put_in_cache=put_in_cache@entry=true) at /test/11.0_opt/sql/sql_connect.cc:1416
      #20 0x0000562b3222459d in handle_one_connection (arg=0x562b353e4a48) at /test/11.0_opt/sql/sql_connect.cc:1318
      #21 0x000014874f79d609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #22 0x000014874f389133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.6.12 (dbg),10.6.12 (opt), 10.7.8 (dbg), 10.7.8 (opt), 10.8.7 (dbg), 10.8.7 (opt), 10.9.5 (dbg), 10.9.5 (opt), 10.10.3 (dbg), 10.10.3 (opt), 10.11.2 (dbg), 10.11.2 (opt), 11.0.1 (dbg), 11.0.1 (opt)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.3.38 (dbg), 10.3.38 (opt), 10.4.28 (dbg), 10.4.28 (opt), 10.5.19 (dbg), 10.5.19 (opt)

      Attachments

        Activity

          People

            janlindstrom Jan Lindström
            ramesh Ramesh Sivaraman
            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.