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

Assertion `null_ref_table' failed in virtual table_map Item_direct_view_ref::used_tables() const on 2nd execution of PS

    XMLWordPrintable

Details

    • 5.5.55, 5.5.58

    Description

      CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM;
      CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
      INSERT INTO t1 VALUES ('a'),('b');
       
      CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM;
      INSERT INTO t2 VALUES ('c'),('d');
       
      PREPARE stmt FROM "SELECT * FROM v1 WHERE f1 = SOME ( SELECT f2 FROM t2 )";
      EXECUTE stmt;
      EXECUTE stmt;

      Stack trace from 5.5 commit ceba41c0951d1d8c9b4961772b4a088769814a66

      mysqld: /src/5.5/sql/item.cc:9873: virtual table_map Item_direct_view_ref::used_tables() const: Assertion `null_ref_table' failed.
      160223 23:53:41 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fa6ed15b1d2 in __assert_fail () from /lib64/libc.so.6
      #8  0x00000000007fbd04 in Item_direct_view_ref::used_tables (this=0x7fa6e87acd38) at /src/5.5/sql/item.cc:9873
      #9  0x00000000007638a3 in get_bound_sj_equalities (sj_nest=0x7fa6e87acec0, remaining_tables=3) at /src/5.5/sql/opt_subselect.cc:3196
      #10 0x00000000006917d3 in Loose_scan_opt::init (this=0x7fa6eeba93c0, join=0x7fa6e87c63b0, s=0x7fa6e87c7830, remaining_tables=3) at /src/5.5/sql/opt_subselect.h:133
      #11 0x000000000065fe10 in best_access_path (join=0x7fa6e87c63b0, s=0x7fa6e87c7830, remaining_tables=3, idx=0, disable_jbuf=true, record_count=1, pos=0x7fa6e87c7d78, loose_scan_pos=0x7fa6eeba95a0) at /src/5.5/sql/sql_select.cc:5435
      #12 0x00000000006637c8 in best_extension_by_limited_search (join=0x7fa6e87c63b0, remaining_tables=3, idx=0, record_count=1, read_time=0, search_depth=62, prune_level=1) at /src/5.5/sql/sql_select.cc:7029
      #13 0x0000000000662b73 in greedy_search (join=0x7fa6e87c63b0, remaining_tables=3, search_depth=62, prune_level=1) at /src/5.5/sql/sql_select.cc:6620
      #14 0x0000000000662209 in choose_plan (join=0x7fa6e87c63b0, join_tables=3) at /src/5.5/sql/sql_select.cc:6207
      #15 0x000000000065bc83 in make_join_statistics (join=0x7fa6e87c63b0, tables_list=..., conds=0x7fa6e87c7280, keyuse_array=0x7fa6e87c66c8) at /src/5.5/sql/sql_select.cc:3800
      #16 0x0000000000652be0 in JOIN::optimize (this=0x7fa6e87c63b0) at /src/5.5/sql/sql_select.cc:1229
      #17 0x00000000006595a0 in mysql_select (thd=0x7fa6eb7c3a20, rref_pointer_array=0x7fa6e87c9280, tables=0x7fa6e87c9dc8, wild_num=0, fields=..., conds=0x7fa6e87c61a8, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184064, result=0x7fa6e87aa040, unit=0x7fa6e87c8930, select_lex=0x7fa6e87c9010) at /src/5.5/sql/sql_select.cc:3080
      #18 0x000000000064fed1 in handle_select (thd=0x7fa6eb7c3a20, lex=0x7fa6e87c8880, result=0x7fa6e87aa040, setup_tables_done_option=0) at /src/5.5/sql/sql_select.cc:319
      #19 0x0000000000629364 in execute_sqlcom_select (thd=0x7fa6eb7c3a20, all_tables=0x7fa6e87c9dc8) at /src/5.5/sql/sql_parse.cc:4689
      #20 0x0000000000622697 in mysql_execute_command (thd=0x7fa6eb7c3a20) at /src/5.5/sql/sql_parse.cc:2234
      #21 0x00000000006435be in Prepared_statement::execute (this=0x7fa6e87b3060, expanded_query=0x7fa6eebaad00, open_cursor=false) at /src/5.5/sql/sql_prepare.cc:3930
      #22 0x00000000006426fb in Prepared_statement::execute_loop (this=0x7fa6e87b3060, expanded_query=0x7fa6eebaad00, open_cursor=false, packet=0x0, packet_end=0x0) at /src/5.5/sql/sql_prepare.cc:3589
      #23 0x0000000000640833 in mysql_sql_stmt_execute (thd=0x7fa6eb7c3a20) at /src/5.5/sql/sql_prepare.cc:2738
      #24 0x00000000006226c5 in mysql_execute_command (thd=0x7fa6eb7c3a20) at /src/5.5/sql/sql_parse.cc:2244
      #25 0x000000000062be44 in mysql_parse (thd=0x7fa6eb7c3a20, rawbuf=0x7fa6e87c6078 "EXECUTE stmt", length=12, parser_state=0x7fa6eebab650) at /src/5.5/sql/sql_parse.cc:5914
      #26 0x000000000061fc36 in dispatch_command (command=COM_QUERY, thd=0x7fa6eb7c3a20, packet=0x7fa6e8d4f361 "EXECUTE stmt", packet_length=12) at /src/5.5/sql/sql_parse.cc:1079
      #27 0x000000000061edc9 in do_command (thd=0x7fa6eb7c3a20) at /src/5.5/sql/sql_parse.cc:793
      #28 0x000000000072185f in do_handle_one_connection (thd_arg=0x7fa6eb7c3a20) at /src/5.5/sql/sql_connect.cc:1269
      #29 0x00000000007215ec in handle_one_connection (arg=0x7fa6eb7c3a20) at /src/5.5/sql/sql_connect.cc:1185
      #30 0x0000000000c8b271 in pfs_spawn_thread (arg=0x7fa6eb7f3140) at /src/5.5/storage/perfschema/pfs.cc:1015
      #31 0x00007fa6ee8230a4 in start_thread () from /lib64/libpthread.so.0
      #32 0x00007fa6ed21204d in clone () from /lib64/libc.so.6

      The problem appeared in 5.5 tree with this revision:

      commit 54b998173b128bb8362b5dbafbd66c4199776937
      Author: Oleksandr Byelkin <sanja@mariadb.com>
      Date:   Thu Apr 23 20:08:57 2015 +0200
       
          MDEV-7846: Server crashes in Item_subselect::fix_fields or fails with Thread stack overrun
          
          Substitute into transformed subselects original left expression and than register its change in case it was substituted.

      Attachments

        Activity

          People

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