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

Assertion m_sp == m_thd->spcont->m_sp failed in Item_splocal::this_item / SIGSEGV in Item_splocal::get_rcontext on SIGNAL ... SET MESSAGE_TEXT = NEW in trigger

    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

      Similar to MDEV-40124, but the issue is still visible in bug fix branch bb-MDEV-34723-rucha

      CREATE TABLE t (a INT);
      CREATE TRIGGER tr BEFORE INSERT ON t FOR EACH ROW SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 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  Item_splocal::get_rcontext (this=0x7182a402c370, local_ctx=0x7182a405ade0)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/item.cc:1884
       
      [Current thread is 1 (LWP 2725554)]
      (gdb) bt
      #0  Item_splocal::get_rcontext (this=0x7182a402c370, local_ctx=0x7182a405ade0)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/item.cc:1884
      #1  Item_splocal::get_variable (this=0x7182a402c370, ctx=0x7182a405ade0)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/item.cc:1890
      #2  Item_splocal::this_item (this=0x7182a402c370)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/item.cc:1908
      #3  0x000057bf550bdaed in Item_sp_variable::is_null (this=0x0)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/item.cc:1847
      #4  0x000057bf54f555b5 in Sql_cmd_common_signal::eval_signal_informations (this=this@entry=0x7182a402c4e0, thd=thd@entry=0x7182a4000c70, cond=cond@entry=0x7983e41e7740)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_signal.cc:252
      #5  0x000057bf54f55dca in Sql_cmd_common_signal::raise_condition (this=0x7182a402c4e0, thd=0x7182a4000c70, cond=0x7983e41e7740)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_signal.cc:365
      #6  Sql_cmd_signal::execute (this=0x7182a402c4e0, thd=0x7182a4000c70)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_signal.cc:409
      #7  0x000057bf54e26465 in mysql_execute_command (thd=0x7182a4000c70, is_called_from_prepared_stmt=false)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_parse.cc:5947
      #8  0x000057bf54fcffb7 in sp_instr_stmt::exec_core (this=0x7182a402c5a0, thd=0x0, nextp=0x7182a4028d18)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sp_instr.cc:1306
      #9  0x000057bf54fce38a in sp_lex_keeper::reset_lex_and_exec_core (this=this@entry=0x7182a402c5d8, thd=thd@entry=0x7182a4000c70, nextp=nextp@entry=0x7983e41e8554, open_tables=false, instr=instr@entry=0x7182a402c5a0, rerun_the_same_instr=<optimized out>)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sp_instr.cc:420
      #10 0x000057bf54fce9b6 in sp_lex_keeper::validate_lex_and_exec_core (this=this@entry=0x7182a402c5d8, thd=thd@entry=0x7182a4000c70, nextp=nextp@entry=0x7983e41e8554, open_tables=<optimized out>, instr=instr@entry=0x7182a402c5a0)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sp_instr.cc:624
      #11 0x000057bf54fcf9ea in sp_instr_stmt::execute (this=0x7182a402c5a0, thd=0x7182a4000c70, nextp=0x7983e41e8554)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sp_instr.cc:1208
      #12 0x000057bf54d775aa in sp_head::execute (this=this@entry=0x7182a402b120, thd=thd@entry=0x7182a4000c70, merge_da_on_success=false)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sp_head.cc:1347
      #13 0x000057bf54d78642 in sp_head::execute_trigger (this=0x7182a402b120, thd=0x7182a4000c70, 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
      #14 0x000057bf54ef1d86 in Table_triggers_list::process_triggers (this=0x7182a4029010, thd=0x7182a4000c70, event=TRG_EVENT_INSERT, time_type=<optimized out>, old_row_is_record1=<optimized out>, skip_row_indicator=0x7983e41e8f08, fields_in_update_stmt=0x0)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_trigger.cc:2918
      #15 0x000057bf54db9401 in fill_record_n_invoke_before_triggers (thd=thd@entry=0x7182a4000c70, table=0x7182a4028020, ptr=0x7182a4028d20, values=@0x7182a40189d0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7182a4018a90, last = 0x7182a4018a90, elements = 1}, <No data fields>}, ignore_errors=<optimized out>, event=event@entry=TRG_EVENT_INSERT, skip_row_indicator=0x7983e41e8f08)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_base.cc:9946
      #16 0x000057bf54de80ff in mysql_insert (thd=thd@entry=0x7182a4000c70, table_list=0x7182a4017d70, fields=@0x7182a4006208: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x57bf5611d3c8 <end_of_list>, last = 0x7182a4006208, elements = 0}, <No data fields>}, values_list=@0x7182a4006250: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7182a4018aa0, last = 0x7182a4018aa0, elements = 1}, <No data fields>}, update_fields=@0x7182a4006238: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x57bf5611d3c8 <end_of_list>, last = 0x7182a4006238, elements = 0}, <No data fields>}, update_values=@0x7182a4006220: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x57bf5611d3c8 <end_of_list>, last = 0x7182a4006220, 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
      #17 0x000057bf54e28f66 in mysql_execute_command (thd=thd@entry=0x7182a4000c70, is_called_from_prepared_stmt=false)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_parse.cc:4549
      #18 0x000057bf54e218e2 in mysql_parse (thd=thd@entry=0x7182a4000c70, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7983e41e9580)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_parse.cc:8005
      #19 0x000057bf54e1fe98 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7182a4000c70, packet=packet@entry=0x7182a4008ea1 "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
      #20 0x000057bf54e21d61 in do_command (thd=thd@entry=0x7182a4000c70, blocking=true)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_parse.cc:1437
      #21 0x000057bf54f4e9bd in do_handle_one_connection (connect=<optimized out>, connect@entry=0x57bf74499d60, put_in_cache=true)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_connect.cc:1514
      #22 0x000057bf54f4e7f2 in handle_one_connection (arg=arg@entry=0x57bf74499d60)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_connect.cc:1426
      #23 0x000057bf552fcd83 in pfs_spawn_thread (arg=0x57bf744ba750)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/storage/perfschema/pfs.cc:2198
      #24 0x00007983e709cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #25 0x00007983e7129ecc in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

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

      mariadbd: /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/item.cc:1906: virtual Item *Item_splocal::this_item(): Assertion `m_sp == m_thd->spcont->m_sp' failed.
      

      MDEV-34723 CS 13.2.0 89cc41d5c46e1e322148d861e2b13527a7dd6306 (Debug, 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-dbg/bin/mariadbd --'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
       
      [Current thread is 1 (LWP 2772260)]
      (gdb) bt
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)at ./nptl/pthread_kill.c:89
      #3  0x00007c057824527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007c05782288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007c057822881b in __assert_fail_base (fmt=0x7c05783d1208 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x62c45d2aeaf9 "m_sp == m_thd->spcont->m_sp", file=file@entry=0x62c45d2ae48c "/test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/item.cc", line=line@entry=1906, function=function@entry=0x62c45d2aeb15 "virtual Item *Item_splocal::this_item()") at ./assert/assert.c:96
      #6  0x00007c057823b517 in __assert_fail (assertion=0x62c45d2aeaf9 "m_sp == m_thd->spcont->m_sp", file=0x62c45d2ae48c "/test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/item.cc", line=1906, function=0x62c45d2aeb15 "virtual Item *Item_splocal::this_item()")at ./assert/assert.c:105
      #7  0x000062c45c51e05b in Item_splocal::this_item (this=0x740460042a40)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/item.cc:1906
      #8  0x000062c45c51dc39 in Item_sp_variable::is_null (this=0x740460042a40)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/item.cc:1847
      #9  0x000062c45c28d495 in Sql_cmd_common_signal::eval_signal_informations (this=0x740460042bb0, thd=0x740460000d60, cond=0x7c05741317b0)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_signal.cc:252
      #10 0x000062c45c28e097 in Sql_cmd_common_signal::raise_condition (this=0x740460042bb0, thd=0x740460000d60, cond=0x7c05741317b0)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_signal.cc:365
      #11 0x000062c45c28e37c in Sql_cmd_signal::execute (this=0x740460042bb0, thd=0x740460000d60)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_signal.cc:409
      #12 0x000062c45c08a967 in mysql_execute_command (thd=0x740460000d60, is_called_from_prepared_stmt=false)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_parse.cc:5947
      #13 0x000062c45c35deb7 in sp_instr_stmt::exec_core (this=0x740460042c70, thd=0x740460000d60, nextp=0x7c0574133428)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sp_instr.cc:1306
      #14 0x000062c45c35b316 in sp_lex_keeper::reset_lex_and_exec_core (this=0x740460042cb0, thd=0x740460000d60, nextp=0x7c0574133428, open_tables=false, instr=0x740460042c70, rerun_the_same_instr=false)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sp_instr.cc:420
      #15 0x000062c45c35bafc in sp_lex_keeper::validate_lex_and_exec_core (this=0x740460042cb0, thd=0x740460000d60, nextp=0x7c0574133428, open_tables=false, instr=0x740460042c70)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sp_instr.cc:624
      #16 0x000062c45c35d129 in sp_instr_stmt::execute (this=0x740460042c70, thd=0x740460000d60, nextp=0x7c0574133428)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sp_instr.cc:1208
      #17 0x000062c45bf44aec in sp_head::execute (this=0x7404600417e0, thd=0x740460000d60, merge_da_on_success=false)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sp_head.cc:1347
      #18 0x000062c45bf46a17 in sp_head::execute_trigger (this=0x7404600417e0, thd=0x740460000d60, db_name=0x740460028a68, table_name=0x740460028a78, grant_info=0x740460037598)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sp_head.cc:1863
      #19 0x000062c45c1df81c in Table_triggers_list::process_triggers (this=0x740460036fe0, thd=0x740460000d60, event=TRG_EVENT_INSERT, time_type=TRG_ACTION_BEFORE, old_row_is_record1=true, skip_row_indicator=0x7c0574133f2f, fields_in_update_stmt=0x0)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_trigger.cc:2918
      #20 0x000062c45bfba5bd in fill_record_n_invoke_before_triggers (thd=0x740460000d60, table=0x7404600313d0, ptr=0x740460036cd0, values=@0x74046001b230: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x74046001b2f0, last = 0x74046001b2f0, elements = 1}, <No data fields>}, ignore_errors=false, event=TRG_EVENT_INSERT, skip_row_indicator=0x7c0574133f2f)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_base.cc:9946
      #21 0x000062c45c012734 in mysql_insert (thd=0x740460000d60, table_list=0x74046001a5d0, fields=@0x7404600062d0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x62c45df24da0 <end_of_list>, last = 0x7404600062d0, elements = 0}, <No data fields>}, values_list=@0x740460006318: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x74046001b300, last = 0x74046001b300, elements = 1}, <No data fields>}, update_fields=@0x740460006300: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x62c45df24da0 <end_of_list>, last = 0x740460006300, elements = 0}, <No data fields>}, update_values=@0x7404600062e8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x62c45df24da0 <end_of_list>, last = 0x7404600062e8, elements = 0}, <No data fields>}, duplic=DUP_ERROR, ignore=false, result=0x0)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_insert.cc:1193
      #22 0x000062c45c083f3b in mysql_execute_command (thd=0x740460000d60, is_called_from_prepared_stmt=false)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_parse.cc:4549
      #23 0x000062c45c079a84 in mysql_parse (thd=0x740460000d60, rawbuf=0x74046001a4d0 "INSERT INTO t VALUES (1)", length=24, parser_state=0x7c0574135a80)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_parse.cc:8005
      #24 0x000062c45c076e4d in dispatch_command (command=COM_QUERY, thd=0x740460000d60, packet=0x74046000b701 "INSERT INTO t VALUES (1)", packet_length=24, blocking=true)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_parse.cc:1903
      #25 0x000062c45c07a633 in do_command (thd=0x740460000d60, blocking=true)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_parse.cc:1437
      #26 0x000062c45c280d29 in do_handle_one_connection (connect=0x62c47e33c3b0, put_in_cache=true)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_connect.cc:1514
      #27 0x000062c45c280ace in handle_one_connection (arg=0x62c47e425be0)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_connect.cc:1426
      #28 0x00007c057829cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #29 0x00007c0578329ecc 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:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Time Spent - 0.75d Remaining Estimate - 6.5h
                  6.5h
                  Logged:
                  Time Spent - 0.75d Remaining Estimate - 6.5h
                  0.75d

                  Git Integration

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