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

SIGSEGV in sp_head::bind_input_param when trigger passes NEW/OLD row as OUT parameter to CALL

    XMLWordPrintable

Details

    • Bug
    • Status: In Review (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 13.2
    • 13.2
    • Triggers
    • None
    • Not for Release Notes
    • Q1/2027 Server Development

    Description

      CREATE TABLE t (a INT);
      CREATE PROCEDURE p(OUT r INT) BEGIN END;
      CREATE TRIGGER tr BEFORE INSERT ON t FOR EACH ROW CALL p(NEW);
      INSERT INTO t VALUES (1);
      

      Leads to

      MDEV-34723 CS 13.2.0 89cc41d5c46e1e322148d861e2b13527a7dd6306 (Optimized, Clang 18.1.3-11) Build 22/10/2026

      Core was generated by `/test/mtest/MDEV-34723/MD221026-mariadb-13.2.0-linux-x86_64-opt/bin/mariadbd --'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  sp_head::bind_input_param (this=this@entry=0x77b6880457d0, thd=thd@entry=0x77b688000c70, arg_item=0x77b688040b00, arg_no=arg_no@entry=0, octx=octx@entry=0x77b688078440, nctx=nctx@entry=0x77b68807a630, is_function=<optimized out>)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sp_head.cc:2569
       
      [Current thread is 1 (LWP 2274009)]
      (gdb) bt
      #0  sp_head::bind_input_param (this=this@entry=0x77b6880457d0, thd=thd@entry=0x77b688000c70, arg_item=0x77b688040b00, arg_no=arg_no@entry=0, octx=octx@entry=0x77b688078440, nctx=nctx@entry=0x77b68807a630, is_function=<optimized out>)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sp_head.cc:2569
      #1  0x000057a072005d20 in sp_head::execute_procedure (this=0x77b6880457d0, thd=0x77b688000c70, args=0x77b688042830)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sp_head.cc:2338
      #2  0x000057a0720b1cd4 in do_execute_sp (thd=thd@entry=0x77b688000c70, sp=0x0, sp@entry=0x77b6880457d0)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_parse.cc:3099
      #3  0x000057a0720b1959 in Sql_cmd_call::execute (this=0x77b688040ab0, thd=0x77b688000c70)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_parse.cc:3366
      #4  0x000057a0720b3465 in mysql_execute_command (thd=0x77b688000c70, is_called_from_prepared_stmt=false)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_parse.cc:5947
      #5  0x000057a07225cfb7 in sp_instr_stmt::exec_core (this=0x77b688040c90, thd=0x0, nextp=0x0)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sp_instr.cc:1306
      #6  0x000057a07225b38a in sp_lex_keeper::reset_lex_and_exec_core (this=this@entry=0x77b688040cc8, thd=thd@entry=0x77b688000c70, nextp=nextp@entry=0x7fb794521554, open_tables=false, instr=instr@entry=0x77b688040c90, rerun_the_same_instr=<optimized out>)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sp_instr.cc:420
      #7  0x000057a07225b9b6 in sp_lex_keeper::validate_lex_and_exec_core (this=this@entry=0x77b688040cc8, thd=thd@entry=0x77b688000c70, nextp=nextp@entry=0x7fb794521554, open_tables=<optimized out>, instr=instr@entry=0x77b688040c90)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sp_instr.cc:624
      #8  0x000057a07225c9ea in sp_instr_stmt::execute (this=0x77b688040c90, thd=0x77b688000c70, nextp=0x7fb794521554)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sp_instr.cc:1208
      #9  0x000057a0720045aa in sp_head::execute (this=this@entry=0x77b68803f750, thd=thd@entry=0x77b688000c70, merge_da_on_success=false)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sp_head.cc:1347
      #10 0x000057a072005642 in sp_head::execute_trigger (this=0x77b68803f750, thd=0x77b688000c70, db_name=<optimized out>, table_name=<optimized out>, grant_info=<optimized out>)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sp_head.cc:1863
      #11 0x000057a07217ed86 in Table_triggers_list::process_triggers (this=0x77b68803d490, thd=0x77b688000c70, event=TRG_EVENT_INSERT, time_type=<optimized out>, old_row_is_record1=<optimized out>, skip_row_indicator=0x7fb794521f08, fields_in_update_stmt=0x0)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_trigger.cc:2918
      #12 0x000057a072046401 in fill_record_n_invoke_before_triggers (thd=thd@entry=0x77b688000c70, table=0x77b688028820, ptr=0x77b68803d1d0, values=@0x77b6880189d0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x77b688018a90, last = 0x77b688018a90, elements = 1}, <No data fields>}, ignore_errors=<optimized out>, event=event@entry=TRG_EVENT_INSERT, skip_row_indicator=0x7fb794521f08)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_base.cc:9946
      #13 0x000057a0720750ff in mysql_insert (thd=thd@entry=0x77b688000c70, table_list=0x77b688017d70, fields=@0x77b688006208: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x57a0733aa3c8 <end_of_list>, last = 0x77b688006208, elements = 0}, <No data fields>}, values_list=@0x77b688006250: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x77b688018aa0, last = 0x77b688018aa0, elements = 1}, <No data fields>}, update_fields=@0x77b688006238: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x57a0733aa3c8 <end_of_list>, last = 0x77b688006238, elements = 0}, <No data fields>}, update_values=@0x77b688006220: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x57a0733aa3c8 <end_of_list>, last = 0x77b688006220, elements = 0}, <No data fields>}, duplic=DUP_ERROR, ignore=<optimized out>, result=0x0)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_insert.cc:1193
      #14 0x000057a0720b5f66 in mysql_execute_command (thd=thd@entry=0x77b688000c70, is_called_from_prepared_stmt=false)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_parse.cc:4549
      #15 0x000057a0720ae8e2 in mysql_parse (thd=thd@entry=0x77b688000c70, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7fb794522580)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_parse.cc:8005
      #16 0x000057a0720ace98 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x77b688000c70, packet=packet@entry=0x77b688008ea1 "INSERT INTO t VALUES (1)", packet_length=packet_length@entry=24, blocking=true)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_parse.cc:1903
      #17 0x000057a0720aed61 in do_command (thd=thd@entry=0x77b688000c70, blocking=true)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_parse.cc:1437
      #18 0x000057a0721db9bd in do_handle_one_connection (connect=<optimized out>, connect@entry=0x57a0949e4d60, put_in_cache=true)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_connect.cc:1514
      #19 0x000057a0721db7f2 in handle_one_connection (arg=arg@entry=0x57a0949e4d60)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_connect.cc:1426
      #20 0x000057a072589d83 in pfs_spawn_thread (arg=0x57a094a05750)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/storage/perfschema/pfs.cc:2198
      #21 0x00007fb7c229cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #22 0x00007fb7c2329ecc in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Attachments

        Issue Links

          Activity

            People

              shulga Dmitry Shulga
              ramesh Ramesh Sivaraman
              Ramesh Sivaraman Ramesh Sivaraman
              Dmitry Shulga Dmitry Shulga
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Time Spent - 2.5h Remaining Estimate - 1.25d
                  1.25d
                  Logged:
                  Time Spent - 2.5h Remaining Estimate - 1.25d
                  2.5h

                  Git Integration

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