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

Server crashes in Item_method_base::get_variable / Item_func_assoc_array_count::val_int when trigger runs in another connection

    XMLWordPrintable

Details

    Description

      Same mechanism as MDEV-42409: Item_method_base::m_thd is the THD that parsed the trigger, reused from the table cache by another connection.

      set sql_mode=oracle;
      CREATE TABLE t1 (a INT);
      --delimiter $$
      CREATE TRIGGER tr BEFORE INSERT ON t1 FOR EACH ROW
      DECLARE
        TYPE at IS TABLE OF INT INDEX BY INT;
        x at;
      BEGIN
        x(1):= 5;
        :NEW.a:= x.count;
      END$$
      --delimiter ;
      connect (c1,localhost,root,,test);
      INSERT INTO t1 VALUES (1);
      connection default;
      INSERT INTO t1 VALUES (2);
      SELECT * FROM t1;
      disconnect c1;
      DROP TABLE t1;

      13.2.0-MariaDB-asan-debug-log source revision: 5370405937a659351b9203337e76e4597cfb6eb0
      #0  __pthread_kill_implementation (no_tid=0, signo=11, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=11, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=<optimized out>, signo=11) at ./nptl/pthread_kill.c:89
      #3  0x00005a8d232f49f5 in my_write_core (sig=11) at /13.2/src/mysys/stacktrace.c:424
      #4  0x00005a8d213c948e in handle_fatal_signal (sig=11) at /13.2/src/sql/signal_handler.cc:300
      #5  <signal handler called>
      #6  0x00005a8d214a2fb4 in Bounds_checked_array<Item_field*>::operator[] (this=0x28, n=0) at /13.2/src/sql/sql_array.h:71
      #7  0x00005a8d2344bd62 in sp_rcontext::get_variable (var_idx=<optimized out>, this=<optimized out>) at /13.2/src/sql/sp_rcontext.h:234
      #8  Item_method_base::get_variable (this=this@entry=0x525000200d80, ctx=<optimized out>) at /13.2/src/plugin/type_assoc_array/sql_type_assoc_array.cc:444
      #9  0x00005a8d2344cf26 in Item_method_base::get_composite_field (this=this@entry=0x525000200d80) at /13.2/src/plugin/type_assoc_array/sql_type_assoc_array.cc:448
      #10 0x00005a8d2344d018 in Item_func_assoc_array_count::val_int (this=0x525000200ca8) at /13.2/src/plugin/type_assoc_array/sql_type_assoc_array.cc:760
      #11 0x00005a8d21467e0e in Item::save_int_in_field (this=0x525000200ca8, field=0x5250001f7240, no_conversions=false) at /13.2/src/sql/item.cc:7562
      #12 0x00005a8d2249b768 in Type_handler_int_result::Item_save_in_field (this=<optimized out>, item=<optimized out>, field=<optimized out>, no_conversions=<optimized out>) at /13.2/src/sql/sql_type.cc:4512
      #13 0x00005a8d214277a7 in Item::save_in_field (this=0x525000200ca8, field=0x5250001f7240, no_conversions=false) at /13.2/src/sql/item.cc:7582
      #14 0x00005a8d214418cb in Item_trigger_field::set_value (this=0x525000200dc0, thd=0x52c000080220, it=0x525000200ff0) at /13.2/src/sql/item.cc:10956
      #15 0x00005a8d2246f616 in Item_trigger_field::set_value (it=0x525000200ff0, thd=0x52c000080220, this=<optimized out>) at /13.2/src/sql/item.h:7935
      #16 sp_instr_set_trigger_field::exec_core (this=0x525000200f38, thd=0x52c000080220, nextp=0x7964f2a44030) at /13.2/src/sql/sp_instr.cc:1741
      #17 0x00005a8d22479cdf in sp_lex_keeper::reset_lex_and_exec_core (this=this@entry=0x525000200f78, thd=thd@entry=0x52c000080220, nextp=nextp@entry=0x7964f2a44030, open_tables=open_tables@entry=true, instr=instr@entry=0x525000200f38, rerun_the_same_instr=rerun_the_same_instr@entry=false) at /13.2/src/sql/sp_instr.cc:420
      #18 0x00005a8d22480434 in sp_lex_keeper::validate_lex_and_exec_core (this=this@entry=0x525000200f78, thd=thd@entry=0x52c000080220, nextp=nextp@entry=0x7964f2a44030, open_tables=open_tables@entry=true, instr=instr@entry=0x525000200f38) at /13.2/src/sql/sp_instr.cc:624
      #19 0x00005a8d224827b4 in sp_instr_set_trigger_field::execute (this=0x525000200f38, thd=0x52c000080220, nextp=<optimized out>) at /13.2/src/sql/sp_instr.cc:1733
      #20 0x00005a8d21a2c0d2 in sp_head::execute (this=this@entry=0x5250001f9148, thd=thd@entry=0x52c000080220, merge_da_on_success=merge_da_on_success@entry=false) at /13.2/src/sql/sp_head.cc:1346
      #21 0x00005a8d21a2e48d in sp_head::execute_trigger (this=0x5250001f9148, thd=thd@entry=0x52c000080220, db_name=<optimized out>, table_name=<optimized out>, grant_info=grant_info@entry=0x5250001f7c08) at /13.2/src/sql/sp_head.cc:1862
      #22 0x00005a8d220428a2 in Table_triggers_list::process_triggers (this=this@entry=0x5250001f7568, thd=thd@entry=0x52c000080220, event=event@entry=TRG_EVENT_INSERT, time_type=time_type@entry=TRG_ACTION_BEFORE, old_row_is_record1=old_row_is_record1@entry=true, skip_row_indicator=skip_row_indicator@entry=0x7964f2a43830, fields_in_update_stmt=<optimized out>) at /13.2/src/sql/sql_trigger.cc:2879
      #23 0x00005a8d21b2e67e in fill_record_n_invoke_before_triggers (thd=thd@entry=0x52c000080220, table=table@entry=0x519000060ea0, ptr=0x5250001f7200, values=..., ignore_errors=ignore_errors@entry=false, event=event@entry=TRG_EVENT_INSERT, skip_row_indicator=0x7964f2a43830) at /13.2/src/sql/sql_base.cc:9946
      #24 0x00005a8d21c4fdc2 in mysql_insert (thd=thd@entry=0x52c000080220, table_list=0x52d0000f0580, fields=..., values_list=..., update_fields=..., update_values=..., duplic=<optimized out>, ignore=<optimized out>, result=<optimized out>) at /13.2/src/sql/sql_insert.cc:1193
      #25 0x00005a8d21d283ac in mysql_execute_command (thd=thd@entry=0x52c000080220, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /13.2/src/sql/sql_parse.cc:4549
      #26 0x00005a8d21d32fe5 in mysql_parse (thd=thd@entry=0x52c000080220, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7964f2cb41b0) at /13.2/src/sql/sql_parse.cc:8005
      #27 0x00005a8d21d36c99 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x52c000080220, packet=packet@entry=0x52900028f221 "INSERT INTO t1 VALUES (2)", packet_length=packet_length@entry=25, blocking=blocking@entry=true) at /13.2/src/sql/sql_parse.cc:1903
      #28 0x00005a8d21d3b4fb in do_command (thd=thd@entry=0x52c000080220, blocking=blocking@entry=true) at /13.2/src/sql/sql_parse.cc:1437
      #29 0x00005a8d2222d437 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x50b000004730, put_in_cache=put_in_cache@entry=true) at /13.2/src/sql/sql_connect.cc:1514
      #30 0x00005a8d2222d83d in handle_one_connection (arg=arg@entry=0x50b000004730) at /13.2/src/sql/sql_connect.cc:1426
      #31 0x00007964ffa5ea42 in asan_thread_start (arg=0x7964f3ada000) at ../../../../src/libsanitizer/asan/asan_interceptors.cpp:234
      #32 0x00007964fea9cb64 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:447
      #33 0x00007964feb29e8c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

      Attachments

        Issue Links

          Activity

            People

              shulga Dmitry Shulga
              alice Alice Sherepa
              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.