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

Function with direct INSERT into Aria table crashes

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 13.1
    • N/A
    • Stored routines
    • None
    • Can result in hang or crash

    Description

      Function with direct INSERT into Aria table crashes

      CREATE OR REPLACE TABLE t1 (a VARCHAR(30)) ENGINE=Aria;
       
      DELIMITER $$
      CREATE OR REPLACE FUNCTION f3() RETURNS INT
      BEGIN
        INSERT INTO t1 VALUES ('f3-direct');
        RETURN 0;
      END;
      $$
       
      CREATE OR REPLACE FUNCTION f2() RETURNS INT
      BEGIN
        DECLARE v3 VARCHAR(10) DEFAULT f3();
        INSERT INTO t1 VALUES ('f2-direct');
        RETURN 0;
      END;
      $$	
       
      CREATE OR REPLACE PROCEDURE p1()
      BEGIN
        DECLARE v2 VARCHAR(10) DEFAULT f2();
      END;
      $$
      DELIMITER ;
       
      CALL p1;
      

      with the following stack:

      #0  0x00007ffff7082e7c in __pthread_kill_implementation ()
         from /lib64/libc.so.6
      #1  0x00007ffff7028f0e in raise () from /lib64/libc.so.6
      #2  0x00007ffff70106d0 in abort () from /lib64/libc.so.6
      #3  0x00007ffff7010639 in __assert_fail_base.cold () from /lib64/libc.so.6
      #4  0x0000555555f6c229 in ha_maria::start_stmt (this=0x77ffa80ffbb0, 
          thd=0x77ffa8000dd0, lock_type=TL_WRITE)
          at /home/bar/maria-git/13.1.m39518.fnc5/storage/maria/ha_maria.cc:3056
      #5  0x000055555569617e in check_lock_and_start_stmt (thd=0x77ffa8000dd0, 
          prelocking_ctx=0x77ffa808c528, table_list=0x77ffa80c76d0)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sql_base.cc:5598
      #6  0x00005555556978db in lock_tables (thd=0x77ffa8000dd0, 
          tables=0x77ffa80c76d0, count=1, flags=0)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sql_base.cc:6209
      #7  0x0000555555696ae8 in open_and_lock_tables (thd=0x77ffa8000dd0, 
          options=..., tables=0x77ffa80c76d0, derived=true, flags=0, 
          prelocking_strategy=0x7fffe009bbc8)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sql_base.cc:5831
      #8  0x00005555556a840d in open_and_lock_tables (thd=0x77ffa8000dd0, 
          tables=0x77ffa80c76d0, derived=true, flags=0)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sql_base.h:545
      #9  0x00005555557062c4 in mysql_insert (thd=0x77ffa8000dd0, 
          table_list=0x77ffa80c76d0, fields=..., values_list=..., update_fields=..., 
          update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sql_insert.cc:812
      #10 0x0000555555777aa1 in mysql_execute_command (thd=0x77ffa8000dd0, 
          is_called_from_prepared_stmt=false)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sql_parse.cc:4508
      #11 0x0000555555ad4b9b in sp_instr_stmt::exec_core (this=0x77ffa80bdc70, 
          thd=0x77ffa8000dd0, nextp=0x7fffe009ca1c)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sp_instr.cc:1281
      #12 0x0000555555ad2a25 in sp_lex_keeper::reset_lex_and_exec_core (
          this=0x77ffa80bdcb0, thd=0x77ffa8000dd0, nextp=0x7fffe009ca1c, 
          open_tables=false, instr=0x77ffa80bdc70, rerun_the_same_instr=false)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sp_instr.cc:420
      #13 0x0000555555ad30ef in sp_lex_keeper::validate_lex_and_exec_core (
          this=0x77ffa80bdcb0, thd=0x77ffa8000dd0, nextp=0x7fffe009ca1c, 
          open_tables=false, instr=0x77ffa80bdc70)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sp_instr.cc:599
      #14 0x0000555555ad46bd in sp_instr_stmt::execute (this=0x77ffa80bdc70, 
          thd=0x77ffa8000dd0, nextp=0x7fffe009ca1c)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sp_instr.cc:1183
      #15 0x0000555555628a3e in sp_head::execute (this=0x77ffa80bbf40, 
          thd=0x77ffa8000dd0, merge_da_on_success=true)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sp_head.cc:1337
      #16 0x000055555562acf2 in sp_head::execute_function (this=0x77ffa80bbf40, 
          thd=0x77ffa8000dd0, argp=0x0, argcount=0, return_value_fld=0x77ffa80d7870, 
          func_ctx=0x77ffa80d73b8, call_arena=0x77ffa80e8ce0)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sp_head.cc:2114
      #17 0x0000555555cd3ff2 in Item_sp::execute_impl (this=0x77ffa80d7350, 
          thd=0x77ffa8000dd0, args=0x0, arg_count=0)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/item.cc:3158
      #18 0x0000555555cd39dd in Item_sp::execute (this=0x77ffa80d7350, 
          thd=0x77ffa8000dd0, null_value=0x77ffa80d7306, args=0x0, arg_count=0)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/item.cc:3029
      #19 0x0000555555d66029 in Item_func_sp::execute (this=0x77ffa80d7290)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/item_func.cc:6780
      #20 0x0000555555d6fc24 in Item_func_sp::val_int (this=0x77ffa80d7290)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/item_func.h:4359
      #21 0x0000555555ce2e62 in Item::save_int_in_field (this=0x77ffa80d7290, 
          field=0x77ffa8037490, no_conversions=false)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/item.cc:7539
      #22 0x0000555555af193c in Type_handler_int_result::Item_save_in_field (
          this=0x55555845eaa0 <type_handler_slong>, item=0x77ffa80d7290, 
          field=0x77ffa8037490, no_conversions=false)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sql_type.cc:4512
      #23 0x0000555555ce2faf in Item::save_in_field (this=0x77ffa80d7290, 
          field=0x77ffa8037490, no_conversions=false)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/item.cc:7566
      #24 0x0000555555c5d2f4 in Field::sp_prepare_and_store_item (
          this=0x77ffa8037490, thd=0x77ffa8000dd0, value=0x77ffa80d7510)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/field.cc:1533
      #25 0x00005555556258fe in THD::sp_eval_expr (this=0x77ffa8000dd0, 
          result_field=0x77ffa8037490, expr_item_ptr=0x77ffa80d7510)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sp_head.cc:452
      #26 0x00005555556401f5 in sp_rcontext::set_variable (this=0x77ffa8036870, 
          thd=0x77ffa8000dd0, idx=0, value=0x77ffa80d7510)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sp_rcontext.cc:676
      #27 0x0000555555ad4d21 in sp_instr_set::exec_core (this=0x77ffa80d7450, 
          thd=0x77ffa8000dd0, nextp=0x7fffe009d9bc)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sp_instr.cc:1314
      #28 0x0000555555ad2a25 in sp_lex_keeper::reset_lex_and_exec_core (
          this=0x77ffa80d7490, thd=0x77ffa8000dd0, nextp=0x7fffe009d9bc, 
          open_tables=true, instr=0x77ffa80d7450, rerun_the_same_instr=false)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sp_instr.cc:420
      #29 0x0000555555ad30ef in sp_lex_keeper::validate_lex_and_exec_core (
          this=0x77ffa80d7490, thd=0x77ffa8000dd0, nextp=0x7fffe009d9bc, 
          open_tables=true, instr=0x77ffa80d7450)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sp_instr.cc:599
      #30 0x0000555555ad4c5e in sp_instr_set::execute (this=0x77ffa80d7450, 
          thd=0x77ffa8000dd0, nextp=0x7fffe009d9bc)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sp_instr.cc:1301
      #31 0x0000555555628a3e in sp_head::execute (this=0x77ffa80d5bc0, 
          thd=0x77ffa8000dd0, merge_da_on_success=true)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sp_head.cc:1337
      #32 0x000055555562bb0d in sp_head::execute_procedure (this=0x77ffa80d5bc0, 
          thd=0x77ffa8000dd0, args=0x77ffa8006558)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sp_head.cc:2382
      #33 0x0000555555771d1f in do_execute_sp (thd=0x77ffa8000dd0, sp=0x77ffa80d5bc0)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sql_parse.cc:3087
      #34 0x0000555555772a72 in Sql_cmd_call::execute (this=0x77ffa8035690, 
          thd=0x77ffa8000dd0)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sql_parse.cc:3325
      #35 0x000055555577d21b in mysql_execute_command (thd=0x77ffa8000dd0, 
          is_called_from_prepared_stmt=false)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sql_parse.cc:5911
      #36 0x0000555555783c19 in mysql_parse (thd=0x77ffa8000dd0, 
          rawbuf=0x77ffa80353f0 "CALL p1", length=7, parser_state=0x7fffe009ef30)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sql_parse.cc:7968
      #37 0x000055555576e3bc in dispatch_command (command=COM_QUERY, 
          thd=0x77ffa8000dd0, packet=0x77ffa800c511 "CALL p1", packet_length=7, 
          blocking=true)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sql_parse.cc:1903
      #38 0x000055555576cacd in do_command (thd=0x77ffa8000dd0, blocking=true)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sql_parse.cc:1437
      #39 0x00005555559bf0cd in do_handle_one_connection (connect=0x5555597b1e00, 
          put_in_cache=true)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sql_connect.cc:1514
      #40 0x00005555559bee1a in handle_one_connection (arg=0x5555597b1e00)
          at /home/bar/maria-git/13.1.m39518.fnc5/sql/sql_connect.cc:1426
      #41 0x00005555560681f0 in pfs_spawn_thread (arg=0x55555981cda0)
          at /home/bar/maria-git/13.1.m39518.fnc5/storage/perfschema/pfs.cc:2198
      #42 0x00007ffff7080f34 in start_thread () from /lib64/libc.so.6
      #43 0x00007ffff710436c in __clone3 () from /lib64/libc.so.6
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Alexander Barkov Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.