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

Server crashes in TABLE_LIST::is_materialized_derived / add_key_field

    XMLWordPrintable

Details

    Description

      Stack trace from 10.2 1168e2fa54

      #3  <signal handler called>
      #4  0x00007f50769e2eb0 in TABLE_LIST::is_materialized_derived (this=0xa5a5a5a5a5a5a5a5) at /data/src/10.2/sql/table.h:2285
      #5  0x00007f5076a56f28 in add_key_field (join=0x7f506b467310, key_fields=0x7f5077965758, and_level=0, cond=0x7f506b468e60, field=0x7f506b464eb0, eq_func=true, value=0x7f5077965678, num_values=1, usable_tables=18446744073709551615, sargables=0x7f50779658d8) at /data/src/10.2/sql/sql_select.cc:4624
      #6  0x00007f5076a5837f in Item_equal::add_key_fields (this=0x7f506b468e60, join=0x7f506b467310, key_fields=0x7f5077965758, and_level=0x7f5077965748, usable_tables=18446744073709551615, sargables=0x7f50779658d8) at /data/src/10.2/sql/sql_select.cc:5083
      #7  0x00007f5076a596b1 in update_ref_and_keys (thd=0x7f506b416070, keyuse=0x7f506b4675f0, join_tab=0x7f506b522fe8, tables=1, cond=0x7f506b468e60, normal_tables=18446744073709551615, select_lex=0x7f506b41a250, sargables=0x7f50779658d8) at /data/src/10.2/sql/sql_select.cc:5507
      #8  0x00007f5076a5472f in make_join_statistics (join=0x7f506b467310, tables_list=..., keyuse_array=0x7f506b4675f0) at /data/src/10.2/sql/sql_select.cc:3839
      #9  0x00007f5076a4c678 in JOIN::optimize_inner (this=0x7f506b467310) at /data/src/10.2/sql/sql_select.cc:1437
      #10 0x00007f5076a4b344 in JOIN::optimize (this=0x7f506b467310) at /data/src/10.2/sql/sql_select.cc:1076
      #11 0x00007f5076a53798 in mysql_select (thd=0x7f506b416070, tables=0x7f506b466908, wild_num=1, fields=..., conds=0x7f506b4670b8, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f506b4672f0, unit=0x7f506b419b18, select_lex=0x7f506b41a250) at /data/src/10.2/sql/sql_select.cc:3535
      #12 0x00007f5076a48ea1 in handle_select (thd=0x7f506b416070, lex=0x7f506b419a50, result=0x7f506b4672f0, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:373
      #13 0x00007f5076a18938 in execute_sqlcom_select (thd=0x7f506b416070, all_tables=0x7f506b466908) at /data/src/10.2/sql/sql_parse.cc:6345
      #14 0x00007f5076a0e76e in mysql_execute_command (thd=0x7f506b416070) at /data/src/10.2/sql/sql_parse.cc:3376
      #15 0x00007f5076a1c0d7 in mysql_parse (thd=0x7f506b416070, rawbuf=0x7f506b464088 "SELECT * FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 WHERE f = 8", length=85, parser_state=0x7f5077966dd0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7774
      #16 0x00007f5076a0a4c5 in dispatch_command (command=COM_QUERY, thd=0x7f506b416070, packet=0x7f506b458071 "SELECT * FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 WHERE f = 8", packet_length=85, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1805
      #17 0x00007f5076a08ef6 in do_command (thd=0x7f506b416070) at /data/src/10.2/sql/sql_parse.cc:1365
      #18 0x00007f5076b447ba in do_handle_one_connection (connect=0x7f507386d410) at /data/src/10.2/sql/sql_connect.cc:1354
      #19 0x00007f5076b44547 in handle_one_connection (arg=0x7f507386d410) at /data/src/10.2/sql/sql_connect.cc:1260
      #20 0x00007f5076e52b26 in pfs_spawn_thread (arg=0x7f50738519f0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #21 0x00007f507608d0a4 in start_thread (arg=0x7f5077968300) at pthread_create.c:309
      #22 0x00007f507424587d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
      

      Test case

      CREATE TABLE t1 (i INT);
      INSERT INTO t1 VALUES (1),(2);
      SELECT * FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 WHERE f = 8;
      


      Variation without tables

      SELECT * FROM ( SELECT * FROM ( SELECT 1 AS f ) sq1 ) AS sq2 WHERE f = 8;
      

      #3  <signal handler called>
      #4  0x00007f5d8af3af15 in add_key_field (join=0x7f5d7f866c10, key_fields=0x7f5d8be4d758, and_level=0, cond=0x7f5d7f868468, field=0x100, eq_func=true, value=0x7f5d8be4d678, num_values=1, usable_tables=18446744073709551615, sargables=0x7f5d8be4d8d8) at /data/src/10.2/sql/sql_select.cc:4624
      #5  0x00007f5d8af3c37f in Item_equal::add_key_fields (this=0x7f5d7f868468, join=0x7f5d7f866c10, key_fields=0x7f5d8be4d758, and_level=0x7f5d8be4d748, usable_tables=18446744073709551615, sargables=0x7f5d8be4d8d8) at /data/src/10.2/sql/sql_select.cc:5083
      #6  0x00007f5d8af3d6b1 in update_ref_and_keys (thd=0x7f5d7f816070, keyuse=0x7f5d7f866ef0, join_tab=0x7f5d7f868ab0, tables=1, cond=0x7f5d7f868468, normal_tables=18446744073709551615, select_lex=0x7f5d7f81a250, sargables=0x7f5d8be4d8d8) at /data/src/10.2/sql/sql_select.cc:5507
      #7  0x00007f5d8af3872f in make_join_statistics (join=0x7f5d7f866c10, tables_list=..., keyuse_array=0x7f5d7f866ef0) at /data/src/10.2/sql/sql_select.cc:3839
      #8  0x00007f5d8af30678 in JOIN::optimize_inner (this=0x7f5d7f866c10) at /data/src/10.2/sql/sql_select.cc:1437
      #9  0x00007f5d8af2f344 in JOIN::optimize (this=0x7f5d7f866c10) at /data/src/10.2/sql/sql_select.cc:1076
      #10 0x00007f5d8af37798 in mysql_select (thd=0x7f5d7f816070, tables=0x7f5d7f866228, wild_num=1, fields=..., conds=0x7f5d7f8669d8, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f5d7f866bf0, unit=0x7f5d7f819b18, select_lex=0x7f5d7f81a250) at /data/src/10.2/sql/sql_select.cc:3535
      #11 0x00007f5d8af2cea1 in handle_select (thd=0x7f5d7f816070, lex=0x7f5d7f819a50, result=0x7f5d7f866bf0, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:373
      #12 0x00007f5d8aefc938 in execute_sqlcom_select (thd=0x7f5d7f816070, all_tables=0x7f5d7f866228) at /data/src/10.2/sql/sql_parse.cc:6345
      #13 0x00007f5d8aef276e in mysql_execute_command (thd=0x7f5d7f816070) at /data/src/10.2/sql/sql_parse.cc:3376
      #14 0x00007f5d8af000d7 in mysql_parse (thd=0x7f5d7f816070, rawbuf=0x7f5d7f8641d0 "SELECT * FROM ( SELECT * FROM ( SELECT 1 AS f ) sq1 ) AS sq2 WHERE f = 8", length=72, parser_state=0x7f5d8be4edd0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7774
      #15 0x00007f5d8aeee4c5 in dispatch_command (command=COM_QUERY, thd=0x7f5d7f816070, packet=0x7f5d7f858071 "SELECT * FROM ( SELECT * FROM ( SELECT 1 AS f ) sq1 ) AS sq2 WHERE f = 8", packet_length=72, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1805
      #16 0x00007f5d8aeecef6 in do_command (thd=0x7f5d7f816070) at /data/src/10.2/sql/sql_parse.cc:1365
      #17 0x00007f5d8b0287ba in do_handle_one_connection (connect=0x7f5d87c6d410) at /data/src/10.2/sql/sql_connect.cc:1354
      #18 0x00007f5d8b028547 in handle_one_connection (arg=0x7f5d87c6d410) at /data/src/10.2/sql/sql_connect.cc:1260
      #19 0x00007f5d8b336b26 in pfs_spawn_thread (arg=0x7f5d87c519f0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #20 0x00007f5d8a5710a4 in start_thread (arg=0x7f5d8be50300) at pthread_create.c:309
      #21 0x00007f5d8872987d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
      

      The problem started happening after recent merges, but I can't point at the exact commit which caused it.

      Attachments

        Activity

          People

            igor Igor Babaev
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.