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

A field of an assoc array element as OUT parameter crashes the server

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      SET sql_mode=ORACLE;
      DELIMITER $$
      CREATE OR REPLACE PROCEDURE p1(a OUT INT) AS
      BEGIN
        a:= 7;
      END;
      $$
      DECLARE
        TYPE rec_t IS RECORD (i INT, s VARCHAR(10));
        TYPE tab_t IS TABLE OF rec_t INDEX BY INT;
        t tab_t:= tab_t(1 => rec_t(0, 'x'));
      BEGIN
        p1(t(1).i);         -- a field of an assoc array element as an OUT  argument
        SELECT t(1).i, t(1).s;
      END;
      $$
      DELIMITER ;
      DROP PROCEDURE p1;
      

      Stack trace:

      #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  0x000055555563cd60 in sp_rcontext::virtual_tmp_table_for_row (
          this=0x77ffa8039670, var_idx=0)
          at /home/bar/maria-git/13.1.m40394.hf/sql/sp_rcontext.cc:706
      #5  0x000055555563c940 in sp_rcontext::set_variable_row_field (
          this=0x77ffa8039670, thd=0x77ffa8000dd0, var_idx=0, field_idx=0, 
          value=0x77ffa8077710)
          at /home/bar/maria-git/13.1.m40394.hf/sql/sp_rcontext.cc:686
      #6  0x0000555555cae62f in Item_splocal_row_field::set_value (
          this=0x77ffa8043ce0, thd=0x77ffa8000dd0, ctx=0x77ffa8039670, 
          it=0x77ffa8077710) at /home/bar/maria-git/13.1.m40394.hf/sql/item.cc:2075
      #7  0x0000555555cae9fb in Item_splocal_row_field_by_name::set_value (
          this=0x77ffa8043ce0, thd=0x77ffa8000dd0, ctx=0x77ffa8039670, 
          it=0x77ffa8077710) at /home/bar/maria-git/13.1.m40394.hf/sql/item.cc:2116
      #8  0x000055555562a994 in sp_head::bind_output_param (this=0x77ffa8078c70, 
          thd=0x77ffa8000dd0, arg_item=0x77ffa8043ce0, arg_no=0, 
          octx=0x77ffa8039670, nctx=0x77ffa8076a00)
          at /home/bar/maria-git/13.1.m40394.hf/sql/sp_head.cc:2513
      #9  0x0000555555629fa4 in sp_head::execute_procedure (this=0x77ffa8078c70, 
          thd=0x77ffa8000dd0, args=0x77ffa80465e0)
          at /home/bar/maria-git/13.1.m40394.hf/sql/sp_head.cc:2358
      #10 0x0000555555765d75 in do_execute_sp (thd=0x77ffa8000dd0, sp=0x77ffa8078c70)
          at /home/bar/maria-git/13.1.m40394.hf/sql/sql_parse.cc:3084
      #11 0x0000555555766ac8 in Sql_cmd_call::execute (this=0x77ffa8043bb0, 
          thd=0x77ffa8000dd0)
          at /home/bar/maria-git/13.1.m40394.hf/sql/sql_parse.cc:3322
      #12 0x0000555555771242 in mysql_execute_command (thd=0x77ffa8000dd0, 
          is_called_from_prepared_stmt=false)
          at /home/bar/maria-git/13.1.m40394.hf/sql/sql_parse.cc:5905
      #13 0x0000555555abfc7d in sp_instr_stmt::exec_core (this=0x77ffa8043e30, 
          thd=0x77ffa8000dd0, nextp=0x7ffff409cc3c)
          at /home/bar/maria-git/13.1.m40394.hf/sql/sp_instr.cc:1281
      #14 0x0000555555abdb07 in sp_lex_keeper::reset_lex_and_exec_core (
          this=0x77ffa8043e70, thd=0x77ffa8000dd0, nextp=0x7ffff409cc3c, 
          open_tables=false, instr=0x77ffa8043e30, rerun_the_same_instr=false)
          at /home/bar/maria-git/13.1.m40394.hf/sql/sp_instr.cc:420
      #15 0x0000555555abe1d1 in sp_lex_keeper::validate_lex_and_exec_core (
          this=0x77ffa8043e70, thd=0x77ffa8000dd0, nextp=0x7ffff409cc3c, 
          open_tables=false, instr=0x77ffa8043e30)
          at /home/bar/maria-git/13.1.m40394.hf/sql/sp_instr.cc:599
      #16 0x0000555555abf79f in sp_instr_stmt::execute (this=0x77ffa8043e30, 
          thd=0x77ffa8000dd0, nextp=0x7ffff409cc3c)
          at /home/bar/maria-git/13.1.m40394.hf/sql/sp_instr.cc:1183
      #17 0x0000555555626e20 in sp_head::execute (this=0x77ffa803f3a0, 
          thd=0x77ffa8000dd0, merge_da_on_success=true)
          at /home/bar/maria-git/13.1.m40394.hf/sql/sp_head.cc:1292
      #18 0x0000555555629e95 in sp_head::execute_procedure (this=0x77ffa803f3a0, 
          thd=0x77ffa8000dd0, args=0x77ffa80064d0)
          at /home/bar/maria-git/13.1.m40394.hf/sql/sp_head.cc:2329
      #19 0x0000555555765d75 in do_execute_sp (thd=0x77ffa8000dd0, sp=0x77ffa803f3a0)
          at /home/bar/maria-git/13.1.m40394.hf/sql/sql_parse.cc:3084
      #20 0x0000555555770490 in mysql_execute_command (thd=0x77ffa8000dd0, 
          is_called_from_prepared_stmt=false)
          at /home/bar/maria-git/13.1.m40394.hf/sql/sql_parse.cc:5661
      #21 0x00005555557778a6 in mysql_parse (thd=0x77ffa8000dd0, 
          rawbuf=0x77ffa80352a0 "DECLARE\n  TYPE rec_t IS RECORD (i INT, s VARCHAR(10));\n  TYPE tab_t IS TABLE OF rec_t INDEX BY INT;\n  t tab_t:= tab_t(1 => rec_t(0, 'x'));\nBEGIN\n  p1(t(1).i);         \n  SELECT t(1).i, t(1).s;\nEND", 
          length=196, parser_state=0x7ffff409df40)
          at /home/bar/maria-git/13.1.m40394.hf/sql/sql_parse.cc:7945
      #22 0x000055555576243c in dispatch_command (command=COM_QUERY, 
          thd=0x77ffa8000dd0, 
          packet=0x77ffa800c3c1 "DECLARE\n  TYPE rec_t IS RECORD (i INT, s VARCHAR(10));\n  TYPE tab_t IS TABLE OF rec_t INDEX BY INT;\n  t tab_t:= tab_t(1 => rec_t(0, 'x'));\nBEGIN\n  p1(t(1).i);         \n  SELECT t(1).i, t(1).s;\nEND;", 
          packet_length=197, blocking=true)
          at /home/bar/maria-git/13.1.m40394.hf/sql/sql_parse.cc:1903
      #23 0x0000555555760b49 in do_command (thd=0x77ffa8000dd0, blocking=true)
          at /home/bar/maria-git/13.1.m40394.hf/sql/sql_parse.cc:1437
      #24 0x00005555559aba12 in do_handle_one_connection (connect=0x55555978ff50, 
          put_in_cache=true)
          at /home/bar/maria-git/13.1.m40394.hf/sql/sql_connect.cc:1503
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 1h
                  1h

                  Git Integration

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