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

Server crashes in mysql_make_view upon using a view instead of sequence

    XMLWordPrintable

Details

    Description

      CREATE SEQUENCE s;
      CREATE TABLE t (a INT DEFAULT (NEXTVAL(s)));
      DROP SEQUENCE s;
      CREATE VIEW s AS SELECT 1;
      INSERT INTO t () VALUES ();
       
      # Cleanup
      DROP VIEW s;
      DROP TABLE t;
      

      10.5 32962ea2532ee78bc99d8da950348ba01d38a23b

      #3  <signal handler called>
      #4  0x000055821c3376cb in st_select_lex_node::include_down (this=0x62b00003a298, upper=0x0) at /data/bld/10.5-asan/sql/sql_lex.cc:3124
      #5  0x000055821c6f3b42 in mysql_make_view (thd=0x62b000069218, share=0x61b00003b1b8, table=0x62b0000399d8, open_view_no_parse=false) at /data/bld/10.5-asan/sql/sql_view.cc:1789
      #6  0x000055821c212236 in open_table (thd=0x62b000069218, table_list=0x62b0000399d8, ot_ctx=0x7fefc946d790) at /data/bld/10.5-asan/sql/sql_base.cc:1933
      #7  0x000055821c21c7f3 in open_and_process_table (thd=0x62b000069218, tables=0x62b0000399d8, counter=0x7fefc946d8a0, flags=0, prelocking_strategy=0x7fefc946d9b0, has_prelocking_list=false, ot_ctx=0x7fefc946d790) at /data/bld/10.5-asan/sql/sql_base.cc:3819
      #8  0x000055821c21f320 in open_tables (thd=0x62b000069218, options=..., start=0x7fefc946d8b0, counter=0x7fefc946d8a0, flags=0, prelocking_strategy=0x7fefc946d9b0) at /data/bld/10.5-asan/sql/sql_base.cc:4303
      #9  0x000055821c224455 in open_and_lock_tables (thd=0x62b000069218, options=..., tables=0x62b000038348, derived=true, flags=0, prelocking_strategy=0x7fefc946d9b0) at /data/bld/10.5-asan/sql/sql_base.cc:5250
      #10 0x000055821c179e62 in open_and_lock_tables (thd=0x62b000069218, tables=0x62b000038348, derived=true, flags=0) at /data/bld/10.5-asan/sql/sql_base.h:509
      #11 0x000055821c2f0ee2 in mysql_insert (thd=0x62b000069218, table_list=0x62b000038348, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false, result=0x0) at /data/bld/10.5-asan/sql/sql_insert.cc:760
      #12 0x000055821c3bd81a in mysql_execute_command (thd=0x62b000069218) at /data/bld/10.5-asan/sql/sql_parse.cc:4650
      #13 0x000055821c3d6241 in mysql_parse (thd=0x62b000069218, rawbuf=0x62b000038238 "INSERT INTO t () VALUES ()", length=26, parser_state=0x7fefc946ec70, is_com_multi=false, is_next_command=false) at /data/bld/10.5-asan/sql/sql_parse.cc:8237
      #14 0x000055821c3ab527 in dispatch_command (command=COM_QUERY, thd=0x62b000069218, packet=0x629000235219 "INSERT INTO t () VALUES ()", packet_length=26, is_com_multi=false, is_next_command=false) at /data/bld/10.5-asan/sql/sql_parse.cc:1891
      #15 0x000055821c3a7eba in do_command (thd=0x62b000069218) at /data/bld/10.5-asan/sql/sql_parse.cc:1375
      #16 0x000055821c801ac7 in do_handle_one_connection (connect=0x608000002ab8, put_in_cache=true) at /data/bld/10.5-asan/sql/sql_connect.cc:1407
      #17 0x000055821c80162d in handle_one_connection (arg=0x608000002a38) at /data/bld/10.5-asan/sql/sql_connect.cc:1319
      #18 0x000055821d45fb14 in pfs_spawn_thread (arg=0x615000006c18) at /data/bld/10.5-asan/storage/perfschema/pfs.cc:2201
      #19 0x00007fefd2ca8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #20 0x00007fefd2d2861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      A similar stack trace seen on a similar, slightly more complicated, test case

      #4  0x000055943cfb8687 in st_select_lex::master_unit (this=0x0) at /data/bld/10.5-asan/sql/sql_lex.h:1366
      #5  0x000055943d461095 in mysql_make_view (thd=0x62b000069218, share=0x61b00003cdb8, table=0x62b000039f60, open_view_no_parse=false) at /data/bld/10.5-asan/sql/sql_view.cc:1717
      #6  0x000055943cf80236 in open_table (thd=0x62b000069218, table_list=0x62b000039f60, ot_ctx=0x7f108e76d790) at /data/bld/10.5-asan/sql/sql_base.cc:1933
      #7  0x000055943cf8a7f3 in open_and_process_table (thd=0x62b000069218, tables=0x62b000039f60, counter=0x7f108e76d8a0, flags=0, prelocking_strategy=0x7f108e76d9b0, has_prelocking_list=false, ot_ctx=0x7f108e76d790) at /data/bld/10.5-asan/sql/sql_base.cc:3819
      #8  0x000055943cf8d320 in open_tables (thd=0x62b000069218, options=..., start=0x7f108e76d8b0, counter=0x7f108e76d8a0, flags=0, prelocking_strategy=0x7f108e76d9b0) at /data/bld/10.5-asan/sql/sql_base.cc:4303
      #9  0x000055943cf92455 in open_and_lock_tables (thd=0x62b000069218, options=..., tables=0x62b000038420, derived=true, flags=0, prelocking_strategy=0x7f108e76d9b0) at /data/bld/10.5-asan/sql/sql_base.cc:5250
      #10 0x000055943cee7e62 in open_and_lock_tables (thd=0x62b000069218, tables=0x62b000038420, derived=true, flags=0) at /data/bld/10.5-asan/sql/sql_base.h:509
      #11 0x000055943d05eee2 in mysql_insert (thd=0x62b000069218, table_list=0x62b000038420, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_UPDATE, ignore=true, result=0x0) at /data/bld/10.5-asan/sql/sql_insert.cc:760
      #12 0x000055943d12b81a in mysql_execute_command (thd=0x62b000069218) at /data/bld/10.5-asan/sql/sql_parse.cc:4650
      #13 0x000055943d144241 in mysql_parse (thd=0x62b000069218, rawbuf=0x62b000038238 "INSERT IGNORE INTO current_timestamp_db.C (c14) VALUES (NULL) ON DUPLICATE KEY UPDATE c27 = '2026-12-03 17:31:26.014713'", length=120, parser_state=0x7f108e76ec70, is_com_multi=false, is_next_command=false) at /data/bld/10.5-asan/sql/sql_parse.cc:8237
      #14 0x000055943d119527 in dispatch_command (command=COM_QUERY, thd=0x62b000069218, packet=0x629000235219 "INSERT IGNORE INTO current_timestamp_db.C (c14) VALUES (NULL) ON DUPLICATE KEY UPDATE c27 = '2026-12-03 17:31:26.014713'", packet_length=120, is_com_multi=false, is_next_command=false) at /data/bld/10.5-asan/sql/sql_parse.cc:1891
      #15 0x000055943d115eba in do_command (thd=0x62b000069218) at /data/bld/10.5-asan/sql/sql_parse.cc:1375
      #16 0x000055943d56fac7 in do_handle_one_connection (connect=0x608000002ab8, put_in_cache=true) at /data/bld/10.5-asan/sql/sql_connect.cc:1407
      #17 0x000055943d56f62d in handle_one_connection (arg=0x608000002a38) at /data/bld/10.5-asan/sql/sql_connect.cc:1319
      #18 0x000055943e1cdb14 in pfs_spawn_thread (arg=0x615000006c18) at /data/bld/10.5-asan/storage/perfschema/pfs.cc:2201
      #19 0x00007f1097ca8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #20 0x00007f1097d2861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      I suppose it can crash in other places, too.

      Fails the same way on release and debug builds.

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.