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

Server crash or hang in Item_ref::real_item

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4(EOL), 10.5, 10.6, 10.9(EOL), 10.10(EOL), 10.11, 11.0(EOL), 11.1(EOL)
    • 10.5, 10.6, 10.11
    • Optimizer
    • None

    Description

      CREATE TABLE t1 (a INT) ENGINE=MyISAM;
      INSERT INTO t1 VALUES (1);
       
      CREATE TABLE t2 (b INT);
      INSERT INTO t2 VALUES (2),(3);
       
      CREATE TABLE t3 (c INT);
      INSERT INTO t3 VALUES (4),(5);
       
      SELECT COUNT(*) FROM (SELECT * FROM t1) AS t1 JOIN t2 ON (t2.b = t1.a) WHERE NOT EXISTS (SELECT * FROM t3 WHERE t3.c = t1.a AND t3.c = t2.b);
       
      # Cleanup
      DROP TABLE t1, t2, t3;
      

      A debug build crashes:

      10.4 b54e4bf0

      Thread 1 (Thread 0x7ff3bb7b46c0 (LWP 1180168)):
      #0  0x000055818aec7c50 in Item_ref::real_item (this=0x0) at /data/src/10.4/sql/item.h:5481
      #1  0x000055818aec7c92 in Item_ref::real_item (this=0x7ff37006cfe0) at /data/src/10.4/sql/item.h:5483
      #2  0x000055818aec7c92 in Item_ref::real_item (this=0x7ff37006cfe0) at /data/src/10.4/sql/item.h:5483
      ...
      #9066 0x000055818aec7c92 in Item_ref::real_item (this=0x7ff37006cba0) at /data/src/10.4/sql/item.h:5483
      #9067 0x000055818b2f63de in Item_direct_view_ref::replace_equal_field (this=0x7ff37006cba0, thd=0x7ff370000da0, arg=0x7ff3bb7b2080 "x\344\006p\363\177") at /data/src/10.4/sql/item.cc:9296
      #9068 0x000055818b2f288f in Item_ref::transform (this=0x7ff37006cba0, thd=0x7ff370000da0, transformer=&virtual Item::replace_equal_field(THD*, unsigned char*), arg=0x7ff3bb7b2080 "x\344\006p\363\177") at /data/src/10.4/sql/item.cc:8195
      #9069 0x000055818b34c66c in Item_args::transform_args (this=0x7ff37006d640, thd=0x7ff370000da0, transformer=&virtual table offset 1216, arg=0x7ff3bb7b2080 "x\344\006p\363\177") at /data/src/10.4/sql/item_func.cc:474
      #9070 0x000055818b384ad0 in Item_row::transform (this=0x7ff37006d5c0, thd=0x7ff370000da0, transformer=&virtual table offset 1216, arg=0x7ff3bb7b2080 "x\344\006p\363\177") at /data/src/10.4/sql/item_row.cc:155
      #9071 0x000055818b30becf in Item_in_optimizer::transform (this=0x7ff37006cd18, thd=0x7ff370000da0, transformer=&virtual table offset 1216, argument=0x7ff3bb7b2080 "x\344\006p\363\177") at /data/src/10.4/sql/item_cmpfunc.cc:1727
      #9072 0x000055818b318977 in Item_cond::do_transform (this=0x7ff37006e0a0, thd=0x7ff370000da0, transformer=&virtual table offset 1216, arg=0x7ff3bb7b2080 "x\344\006p\363\177", toplevel=false) at /data/src/10.4/sql/item_cmpfunc.cc:5071
      #9073 0x000055818b326180 in Item_cond::transform (this=0x7ff37006e0a0, thd=0x7ff370000da0, transformer=&virtual table offset 1216, arg=0x7ff3bb7b2080 "x\344\006p\363\177") at /data/src/10.4/sql/item_cmpfunc.h:3021
      #9074 0x000055818b34c66c in Item_args::transform_args (this=0x7ff37001a260, thd=0x7ff370000da0, transformer=&virtual table offset 1216, arg=0x7ff3bb7b2080 "x\344\006p\363\177") at /data/src/10.4/sql/item_func.cc:474
      #9075 0x000055818b34c7ac in Item_func::transform (this=0x7ff37001a1d8, thd=0x7ff370000da0, transformer=&virtual table offset 1216, argument=0x7ff3bb7b2080 "x\344\006p\363\177") at /data/src/10.4/sql/item_func.cc:510
      #9076 0x000055818afd69e4 in substitute_for_best_equal_field (thd=0x7ff370000da0, context_tab=0x1, cond=0x7ff37001a1d8, cond_equal=0x7ff37006e2a8, table_join_idx=0x7ff370071618, do_substitution=true) at /data/src/10.4/sql/sql_select.cc:16295
      #9077 0x000055818afd655d in substitute_for_best_equal_field (thd=0x7ff370000da0, context_tab=0x1, cond=0x7ff37006e1b8, cond_equal=0x7ff37006e2a8, table_join_idx=0x7ff370071618, do_substitution=true) at /data/src/10.4/sql/sql_select.cc:16202
      #9078 0x000055818afae206 in JOIN::optimize_stage2 (this=0x7ff37006b618) at /data/src/10.4/sql/sql_select.cc:2513
      #9079 0x000055818afad9e4 in JOIN::optimize_inner (this=0x7ff37006b618) at /data/src/10.4/sql/sql_select.cc:2394
      #9080 0x000055818afab124 in JOIN::optimize (this=0x7ff37006b618) at /data/src/10.4/sql/sql_select.cc:1711
      #9081 0x000055818afb6bbe in mysql_select (thd=0x7ff370000da0, tables=0x7ff3700165b8, wild_num=0, fields=..., conds=0x7ff37001a1d8, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7ff37001a3b8, unit=0x7ff370004cd8, select_lex=0x7ff370014970) at /data/src/10.4/sql/sql_select.cc:4812
      #9082 0x000055818afa5a97 in handle_select (thd=0x7ff370000da0, lex=0x7ff370004c18, result=0x7ff37001a3b8, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:442
      #9083 0x000055818af685b8 in execute_sqlcom_select (thd=0x7ff370000da0, all_tables=0x7ff3700165b8) at /data/src/10.4/sql/sql_parse.cc:6473
      #9084 0x000055818af5eaba in mysql_execute_command (thd=0x7ff370000da0) at /data/src/10.4/sql/sql_parse.cc:3976
      #9085 0x000055818af6c751 in mysql_parse (thd=0x7ff370000da0, rawbuf=0x7ff3700147f8 "SELECT COUNT(*) FROM (SELECT * FROM t1) AS t1 JOIN t2 ON (t2.b = t1.a) WHERE NOT EXISTS (SELECT * FROM t3 WHERE t3.c = t1.a AND t3.c = t2.b)", length=140, parser_state=0x7ff3bb7b33c0, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8010
      #9086 0x000055818af580fe in dispatch_command (command=COM_QUERY, thd=0x7ff370000da0, packet=0x7ff37000ac51 "SELECT COUNT(*) FROM (SELECT * FROM t1) AS t1 JOIN t2 ON (t2.b = t1.a) WHERE NOT EXISTS (SELECT * FROM t3 WHERE t3.c = t1.a AND t3.c = t2.b)", packet_length=140, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1857
      #9087 0x000055818af56965 in do_command (thd=0x7ff370000da0) at /data/src/10.4/sql/sql_parse.cc:1378
      #9088 0x000055818b0f7a3e in do_handle_one_connection (connect=0x55818dd2ec20) at /data/src/10.4/sql/sql_connect.cc:1420
      #9089 0x000055818b0f77a6 in handle_one_connection (arg=0x55818dd2ec20) at /data/src/10.4/sql/sql_connect.cc:1324
      #9090 0x000055818b64aa36 in pfs_spawn_thread (arg=0x55818dd752f0) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #9091 0x00007ff3c66a7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #9092 0x00007ff3c67285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Hang on a non-debug build (stack trace from the hanging server, CPU at 100%):

      10.4 e146940a

      Thread 6 (Thread 0x7fef8c8496c0 (LWP 1178347) "mysqld"):
      #0  Item_ref::real_item (this=0x7fef7c039eb8) at /data/src/10.4/sql/item.h:5483
      #1  0x000055e25ed05455 in Item_ref::real_item (this=0x7fef7c039a78) at /data/src/10.4/sql/item.h:5483
      #2  Item_direct_view_ref::replace_equal_field (this=0x7fef7c039a78, thd=0x7fef7c000c58, arg=0x7fef8c847400 "P\263\003|\357\177") at /data/src/10.4/sql/item.cc:9296
      #3  0x000055e25ed53a69 in Item_args::transform_args (this=this@entry=0x7fef7c03a518, thd=thd@entry=0x7fef7c000c58, transformer=&virtual table offset 1216, arg=arg@entry=0x7fef8c847400 "P\263\003|\357\177") at /data/src/10.4/sql/item_func.cc:465
      #4  0x000055e25ed78470 in Item_row::transform (this=0x7fef7c03a498, thd=0x7fef7c000c58, transformer=<optimized out>, arg=0x7fef8c847400 "P\263\003|\357\177") at /data/src/10.4/sql/item_row.cc:155
      #5  0x000055e25ed29703 in Item_in_optimizer::transform (this=0x7fef7c039bf0, thd=0x7fef7c000c58, transformer=&virtual table offset 1216, argument=0x7fef8c847400 "P\263\003|\357\177") at /data/src/10.4/sql/item_cmpfunc.cc:1727
      #6  0x000055e25ed2cf42 in Item_cond::do_transform (this=0x7fef7c03af78, thd=0x7fef7c000c58, transformer=&virtual table offset 1216, arg=0x7fef8c847400 "P\263\003|\357\177", toplevel=false) at /data/src/10.4/sql/item_cmpfunc.cc:5071
      #7  0x000055e25ed53a69 in Item_args::transform_args (this=this@entry=0x7fef7c015b78, thd=thd@entry=0x7fef7c000c58, transformer=&virtual table offset 1216, arg=arg@entry=0x7fef8c847400 "P\263\003|\357\177") at /data/src/10.4/sql/item_func.cc:465
      #8  0x000055e25ed53ac3 in Item_func::transform (this=0x7fef7c015af0, thd=0x7fef7c000c58, transformer=<optimized out>, argument=0x7fef8c847400 "P\263\003|\357\177") at /data/src/10.4/sql/item_func.cc:501
      #9  0x000055e25eb4b7c0 in substitute_for_best_equal_field (thd=thd@entry=0x7fef7c000c58, context_tab=context_tab@entry=0x1, cond=<optimized out>, cond@entry=0x7fef7c015af0, cond_equal=cond_equal@entry=0x7fef7c03b180, table_join_idx=table_join_idx@entry=0x7fef7c03d940, do_substitution=do_substitution@entry=true) at /data/src/10.4/sql/sql_select.cc:16295
      #10 0x000055e25eb4b839 in substitute_for_best_equal_field (thd=0x7fef7c000c58, context_tab=context_tab@entry=0x1, cond=0x7fef7c03b090, cond_equal=0x7fef7c03b180, table_join_idx=0x7fef7c03d940, do_substitution=do_substitution@entry=true) at /data/src/10.4/sql/sql_select.cc:16202
      #11 0x000055e25eb699c7 in JOIN::optimize_stage2 (this=this@entry=0x7fef7c0384e0) at /data/src/10.4/sql/sql_select.cc:2513
      #12 0x000055e25eb6d753 in JOIN::optimize_inner (this=this@entry=0x7fef7c0384e0) at /data/src/10.4/sql/sql_select.cc:2394
      #13 0x000055e25eb6f93d in JOIN::optimize (this=this@entry=0x7fef7c0384e0) at /data/src/10.4/sql/sql_select.cc:1711
      #14 0x000055e25eb703e1 in mysql_select (thd=thd@entry=0x7fef7c000c58, tables=0x7fef7c011ed0, wild_num=0, fields=..., conds=0x7fef7c015af0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fef7c015cf0, unit=0x7fef7c0049d0, select_lex=0x7fef7c010288) at /data/src/10.4/sql/sql_select.cc:4812
      #15 0x000055e25eb70e23 in handle_select (thd=thd@entry=0x7fef7c000c58, lex=lex@entry=0x7fef7c004910, result=result@entry=0x7fef7c015cf0, setup_tables_done_option=setup_tables_done_option@entry=0) at /data/src/10.4/sql/sql_select.cc:442
      #16 0x000055e25eb057ec in execute_sqlcom_select (thd=thd@entry=0x7fef7c000c58, all_tables=0x7fef7c011ed0) at /data/src/10.4/sql/sql_parse.cc:6473
      #17 0x000055e25eb11b5b in mysql_execute_command (thd=thd@entry=0x7fef7c000c58) at /data/src/10.4/sql/sql_parse.cc:3976
      #18 0x000055e25eb133d0 in mysql_parse (thd=thd@entry=0x7fef7c000c58, rawbuf=<optimized out>, length=140, parser_state=parser_state@entry=0x7fef8c848540, is_com_multi=is_com_multi@entry=false, is_next_command=<optimized out>) at /data/src/10.4/sql/sql_parse.cc:8008
      #19 0x000055e25eb15095 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7fef7c000c58, packet=packet@entry=0x7fef7c007d69 "SELECT COUNT(*) FROM (SELECT * FROM t1) AS t1 JOIN t2 ON (t2.b = t1.a) WHERE NOT EXISTS (SELECT * FROM t3 WHERE t3.c = t1.a AND t3.c = t2.b)", packet_length=packet_length@entry=140, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.4/sql/sql_parse.cc:1857
      #20 0x000055e25eb16b98 in do_command (thd=0x7fef7c000c58) at /data/src/10.4/sql/sql_parse.cc:1378
      #21 0x000055e25ebfbea4 in do_handle_one_connection (connect=connect@entry=0x55e2616a7eb8) at /data/src/10.4/sql/sql_connect.cc:1420
      #22 0x000055e25ebfbff4 in handle_one_connection (arg=arg@entry=0x55e2616a7eb8) at /data/src/10.4/sql/sql_connect.cc:1324
      #23 0x000055e25ef1ab60 in pfs_spawn_thread (arg=0x55e2615ffa58) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #24 0x00007fef928a7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #25 0x00007fef929285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.