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

Server crashes after the 2.nd execution of ps, query with ORDER BY (window function)

    XMLWordPrintable

    Details

      Description

      CREATE TABLE t1 (i int);
      INSERT INTO t1 (i) VALUES (1),(2),(3);
       
      prepare stmt from "SELECT  1 FROM t1 ORDER BY COUNT(i) OVER (), MIN(1) OVER ();";
      execute stmt;
      execute stmt;
      

      10.2 dd9e5827a68c7864d61a

      Version: '10.2.38-MariaDB-debug-log' 
      210303  9:30:43 [ERROR] mysqld got signal 11 ;
       
      Server version: 10.2.38-MariaDB-debug-log
       
      sql/signal_handler.cc:209(handle_fatal_signal)[0x55dd5e49adb0]
      /lib/x86_64-linux-gnu/libpthread.so.0(+0x12730)[0x7ff27db76730]
      sql/item_sum.cc:2081(Item_sum_hybrid::clear())[0x55dd5e6d3614]
      sql/sql_window.cc:2666(compute_window_func(THD*, List<Item_window_func>&, List<Cursor_manager>&, TABLE*, SORT_INFO*))[0x55dd5e3077a3]
      sql/sql_window.cc:2782(Window_func_runner::exec(THD*, TABLE*, SORT_INFO*))[0x55dd5e307ead]
      sql/sql_window.cc:2810(Window_funcs_sort::exec(JOIN*, bool))[0x55dd5e3080fe]
      sql/sql_window.cc:2937(Window_funcs_computation::exec(JOIN*, bool))[0x55dd5e308dbd]
      sql/sql_select.cc:26850(AGGR_OP::end_send())[0x55dd5dfa4009]
      sql/sql_select.cc:18574(sub_select_postjoin_aggr(JOIN*, st_join_table*, bool))[0x55dd5df652e6]
      sql/sql_select.cc:18810(sub_select(JOIN*, st_join_table*, bool))[0x55dd5df65e8c]
      sql/sql_select.cc:18405(do_select(JOIN*, Procedure*))[0x55dd5df64366]
      sql/sql_select.cc:3642(JOIN::exec_inner())[0x55dd5defb44e]
      sql/sql_select.cc:3438(JOIN::exec())[0x55dd5def8fc0]
      sql/sql_select.cc:3839(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*))[0x55dd5defc620]
      sql/sql_select.cc:361(handle_select(THD*, LEX*, select_result*, unsigned long))[0x55dd5ded9192]
      sql/sql_parse.cc:6275(execute_sqlcom_select(THD*, TABLE_LIST*))[0x55dd5de4cc3d]
      sql/sql_parse.cc:3586(mysql_execute_command(THD*))[0x55dd5de383d8]
      sql/sql_prepare.cc:5053(Prepared_statement::execute(String*, bool))[0x55dd5dea7e60]
      sql/sql_prepare.cc:4482(Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*))[0x55dd5dea35a0]
      sql/sql_prepare.cc:3575(mysql_sql_stmt_execute(THD*))[0x55dd5de9d941]
      sql/sql_parse.cc:3603(mysql_execute_command(THD*))[0x55dd5de3841d]
      sql/sql_parse.cc:7790(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x55dd5de55fb6]
      sql/sql_parse.cc:1830(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x55dd5de2cf06]
      sql/sql_parse.cc:1381(do_command(THD*))[0x55dd5de2992b]
      sql/sql_connect.cc:1336(do_handle_one_connection(CONNECT*))[0x55dd5e1d184a]
      sql/sql_connect.cc:1242(handle_one_connection)[0x55dd5e1d110b]
      perfschema/pfs.cc:1871(pfs_spawn_thread)[0x55dd5f66b900]
      nptl/pthread_create.c:487(start_thread)[0x7ff27db6bfa3]
      x86_64/clone.S:97(clone)[0x7ff27d4ef4cf]
       
      Query (0x62b000000340): SELECT  1 FROM t1 ORDER BY COUNT(i) OVER (), MIN(1) OVER ()
      

      on 10.3-10.5

      10.5 01b44c054d608c7a7c3ee7

      Thread 1 (Thread 0x7f40780cd700 (LWP 21211)):
      #0  __pthread_kill (threadid=<optimized out>, signo=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
      #1  0x000055c7c17fbeb5 in my_write_core (sig=11) at /10.5/mysys/stacktrace.c:424
      #2  0x000055c7c0ecdfce in handle_fatal_signal (sig=11) at /10.5/sql/signal_handler.cc:331
      #3  <signal handler called>
      #4  0x0000000000000000 in ?? ()
      #5  0x000055c7c0fd56a9 in Item_sum_min_max::clear (this=0x7f405c0558f8) at /10.5/sql/item_sum.cc:2362
      #6  0x000055c7c0de3b11 in compute_window_func (thd=0x7f405c000d78, window_functions=..., cursor_managers=..., tbl=0x7f405c077fb0, filesort_result=0x7f405c0777c0) at /10.5/sql/sql_window.cc:2844
      #7  0x000055c7c0de3fbb in Window_func_runner::exec (this=0x7f405c017a18, thd=0x7f405c000d78, tbl=0x7f405c077fb0, filesort_result=0x7f405c0777c0) at /10.5/sql/sql_window.cc:2976
      #8  0x000055c7c0de40aa in Window_funcs_sort::exec (this=0x7f405c017a10, join=0x7f405c015480, keep_filesort_result=false) at /10.5/sql/sql_window.cc:3004
      #9  0x000055c7c0de4648 in Window_funcs_computation::exec (this=0x7f405c0179f0, join=0x7f405c015480, keep_last_filesort_result=false) at /10.5/sql/sql_window.cc:3131
      #10 0x000055c7c0c105b4 in AGGR_OP::end_send (this=0x7f405c017838) at /10.5/sql/sql_select.cc:28962
      #11 0x000055c7c0bf926a in sub_select_postjoin_aggr (join=0x7f405c015480, join_tab=0x7f405c016b20, end_of_records=true) at /10.5/sql/sql_select.cc:20397
      #12 0x000055c7c0bf95cd in sub_select (join=0x7f405c015480, join_tab=0x7f405c016778, end_of_records=true) at /10.5/sql/sql_select.cc:20632
      #13 0x000055c7c0bf8d4f in do_select (join=0x7f405c015480, procedure=0x0) at /10.5/sql/sql_select.cc:20223
      #14 0x000055c7c0bccd21 in JOIN::exec_inner (this=0x7f405c015480) at /10.5/sql/sql_select.cc:4467
      #15 0x000055c7c0bcbe4d in JOIN::exec (this=0x7f405c015480) at /10.5/sql/sql_select.cc:4247
      #16 0x000055c7c0bcd669 in mysql_select (thd=0x7f405c000d78, tables=0x7f405c054508, fields=..., conds=0x0, og_num=2, order=0x7f405c055800, group=0x0, having=0x0, proc_param=0x0, select_options=2201171004160, result=0x7f405c055c50, unit=0x7f405c052430, select_lex=0x7f405c053fb8) at /10.5/sql/sql_select.cc:4720
      #17 0x000055c7c0bbd24c in handle_select (thd=0x7f405c000d78, lex=0x7f405c052368, result=0x7f405c055c50, setup_tables_done_option=0) at /10.5/sql/sql_select.cc:417
      #18 0x000055c7c0b80df3 in execute_sqlcom_select (thd=0x7f405c000d78, all_tables=0x7f405c054508) at /10.5/sql/sql_parse.cc:6282
      #19 0x000055c7c0b77e60 in mysql_execute_command (thd=0x7f405c000d78) at /10.5/sql/sql_parse.cc:3978
      #20 0x000055c7c0ba6279 in Prepared_statement::execute (this=0x7f405c051ef8, expanded_query=0x7f40780cbcb0, open_cursor=false) at /10.5/sql/sql_prepare.cc:5007
      #21 0x000055c7c0ba45f3 in Prepared_statement::execute_loop (this=0x7f405c051ef8, expanded_query=0x7f40780cbcb0, open_cursor=false, packet=0x0, packet_end=0x0) at /10.5/sql/sql_prepare.cc:4470
      #22 0x000055c7c0ba2035 in mysql_sql_stmt_execute (thd=0x7f405c000d78) at /10.5/sql/sql_prepare.cc:3568
      #23 0x000055c7c0b77ea5 in mysql_execute_command (thd=0x7f405c000d78) at /10.5/sql/sql_parse.cc:3994
      #24 0x000055c7c0b85c05 in mysql_parse (thd=0x7f405c000d78, rawbuf=0x7f405c015290 "execute stmt", length=12, parser_state=0x7f40780cc510, is_com_multi=false, is_next_command=false) at /10.5/sql/sql_parse.cc:8063
      #25 0x000055c7c0b71c6e in dispatch_command (command=COM_QUERY, thd=0x7f405c000d78, packet=0x7f405c00b549 "", packet_length=12, is_com_multi=false, is_next_command=false) at /10.5/sql/sql_parse.cc:1889
      #26 0x000055c7c0b703a4 in do_command (thd=0x7f405c000d78) at /10.5/sql/sql_parse.cc:1370
      #27 0x000055c7c0d17bd9 in do_handle_one_connection (connect=0x55c7c4706958, put_in_cache=true) at /10.5/sql/sql_connect.cc:1410
      #28 0x000055c7c0d17942 in handle_one_connection (arg=0x55c7c46103c8) at /10.5/sql/sql_connect.cc:1312
      #29 0x000055c7c1257fa7 in pfs_spawn_thread (arg=0x55c7c4706598) at /10.5/storage/perfschema/pfs.cc:2201
      #30 0x00007f407d23dfa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
      #31 0x00007f407c8464cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      
      

      on 10.3-10.5 stack trace is not printed in the error log:

      10.5.9

      210303 10:00:14 [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.5.9-MariaDB
      key_buffer_size=134217728
      read_buffer_size=131072
      max_used_connections=1
      max_threads=153
      thread_count=1
      It is possible that mysqld could use up to
      key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 467864 K  bytes of memory
      Hope that's ok; if not, decrease some variables in the equation.
       
      Thread pointer: 0x7f8a4c000c58
      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 = 0x7f8a94075db0 thread_stack 0x49000
      mysys/stacktrace.c:213(my_print_stacktrace)[0x559dd4dde8ae]
      sql/signal_handler.cc:211(handle_fatal_signal)[0x559dd47bcb47]
      sigaction.c:0(__restore_rt)[0x7f8a94e733c0]
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x7f8a4c058ed0): SELECT  1 FROM t1 ORDER BY COUNT(i) OVER (), MIN(1) OVER ()
      

      but if I change query by adding distint - then it prints:

      Server version: 10.5.9-MariaDB
       
      sigaction.c:0(__restore_rt)[0x7f06f064a3c0]
      sql/item_sum.cc:2362(Item_sum_min_max::clear())[0x5581ddd987e6]
      sql/sql_list.h:421(base_list_iterator::init(base_list&))[0x5581ddc3ae95]
      sql/sql_list.h:441(base_list_iterator::next_fast())[0x5581ddc3cfc9]
      sql/sql_window.cc:3006(Window_funcs_sort::exec(JOIN*, bool))[0x5581ddc3d0fe]
      sql/sql_window.cc:3131(Window_funcs_computation::exec(JOIN*, bool))[0x5581ddc3d17a]
      sql/sql_select.cc:28963(AGGR_OP::end_send())[0x5581ddb13a8c]
      sql/sql_select.cc:20399(sub_select_postjoin_aggr(JOIN*, st_join_table*, bool))[0x5581ddb13c61]
      sql/sql_select.cc:20224(JOIN::exec_inner())[0x5581ddb2f74a]
      sql/sql_select.cc:4247(JOIN::exec())[0x5581ddb2fab3]
      sql/sql_select.cc:4721(mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x5581ddb2dc9e]
      sql/sql_select.cc:429(handle_select(THD*, LEX*, select_result*, unsigned long))[0x5581ddb2e7da]
      sql/sql_parse.cc:6283(execute_sqlcom_select(THD*, TABLE_LIST*))[0x5581dd992b65]
      sql/sql_parse.cc:3978(mysql_execute_command(THD*))[0x5581ddad30c4]
      sql/sql_prepare.cc:5007(Prepared_statement::execute(String*, bool))[0x5581ddaeb32c]
      sql/sql_prepare.cc:4470(Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*))[0x5581ddaeb412]
      sql/sql_class.h:1474(Item_change_list_savepoint::rollback(Item_change_list*))[0x5581ddaeb6d6]
      sql/sql_parse.cc:3994(mysql_execute_command(THD*))[0x5581ddad1bc4]
      sql/sql_parse.cc:8063(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x5581ddad6169]
      sql/sql_audit.h:169(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x5581ddad8215]
      sql/sql_parse.cc:1375(do_command(THD*))[0x5581ddad9bdb]
      sql/sql_connect.cc:1410(do_handle_one_connection(CONNECT*, bool))[0x5581ddbc4bc2]
      sql/sql_connect.cc:1318(handle_one_connection)[0x5581ddbc4e84]
      perfschema/pfs.cc:2204(pfs_spawn_thread)[0x5581ddf4828d]
      nptl/pthread_create.c:478(start_thread)[0x7f06f063e609]
      x86_64/clone.S:97(__GI___clone)[0x7f06f01e2293]
       
      Query (0x7f0688024520): SELECT distinct  1 FROM t1 ORDER BY COUNT(i) OVER (), MIN(1) OVER ()
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              psergei Sergei Petrunia
              Reporter:
              alice Alice Sherepa
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:

                  Git Integration