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

MariaDB server crash ( select with union and order by with subquery )

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 5.5.40, 10.0.14, 5.3.13
    • Fix Version/s: 5.5.41, 10.0.15
    • Component/s: Optimizer
    • Labels:
    • Environment:
      CentOS 6
      Fresh installation of MariaDB

      Description

      When execute this queries server will crash:
      ------------

      CREATE TABLE sample ( id INTEGER, sample_name1 VARCHAR(100), sample_name2 VARCHAR(100), PRIMARY KEY(id) );
      					
      INSERT INTO sample ( id, sample_name1, sample_name2 ) VALUES ( 1, 'aaaa', 'bbbb' ), ( 2, 'cccc', 'dddd' );
      										
      (
      	SELECT sample_name1 AS testname FROM sample
      )
      UNION
      (
      	SELECT sample_name2 AS testname FROM sample C ORDER BY (SELECT T.sample_name1 FROM sample T WHERE T.id = C.id)
      )

      ------------
      Crash messages:

      141014  9:47:29 [ERROR] mysqld got signal 11 ;
      This could be because you hit a bug. It is also possible that this binary
      or one of the libraries it was linked against is corrupt, improperly built,
      or misconfigured. This error can also be caused by malfunctioning hardware.
       
      To report this bug, see http://kb.askmonty.org/en/reporting-bugs
       
      We will try our best to scrape up some info that will hopefully help
      diagnose the problem, but since we have already crashed,
      something is definitely wrong and this may fail.
       
      Server version: 10.0.14-MariaDB-log
      key_buffer_size=268435456
      read_buffer_size=131072
      max_used_connections=1
      max_threads=102
      thread_count=2
      It is possible that mysqld could use up to
      key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 486186 K  bytes of memory
      Hope that's ok; if not, decrease some variables in the equation.
       
      Thread pointer: 0x0x7f6ea8bf5008
      Attempting backtrace. You can use the following information to find out
      where mysqld died. If you see no messages after this, something went
      terribly wrong...
      stack_bottom = 0x7f6e98d3ad30 thread_stack 0x40000
      /usr/sbin/mysqld(my_print_stacktrace+0x2b)[0xb6b85b]
      /usr/sbin/mysqld(handle_fatal_signal+0x398)[0x723f08]
      /lib64/libpthread.so.0(+0xf710)[0x7f6f0b486710]
      /usr/sbin/mysqld(_ZN10Item_field15fix_outer_fieldEP3THDPP5FieldPP4Item+0xce)[0x7440be]
      /usr/sbin/mysqld(_ZN10Item_field10fix_fieldsEP3THDPP4Item+0x555)[0x744dd5]
      /usr/sbin/mysqld(_ZN9Item_func10fix_fieldsEP3THDPP4Item+0x198)[0x772ac8]
      /usr/sbin/mysqld(_Z11setup_condsP3THDP10TABLE_LISTR4ListIS1_EPP4Item+0x19c)[0x592f0c]
      /usr/sbin/mysqld[0x6125c2]
      /usr/sbin/mysqld(_ZN30subselect_single_select_engine7prepareEv+0x125)[0x7a0635]
      /usr/sbin/mysqld(_ZN14Item_subselect10fix_fieldsEP3THDPP4Item+0xe5)[0x79de55]
      /usr/sbin/mysqld[0x5f5290]
      /usr/sbin/mysqld[0x612fc4]
      /usr/sbin/mysqld(_ZN18st_select_lex_unit7prepareEP3THDP13select_resultm+0x32d)[0x65fcad]
      /usr/sbin/mysqld(_Z11mysql_unionP3THDP3LEXP13select_resultP18st_select_lex_unitm+0x1f)[0x66056f]
      /usr/sbin/mysqld(_Z13handle_selectP3THDP3LEXP13select_resultm+0x85)[0x623145]
      /usr/sbin/mysqld[0x5cac06]
      /usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x4c97)[0x5d58d7]
      /usr/sbin/mysqld[0x5d7402]
      /usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x1b20)[0x5d95c0]
      /usr/sbin/mysqld(_Z24do_handle_one_connectionP3THD+0x453)[0x6946a3]
      /usr/sbin/mysqld(handle_one_connection+0x42)[0x694772]
      /lib64/libpthread.so.0(+0x79d1)[0x7f6f0b47e9d1]
      /lib64/libc.so.6(clone+0x6d)[0x7f6f09b9cb6d]
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x7f6e98843020): is an invalid pointer
      Connection ID (thread ID): 4
      Status: NOT_KILLED
       
      Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_
      keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,sem
      ijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on
       
      The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
      information that should help you find out what is causing the crash.
      141014 09:47:29 mysqld_safe Number of processes running now: 0
      141014 09:47:29 mysqld_safe mysqld restarted

      ------

      Same queries run without problem on clean MySQL 5.6.16 installation.
      I also tried to disable optimization switches like this:

      SET optimizer_switch='derived_merge=off';
      SET optimizer_switch='derived_with_keys=off';
      SET optimizer_switch='engine_condition_pushdown=off';
      SET optimizer_switch='exists_to_in=off';
      SET optimizer_switch='extended_keys=off';
      SET optimizer_switch='firstmatch=off';
      SET optimizer_switch='index_condition_pushdown=off';
      SET optimizer_switch='index_merge=off';
      SET optimizer_switch='index_merge_intersection=off';
      SET optimizer_switch='index_merge_sort_intersection=off';
      SET optimizer_switch='index_merge_sort_union=off';
      SET optimizer_switch='index_merge_union=off';
      SET optimizer_switch='in_to_exists=off'; ###################
      SET optimizer_switch='join_cache_bka=off';
      SET optimizer_switch='join_cache_hashed=off';
      SET optimizer_switch='join_cache_incremental=off';
      SET optimizer_switch='loosescan=off';
      SET optimizer_switch='mrr=off';
      SET optimizer_switch='mrr_cost_based=off';
      SET optimizer_switch='mrr_sort_keys=off';
      SET optimizer_switch='materialization=on';
      SET optimizer_switch='subquery_cache=off';
      SET optimizer_switch='semijoin=off';
      SET optimizer_switch='semijoin_with_cache=off';
      SET optimizer_switch='firstmatch=off';
      SET optimizer_switch='partial_match_rowid_merge=off';
      SET optimizer_switch='partial_match_table_scan=off';
      SET optimizer_switch='outer_join_with_cache=off';##
      SET optimizer_switch='optimize_join_buffer_size=off';##
      SET optimizer_switch='table_elimination=off';

      but not change after this, still crashing...

        Attachments

          Activity

            People

            • Assignee:
              sanja Oleksandr Byelkin
              Reporter:
              m.rygiel m.rygiel
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: