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

Server crashes in Time_and_counter_tracker::incr_loops with UNION in ALL subquery

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.1(EOL)
    • 10.1.14
    • Optimizer
    • None
    • 10.1.12

    Description

      SET NAMES utf8;
      CREATE TABLE t1 (f VARCHAR(8)) ENGINE=MyISAM;
      INSERT INTO t1 VALUES ('foo');
      SELECT f FROM t1 WHERE f > ALL ( SELECT 'bar' UNION SELECT 'baz' );

      Stack trace from 10.1 commit 7b14ba63f22e6c98c1982dae8847035ad1b8e155

      #3  <signal handler called>
      #4  0x00005598df9ab102 in Time_and_counter_tracker::incr_loops (this=0x78) at /src/10.1/sql/sql_analyze_stmt.h:97
      #5  0x00005598df96ecdb in JOIN::exec (this=0x7f45a6854fe0) at /src/10.1/sql/sql_select.cc:2516
      #6  0x00005598dfa04577 in st_select_lex_unit::exec (this=0x7f45a68535e8) at /src/10.1/sql/sql_union.cc:832
      #7  0x00005598dfc15965 in subselect_union_engine::exec (this=0x7f45a68546b0) at /src/10.1/sql/item_subselect.cc:3773
      #8  0x00005598dfc0bc92 in Item_subselect::exec (this=0x7f45a68575e8) at /src/10.1/sql/item_subselect.cc:672
      #9  0x00005598dfc0d732 in Item_singlerow_subselect::val_str (this=0x7f45a68575e8, str=0x7f45b24f1a90) at /src/10.1/sql/item_subselect.cc:1283
      #10 0x00005598dfb98dee in Item_func_conv_charset::Item_func_conv_charset (this=0x7f45a68579c0, thd=0x7f45abfc9c30, a=0x7f45a68575e8, cs=0x5598e0ac0a20 <my_charset_latin1>, cache_if_const=true) at /src/10.1/sql/item_strfunc.h:975
      #11 0x00005598dfb7dc95 in Item::safe_charset_converter (this=0x7f45a68575e8, thd=0x7f45abfc9c30, tocs=0x5598e0ac0a20 <my_charset_latin1>) at /src/10.1/sql/item.cc:1084
      #12 0x00005598dfb806ef in Item_func_or_sum::agg_item_set_converter (this=0x7f45a6857748, coll=..., fname=0x5598e033bcdf ">=", args=0x7f45a68577d0, nargs=2, flags=7, item_sep=1) at /src/10.1/sql/item.cc:2125
      #13 0x00005598dfbb06d0 in Item_func_or_sum::agg_arg_charsets (this=0x7f45a6857748, c=..., items=0x7f45a68577d0, nitems=2, flags=7, item_sep=1) at /src/10.1/sql/item.h:3714
      #14 0x00005598dfbb0718 in Item_func_or_sum::agg_arg_charsets_for_comparison (this=0x7f45a6857748, c=..., items=0x7f45a68577d0, nitems=2, item_sep=1) at /src/10.1/sql/item.h:3760
      #15 0x00005598dfb9d38e in Item_func::setup_args_and_comparator (this=0x7f45a6857748, thd=0x7f45abfc9c30, cmp=0x7f45a6857800) at /src/10.1/sql/item_cmpfunc.cc:502
      #16 0x00005598dfb9d499 in Item_bool_rowready_func2::fix_length_and_dec (this=0x7f45a6857748) at /src/10.1/sql/item_cmpfunc.cc:524
      #17 0x00005598dfbcc2ba in Item_func::fix_fields (this=0x7f45a6857748, thd=0x7f45abfc9c30, ref=0x7f45b24f1ef0) at /src/10.1/sql/item_func.cc:234
      #18 0x00005598dfc0f4b1 in Item_allany_subselect::transform_into_max_min (this=0x7f45a68544e8, join=0x7f45a6854fe0) at /src/10.1/sql/item_subselect.cc:1957
      #19 0x00005598dfab1741 in JOIN::transform_max_min_subquery (this=0x7f45a6854fe0) at /src/10.1/sql/opt_subselect.cc:890
      #20 0x00005598df969f7a in JOIN::optimize_inner (this=0x7f45a6854fe0) at /src/10.1/sql/sql_select.cc:1131
      #21 0x00005598df969bbc in JOIN::optimize (this=0x7f45a6854fe0) at /src/10.1/sql/sql_select.cc:1036
      #22 0x00005598df920987 in st_select_lex::optimize_unflattened_subqueries (this=0x7f45abfcdd48, const_only=false) at /src/10.1/sql/sql_lex.cc:3567
      #23 0x00005598dfabb6a4 in JOIN::optimize_unflattened_subqueries (this=0x7f45a68548a0) at /src/10.1/sql/opt_subselect.cc:5039
      #24 0x00005598df96c6c8 in JOIN::optimize_inner (this=0x7f45a68548a0) at /src/10.1/sql/sql_select.cc:1817
      #25 0x00005598df969bbc in JOIN::optimize (this=0x7f45a68548a0) at /src/10.1/sql/sql_select.cc:1036
      #26 0x00005598df972251 in mysql_select (thd=0x7f45abfc9c30, rref_pointer_array=0x7f45abfcdfc0, tables=0x7f45a6852b88, wild_num=0, fields=..., conds=0x7f45a68546e8, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f45a6854880, unit=0x7f45abfcd648, select_lex=0x7f45abfcdd48) at /src/10.1/sql/sql_select.cc:3437
      #27 0x00005598df967d89 in handle_select (thd=0x7f45abfc9c30, lex=0x7f45abfcd580, result=0x7f45a6854880, setup_tables_done_option=0) at /src/10.1/sql/sql_select.cc:384
      #28 0x00005598df938133 in execute_sqlcom_select (thd=0x7f45abfc9c30, all_tables=0x7f45a6852b88) at /src/10.1/sql/sql_parse.cc:5903
      #29 0x00005598df92e20d in mysql_execute_command (thd=0x7f45abfc9c30) at /src/10.1/sql/sql_parse.cc:2962
      #30 0x00005598df93b77a in mysql_parse (thd=0x7f45abfc9c30, rawbuf=0x7f45a6852948 "SELECT f FROM t1 WHERE f > ALL ( SELECT 'bar' UNION SELECT 'baz' )", length=66, parser_state=0x7f45b24f35e0) at /src/10.1/sql/sql_parse.cc:7303
      #31 0x00005598df92a474 in dispatch_command (command=COM_QUERY, thd=0x7f45abfc9c30, packet=0x7f45ab1c98f1 "SELECT f FROM t1 WHERE f > ALL ( SELECT 'bar' UNION SELECT 'baz' )", packet_length=66) at /src/10.1/sql/sql_parse.cc:1488
      #32 0x00005598df9291a6 in do_command (thd=0x7f45abfc9c30) at /src/10.1/sql/sql_parse.cc:1109
      #33 0x00005598dfa5e798 in do_handle_one_connection (thd_arg=0x7f45abfc9c30) at /src/10.1/sql/sql_connect.cc:1349
      #34 0x00005598dfa5e4fc in handle_one_connection (arg=0x7f45abfc9c30) at /src/10.1/sql/sql_connect.cc:1261
      #35 0x00005598e0164bf2 in pfs_spawn_thread (arg=0x7f45aabb0e70) at /src/10.1/storage/perfschema/pfs.cc:1860
      #36 0x00007f45b216e0a4 in start_thread () from /lib64/libpthread.so.0

      Attachments

        Activity

          It is attempt to get value of the subquery during its optimization due to trying to get value of constant item which lead to the subquery back.

          sanja Oleksandr Byelkin added a comment - It is attempt to get value of the subquery during its optimization due to trying to get value of constant item which lead to the subquery back.

          why it is not expensive?

          sanja Oleksandr Byelkin added a comment - why it is not expensive?

          it was not expensive because it was in the middle of optimization

          sanja Oleksandr Byelkin added a comment - it was not expensive because it was in the middle of optimization

          revision-id: b1ddc7d546e6b147838af72dd03f86a8b272fdf0 (mariadb-10.1.11-18-gb1ddc7d)
          parent(s): fd8e846a3b049903706267d58e6d8e61eea97df8
          committer: Oleksandr Byelkin
          timestamp: 2016-02-21 22:12:25 +0100
          message:

          MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops with UNION in ALL subquery

          Do not mark subquery as inexpensive when it is not optimized.

          sanja Oleksandr Byelkin added a comment - revision-id: b1ddc7d546e6b147838af72dd03f86a8b272fdf0 (mariadb-10.1.11-18-gb1ddc7d) parent(s): fd8e846a3b049903706267d58e6d8e61eea97df8 committer: Oleksandr Byelkin timestamp: 2016-02-21 22:12:25 +0100 message: MDEV-9487 : Server crashes in Time_and_counter_tracker::incr_loops with UNION in ALL subquery Do not mark subquery as inexpensive when it is not optimized. —

          Review feedback provided over email

          psergei Sergei Petrunia added a comment - Review feedback provided over email

          People

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