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

Server crashes in mysql_handle_single_derived upon 2nd execution of PS

    Details

      Description

      CREATE TABLE t1 (f INT);
      CREATE VIEW v1 AS SELECT * FROM t1;
      CREATE TRIGGER tr BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO v1 SELECT * FROM x;
      PREPARE stmt FROM "INSERT INTO v1 VALUES (1)";
       
      --error ER_NO_SUCH_TABLE
      EXECUTE stmt;
      --error ER_NO_SUCH_TABLE
      EXECUTE stmt;
       
      # Cleanup
      DEALLOCATE PREPARE stmt;
      DROP VIEW v1;
      DROP TABLE t1;
      

      10.4 653a56fd

      #3  <signal handler called>
      #4  0x00005557940a22a1 in mysql_handle_single_derived (lex=0x7f8700184f50, derived=0x7f870012f318, phases=128) at /data/src/10.4/sql/sql_derived.cc:186
      #5  0x0000555794207ece in mysql_make_view (thd=0x7f8700000b00, share=0x7f8700008e68, table=0x7f870012f318, open_view_no_parse=false) at /data/src/10.4/sql/sql_view.cc:1203
      #6  0x00005557940595c5 in open_table (thd=0x7f8700000b00, table_list=0x7f870012f318, ot_ctx=0x7f8710b8b500) at /data/src/10.4/sql/sql_base.cc:1955
      #7  0x000055579405cbd5 in open_and_process_table (thd=0x7f8700000b00, lex=0x7f8700184f50, tables=0x7f870012f318, counter=0x7f8710b8b594, flags=0, prelocking_strategy=0x7f8710b8b610, has_prelocking_list=true, ot_ctx=0x7f8710b8b500) at /data/src/10.4/sql/sql_base.cc:3718
      #8  0x000055579405e1c0 in open_tables (thd=0x7f8700000b00, options=..., start=0x7f8710b8b578, counter=0x7f8710b8b594, flags=0, prelocking_strategy=0x7f8710b8b610) at /data/src/10.4/sql/sql_base.cc:4288
      #9  0x000055579405ffdf in open_and_lock_tables (thd=0x7f8700000b00, options=..., tables=0x7f8700186b40, derived=true, flags=0, prelocking_strategy=0x7f8710b8b610) at /data/src/10.4/sql/sql_base.cc:5170
      #10 0x000055579401d0fc in open_and_lock_tables (thd=0x7f8700000b00, tables=0x7f8700186b40, derived=true, flags=0) at /data/src/10.4/sql/sql_base.h:502
      #11 0x00005557940aed63 in mysql_insert (thd=0x7f8700000b00, table_list=0x7f8700186b40, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false) at /data/src/10.4/sql/sql_insert.cc:764
      #12 0x00005557940fad3d in mysql_execute_command (thd=0x7f8700000b00) at /data/src/10.4/sql/sql_parse.cc:4792
      #13 0x0000555794124c8c in Prepared_statement::execute (this=0x7f8700044d70, expanded_query=0x7f8710b8c530, open_cursor=false) at /data/src/10.4/sql/sql_prepare.cc:4760
      #14 0x0000555794123262 in Prepared_statement::execute_loop (this=0x7f8700044d70, expanded_query=0x7f8710b8c530, open_cursor=false, packet=0x0, packet_end=0x0) at /data/src/10.4/sql/sql_prepare.cc:4246
      #15 0x0000555794120e4f in mysql_sql_stmt_execute (thd=0x7f8700000b00) at /data/src/10.4/sql/sql_prepare.cc:3363
      #16 0x00005557940f8126 in mysql_execute_command (thd=0x7f8700000b00) at /data/src/10.4/sql/sql_parse.cc:3907
      #17 0x0000555794106891 in mysql_parse (thd=0x7f8700000b00, rawbuf=0x7f87000155e8 "EXECUTE stmt", length=12, parser_state=0x7f8710b8d180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8154
      #18 0x00005557940f22e8 in dispatch_command (command=COM_QUERY, thd=0x7f8700000b00, packet=0x7f870000a8a1 "EXECUTE stmt", packet_length=12, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1832
      #19 0x00005557940f0ace in do_command (thd=0x7f8700000b00) at /data/src/10.4/sql/sql_parse.cc:1365
      #20 0x0000555794268eb7 in do_handle_one_connection (connect=0x5557977588b0) at /data/src/10.4/sql/sql_connect.cc:1398
      #21 0x0000555794268c28 in handle_one_connection (arg=0x5557977588b0) at /data/src/10.4/sql/sql_connect.cc:1301
      #22 0x00005557947539a7 in pfs_spawn_thread (arg=0x5557977ca130) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #23 0x00007f8718b08494 in start_thread (arg=0x7f8710b8e700) at pthread_create.c:333
      #24 0x00007f8716ad093f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Same with stored procedures.

      Non-debug build also crashes.

      The problem appeared in 10.4 with this commit:

      commit 6c306a729d79504d6dd8efc42db78011cb6956d5
      Author: Oleksandr Byelkin
      Date:   Tue Apr 2 14:46:36 2019 +0200
       
          Cleanup of derived table interface
      

        Attachments

          Activity

            People

            • Assignee:
              sanja Oleksandr Byelkin
              Reporter:
              elenst Elena Stepanova
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: