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

Server crashes in find_field_in_tables (#2)

    XMLWordPrintable

    Details

      Description

      MDEV-11072 is now fixed, but the test case below causes a similar crash.

      CREATE TABLE t1 (a INT);
      INSERT INTO t1 VALUES (1),(2);
      CREATE TABLE t2 (b INT);
      INSERT INTO t2 VALUES (3);
      CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
       
      SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f;
      

      Stack trace from 10.2 commit b162068456

      #3  <signal handler called>
      #4  0x00007f536ee10ed2 in find_field_in_tables (thd=0x7f5363416070, item=0x7f53635193a0, first_table=0x7f5363464ea8, last_table=0x0, ref=0x7f536346a068, report_error=IGNORE_EXCEPT_NON_UNIQUE, check_privileges=true, register_tree_change=true) at /data/src/10.2/sql/sql_base.cc:5736
      #5  0x00007f536f101837 in Item_field::fix_fields (this=0x7f53635193a0, thd=0x7f5363416070, reference=0x7f536346a068) at /data/src/10.2/sql/item.cc:5247
      #6  0x00007f536f113a39 in Item_direct_ref::fix_fields (this=0x7f53635192b0, thd=0x7f5363416070, it=0x7f536346a060) at /data/src/10.2/sql/item.h:4309
      #7  0x00007f536f113a39 in Item_direct_ref::fix_fields (this=0x7f53635191c0, thd=0x7f5363416070, it=0x7f5363519628) at /data/src/10.2/sql/item.h:4309
      #8  0x00007f536f1534eb in Item_func::fix_fields (this=0x7f5363519590, thd=0x7f5363416070, ref=0x7f53634697c0) at /data/src/10.2/sql/item_func.cc:209
      #9  0x00007f536eeb9440 in JOIN::optimize_inner (this=0x7f53634693c8) at /data/src/10.2/sql/sql_select.cc:1255
      #10 0x00007f536eeb8b72 in JOIN::optimize (this=0x7f53634693c8) at /data/src/10.2/sql/sql_select.cc:1076
      #11 0x00007f536ee4a8cf in mysql_derived_optimize (thd=0x7f5363416070, lex=0x7f5363419a80, derived=0x7f5363464ea8) at /data/src/10.2/sql/sql_derived.cc:866
      #12 0x00007f536ee492fc in mysql_handle_single_derived (lex=0x7f5363419a80, derived=0x7f5363464ea8, phases=4) at /data/src/10.2/sql/sql_derived.cc:197
      #13 0x00007f536eeb96eb in JOIN::optimize_inner (this=0x7f5363468db0) at /data/src/10.2/sql/sql_select.cc:1295
      #14 0x00007f536eeb8b72 in JOIN::optimize (this=0x7f5363468db0) at /data/src/10.2/sql/sql_select.cc:1076
      #15 0x00007f536ee695db in st_select_lex::optimize_unflattened_subqueries (this=0x7f536341a280, const_only=false) at /data/src/10.2/sql/sql_lex.cc:3802
      #16 0x00007f536f016ce8 in JOIN::optimize_unflattened_subqueries (this=0x7f53634686c8) at /data/src/10.2/sql/opt_subselect.cc:5047
      #17 0x00007f536eebc419 in JOIN::optimize_inner (this=0x7f53634686c8) at /data/src/10.2/sql/sql_select.cc:2132
      #18 0x00007f536eeb8b72 in JOIN::optimize (this=0x7f53634686c8) at /data/src/10.2/sql/sql_select.cc:1076
      #19 0x00007f536eec1438 in mysql_select (thd=0x7f5363416070, tables=0x7f5363465a50, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7f5363466170, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f53634686a8, unit=0x7f5363419b48, select_lex=0x7f536341a280) at /data/src/10.2/sql/sql_select.cc:3566
      #20 0x00007f536eeb65d1 in handle_select (thd=0x7f5363416070, lex=0x7f5363419a80, result=0x7f53634686a8, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:373
      #21 0x00007f536ee82f5d in execute_sqlcom_select (thd=0x7f5363416070, all_tables=0x7f5363465a50) at /data/src/10.2/sql/sql_parse.cc:6356
      #22 0x00007f536ee78a18 in mysql_execute_command (thd=0x7f5363416070) at /data/src/10.2/sql/sql_parse.cc:3379
      #23 0x00007f536ee8691c in mysql_parse (thd=0x7f5363416070, rawbuf=0x7f5363464088 "SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f", length=73, parser_state=0x7f536ffa0dd0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7799
      #24 0x00007f536ee7466c in dispatch_command (command=COM_QUERY, thd=0x7f5363416070, packet=0x7f5363458071 "SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f", packet_length=73, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1808
      #25 0x00007f536ee73046 in do_command (thd=0x7f5363416070) at /data/src/10.2/sql/sql_parse.cc:1368
      #26 0x00007f536efba4e4 in do_handle_one_connection (connect=0x7f536b871410) at /data/src/10.2/sql/sql_connect.cc:1354
      #27 0x00007f536efba271 in handle_one_connection (arg=0x7f536b871410) at /data/src/10.2/sql/sql_connect.cc:1260
      #28 0x00007f536f2f4af8 in pfs_spawn_thread (arg=0x7f536b80f9f0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #29 0x00007f536e4b60a4 in start_thread (arg=0x7f536ffa2300) at pthread_create.c:309
      #30 0x00007f536c46387d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              igor Igor Babaev
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: