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

Crash when VALUES in derived table contains expressions

    XMLWordPrintable

Details

    Description

      Running the following query crashes the server:

      SELECT * FROM (VALUES(1+1,2)) t;

      It seems that the combination of VALUES in a derived table plus expression (as opposed to literal values) causes the problem.

      The following crashes too:

      SELECT * FROM (VALUES(now(),2)) t

      However, these don't crash:

      VALUES (now(), 2);
      VALUES (1+2, 2);
      SELECT * FROM (VALUES(1,2)) t;
      

      Reproducible on head of 10.3 branch (340c8a2a32dcbe0bb9bc88bd0a6bda5d5e76ed02).

      From the logs:

      180809 16:08:02 [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 https://mariadb.com/kb/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.3.9-MariaDB
      key_buffer_size=134217728
      read_buffer_size=131072
      max_used_connections=1
      max_threads=153
      thread_count=7
      It is possible that mysqld could use up to
      key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 467396 K  bytes of memory
      Hope that's ok; if not, decrease some variables in the equation.
       
      Thread pointer: 0x7fda140009a8
      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 = 0x7fda84191cf8 thread_stack 0x49000
      /opt/mariadb/master/bin/mysqld(my_print_stacktrace+0x2e)[0x56324db7026e]
      mysys/stacktrace.c:270(my_print_stacktrace)[0x56324d616097]
      /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7fda873bb390]
      /opt/mariadb/master/bin/mysqld(+0xd3c2eb)[0x56324dbfd2eb]
      strings/ctype-utf8.c:5304(my_strcasecmp_utf8)[0x56324d4db4a5]
      sql/sql_view.cc:143(check_duplicate_names(THD*, List<Item>&, bool))[0x56324d4018ad]
      sql/sql_derived.cc:772(mysql_derived_prepare(THD*, LEX*, TABLE_LIST*))[0x56324d401fe8]
      sql/sql_derived.cc:197(mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int))[0x56324d41cd17]
      sql/sql_lex.cc:4073(st_select_lex::handle_derived(LEX*, unsigned int))[0x56324d481269]
      sql/sql_select.cc:997(JOIN::prepare(TABLE_LIST*, unsigned int, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*))[0x56324d49137c]
      sql/sql_select.cc:4205(mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x56324d4914d8]
      sql/sql_select.cc:382(handle_select(THD*, LEX*, select_result*, unsigned long))[0x56324d352d64]
      sql/sql_parse.cc:6548(execute_sqlcom_select(THD*, TABLE_LIST*) [clone .constprop.240])[0x56324d43e6fd]
      sql/sql_parse.cc:3768(mysql_execute_command(THD*))[0x56324d44068a]
      sql/sql_parse.cc:8088(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x56324d443051]
      sql/sql_parse.cc:1850(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x56324d443b3c]
      sql/sql_parse.cc:1397(do_command(THD*))[0x56324d5146c2]
      sql/sql_connect.cc:1402(do_handle_one_connection(CONNECT*))[0x56324d51483d]
      /lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7fda873b16ba]
      x86_64/clone.S:111(clone)[0x7fda86a5c41d]
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x7fda140145f0): is an invalid pointer
      Connection ID (thread ID): 8
      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,semijoin_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,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=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.
       
      We think the query pointer is invalid, but we will try to print it anyway.
      Query: SELECT * FROM (VALUES(1,now())) t
      

      Attachments

        Activity

          People

            igor Igor Babaev
            Markus Winand Markus Winand
            Votes:
            0 Vote for this issue
            Watchers:
            5 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.