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

Excuting a stored procedure with a cursor with a certain combination of columns craches mysqld

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.2.3, 10.2.7, 10.2
    • 10.2.8
    • Stored routines
    • None
    • CentOS Linux release 7.3.1611 (Core) x86_64

    Description

      Executing the following stored procedure will cause a crash of mysqld.

      create procedure nah_foo()
      modifies sql data
      -- type: log
      begin
        declare l_done  boolean default false;
        declare l_text  varchar(255);
        declare l_count int;
       
        declare c_cursor cursor
        for
        select concat_ws(' ','hello','world') as hello_world
        ,      count(1)                       as count_1
        from   information_schema.TABLES
        ;
       
        declare continue handler for sqlstate '02000' set l_done = true;
       
        open c_cursor;
        loop1: loop
          fetch c_cursor
          into  l_text
          ,     l_count
          ;
       
          if (l_done) then
            close c_cursor;
            leave loop1;
          end if;
        end loop;
      end
      

      call nah_foo();
      ERROR 2013 (HY000): Lost connection to MySQL server during query
      

      Below is the error log of mysqld

      170719  2:42:19 [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.2.6-MariaDB-log
      key_buffer_size=33554432
      read_buffer_size=131072
      max_used_connections=1
      max_threads=52
      thread_count=7
      It is possible that mysqld could use up to 
      key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 146994 K  bytes of memory
      Hope that's ok; if not, decrease some variables in the equation.
       
      Thread pointer: 0x7fd400000a88
      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 = 0x7fd40cd21d70 thread_stack 0x49000
      /usr/sbin/mysqld(my_print_stacktrace+0x2e)[0x7fd426518c9e]
      /usr/sbin/mysqld(handle_fatal_signal+0x30d)[0x7fd425f6793d]
      /lib64/libpthread.so.0(+0xf370)[0x7fd4254d6370]
      /usr/sbin/mysqld(_ZN19Materialized_cursor24send_result_set_metadataEP3THDR4ListI4ItemE+0xb9)[0x7fd4260a49e9]
      /usr/sbin/mysqld(_ZN18Select_materialize24send_result_set_metadataER4ListI4ItemEj+0xe3)[0x7fd4260a4b73]
      mysys/stacktrace.c:268(my_print_stacktrace)[0x7fd425e302e9]
      sql/sql_select.cc:17930(JOIN::exec_inner())[0x7fd425e30c83]
      sql/sql_select.cc:3668(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*))[0x7fd425e30dda]
      sql/sql_select.cc:373(handle_select(THD*, LEX*, select_result*, unsigned long))[0x7fd425e3191c]
      sql/sql_parse.cc:6432(execute_sqlcom_select(THD*, TABLE_LIST*))[0x7fd425dd5586]
      sql/sql_parse.cc:3448(mysql_execute_command(THD*))[0x7fd425de1807]
      sql/sql_cursor.cc:142(mysql_open_cursor(THD*, select_result*, Server_side_cursor**))[0x7fd4260a4547]
      sql/sp_rcontext.cc:459(sp_cursor::open(THD*))[0x7fd426096d3e]
      sql/sp_head.cc:3832(sp_instr_copen::exec_core(THD*, unsigned int*))[0x7fd42608c677]
      sql/sp_head.cc:2997(sp_lex_keeper::reset_lex_and_exec_core(THD*, unsigned int*, bool, sp_instr*))[0x7fd426092649]
      sql/sp_head.cc:3818(sp_instr_copen::execute(THD*, unsigned int*))[0x7fd4260929d8]
      sql/sp_head.cc:1325(sp_head::execute(THD*, bool))[0x7fd42608f4ee]
      sql/sp_head.cc:2112(sp_head::execute_procedure(THD*, List<Item>*))[0x7fd426090c3f]
      sql/sql_parse.cc:2883(do_execute_sp(THD*, sp_head*))[0x7fd425dd4f36]
      sql/sql_parse.cc:5797(mysql_execute_command(THD*))[0x7fd425dddf42]
      sql/sql_parse.cc:7875(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x7fd425de4dee]
      sql/sql_parse.cc:1812(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x7fd425de7c2f]
      sql/sql_parse.cc:1364(do_command(THD*))[0x7fd425de87d1]
      sql/sql_connect.cc:1354(do_handle_one_connection(CONNECT*))[0x7fd425ea883a]
      sql/sql_connect.cc:1262(handle_one_connection)[0x7fd425ea895d]
      /lib64/libpthread.so.0(+0x7dc5)[0x7fd4254cedc5]
      /lib64/libc.so.6(clone+0x6d)[0x7fd423b2176d]
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x7fd400011100): call nah_foo()
      Connection ID (thread ID): 23
      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
      

      This stored procedure is running fine on MariaDB 10.1.x.

      Attachments

        Issue Links

          Activity

            People

              igor Igor Babaev
              water P.R. Water
              Votes:
              2 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.