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

Assertion `fixed' failed after the 2.nd execution of ps, query with ORDER BY (window function)

    XMLWordPrintable

    Details

      Description

      -- source include/have_innodb.inc
      create table t1 (pk int) engine=innodb;
      insert into t1 values (1),(2),(3);
       
      prepare stmt from "SELECT 1 FROM t1 ORDER BY BIT_OR(pk) OVER (), SUM(CHAR_LENGTH(1)) OVER ();";
      execute stmt;
      execute stmt;
      drop table t1;
      

      10.2 259e5243faa88370bbb8903

      #3  <signal handler called>
      #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #5  0x00007f4c891ac859 in __GI_abort () at abort.c:79
      #6  0x00007f4c891ac729 in __assert_fail_base (fmt=0x7f4c89342588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55e344f25f2a "fixed", file=0x55e344f26758 "/10.2/src/sql/item_func.cc", line=524, function=<optimized out>) at assert.c:92
      #7  0x00007f4c891bdf36 in __GI___assert_fail (assertion=0x55e344f25f2a "fixed", file=0x55e344f26758 "/10.2/src/sql/item_func.cc", line=524, function=0x55e344f26848 "virtual my_decimal* Item_func::val_decimal(my_decimal*)") at assert.c:101
      #8  0x000055e34469e651 in Item_func::val_decimal (this=0x7f4c2c0887b0, decimal_value=0x7f4c7f4a1040) at /10.2/src/sql/item_func.cc:524
      #9  0x000055e344703a7f in Aggregator_simple::arg_val_decimal (this=0x7f4c2c015770, value=0x7f4c7f4a1040) at /10.2/src/sql/item_sum.cc:1550
      #10 0x000055e344703135 in Item_sum_sum::add_helper (this=0x7f4c2c088890, perform_removal=false) at /10.2/src/sql/item_sum.cc:1385
      #11 0x000055e34470305b in Item_sum_sum::add (this=0x7f4c2c088890) at /10.2/src/sql/item_sum.cc:1374
      #12 0x000055e344575f1b in Frame_cursor::add_value_to_items (this=0x7f4c2c0158d8) at /10.2/src/sql/sql_window.cc:989
      #13 0x000055e344576db7 in Frame_range_current_row_bottom::pre_next_partition (this=0x7f4c2c0158d8, rownum=0) at /10.2/src/sql/sql_window.cc:1399
      #14 0x000055e3445760f0 in Cursor_manager::notify_cursors_partition_changed (this=0x7f4c2c188260, rownum=0) at /10.2/src/sql/sql_window.cc:1048
      #15 0x000055e34457409f in compute_window_func (thd=0x7f4c2c000d90, window_functions=..., cursor_managers=..., tbl=0x7f4c2c08c318, filesort_result=0x7f4c2c193090) at /10.2/src/sql/sql_window.cc:2666
      #16 0x000055e3445744da in Window_func_runner::exec (this=0x7f4c2c014d48, thd=0x7f4c2c000d90, tbl=0x7f4c2c08c318, filesort_result=0x7f4c2c193090) at /10.2/src/sql/sql_window.cc:2782
      #17 0x000055e344574600 in Window_funcs_sort::exec (this=0x7f4c2c014d40, join=0x7f4c2c0128e0, keep_filesort_result=false) at /10.2/src/sql/sql_window.cc:2810
      #18 0x000055e344574afa in Window_funcs_computation::exec (this=0x7f4c2c014d20, join=0x7f4c2c0128e0, keep_last_filesort_result=false) at /10.2/src/sql/sql_window.cc:2937
      #19 0x000055e344426520 in AGGR_OP::end_send (this=0x7f4c2c014bb0) at /10.2/src/sql/sql_select.cc:26850
      #20 0x000055e344410f75 in sub_select_postjoin_aggr (join=0x7f4c2c0128e0, join_tab=0x7f4c2c013e88, end_of_records=true) at /10.2/src/sql/sql_select.cc:18574
      #21 0x000055e3444112a9 in sub_select (join=0x7f4c2c0128e0, join_tab=0x7f4c2c013ad8, end_of_records=true) at /10.2/src/sql/sql_select.cc:18810
      #22 0x000055e344410a8d in do_select (join=0x7f4c2c0128e0, procedure=0x0) at /10.2/src/sql/sql_select.cc:18405
      #23 0x000055e3443ea6ab in JOIN::exec_inner (this=0x7f4c2c0128e0) at /10.2/src/sql/sql_select.cc:3642
      #24 0x000055e3443e9b52 in JOIN::exec (this=0x7f4c2c0128e0) at /10.2/src/sql/sql_select.cc:3437
      #25 0x000055e3443ead14 in mysql_select (thd=0x7f4c2c000d90, tables=0x7f4c2c087aa8, wild_num=0, fields=..., conds=0x0, og_num=2, order=0x7f4c2c088680, group=0x0, having=0x0, proc_param=0x0, select_options=2416184064, result=0x7f4c2c088c20, unit=0x7f4c2c086340, select_lex=0x7f4c2c086a80) at /10.2/src/sql/sql_select.cc:3837
      #26 0x000055e3443dee8e in handle_select (thd=0x7f4c2c000d90, lex=0x7f4c2c086280, result=0x7f4c2c088c20, setup_tables_done_option=0) at /10.2/src/sql/sql_select.cc:361
      #27 0x000055e3443a9539 in execute_sqlcom_select (thd=0x7f4c2c000d90, all_tables=0x7f4c2c087aa8) at /10.2/src/sql/sql_parse.cc:6275
      #28 0x000055e3443a00ad in mysql_execute_command (thd=0x7f4c2c000d90) at /10.2/src/sql/sql_parse.cc:3586
      #29 0x000055e3443cb977 in Prepared_statement::execute (this=0x7f4c2c038e30, expanded_query=0x7f4c7f4a2980, open_cursor=false) at /10.2/src/sql/sql_prepare.cc:5053
      #30 0x000055e3443c9e80 in Prepared_statement::execute_loop (this=0x7f4c2c038e30, expanded_query=0x7f4c7f4a2980, open_cursor=false, packet=0x0, packet_end=0x0) at /10.2/src/sql/sql_prepare.cc:4482
      #31 0x000055e3443c7b80 in mysql_sql_stmt_execute (thd=0x7f4c2c000d90) at /10.2/src/sql/sql_prepare.cc:3574
      #32 0x000055e3443a00f2 in mysql_execute_command (thd=0x7f4c2c000d90) at /10.2/src/sql/sql_parse.cc:3602
      #33 0x000055e3443ad2e1 in mysql_parse (thd=0x7f4c2c000d90, rawbuf=0x7f4c2c0126f8 "execute stmt", length=12, parser_state=0x7f4c7f4a3570, is_com_multi=false, is_next_command=false) at /10.2/src/sql/sql_parse.cc:7790
      #34 0x000055e34439b51e in dispatch_command (command=COM_QUERY, thd=0x7f4c2c000d90, packet=0x7f4c2c008b51 "", packet_length=12, is_com_multi=false, is_next_command=false) at /10.2/src/sql/sql_parse.cc:1827
      #35 0x000055e34439a019 in do_command (thd=0x7f4c2c000d90) at /10.2/src/sql/sql_parse.cc:1381
      #36 0x000055e3444f4a7a in do_handle_one_connection (connect=0x55e346f3fad0) at /10.2/src/sql/sql_connect.cc:1336
      #37 0x000055e3444f47df in handle_one_connection (arg=0x55e346f3fad0) at /10.2/src/sql/sql_connect.cc:1241
      #38 0x000055e344d1da7a in pfs_spawn_thread (arg=0x55e346f22f40) at /10.2/src/storage/perfschema/pfs.cc:1869
      #39 0x00007f4c896cf609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #40 0x00007f4c892a9293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
       
       
      Query (0x62b0000a1340): SELECT 1 FROM t1 ORDER BY BIT_OR(pk) OVER (), SUM(CHAR_LENGTH(1)) OVER ()
      

      In 10.5 - mariadbd: /10.5/sql/item.cc:339: my_decimal* Item::val_decimal_from_int(my_decimal*): Assertion `is_fixed()' failed.

      Server crashes on non-debug builds.

      10.5.9

      210303 13:31:12 [ERROR] mysqld got signal 11 ;
       
      Server version: 10.5.9-MariaDB
       
      sigaction.c:0(__restore_rt)[0x7f0ff6f603c0]
      sql/item.cc:6643(Item::save_decimal_in_field(Field*, bool))[0x55abd82ee059]
      sql/item.cc:6666(Item::save_in_field(Field*, bool))[0x55abd82df326]
      sql/sql_list.h:441(base_list_iterator::next_fast())[0x55abd822ff52]
      sql/sql_list.h:441(base_list_iterator::next_fast())[0x55abd8231fc9]
      sql/sql_window.cc:3006(Window_funcs_sort::exec(JOIN*, bool))[0x55abd82320fe]
      sql/sql_window.cc:3131(Window_funcs_computation::exec(JOIN*, bool))[0x55abd823217a]
      sql/sql_select.cc:28963(AGGR_OP::end_send())[0x55abd8108a8c]
      sql/sql_select.cc:20399(sub_select_postjoin_aggr(JOIN*, st_join_table*, bool))[0x55abd8108c61]
      sql/sql_select.cc:20224(JOIN::exec_inner())[0x55abd812474a]
      sql/sql_select.cc:4247(JOIN::exec())[0x55abd8124ab3]
      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*))[0x55abd8122c9e]
      sql/sql_select.cc:429(handle_select(THD*, LEX*, select_result*, unsigned long))[0x55abd81237da]
      sql/sql_parse.cc:6283(execute_sqlcom_select(THD*, TABLE_LIST*))[0x55abd7f87b65]
      sql/sql_parse.cc:3978(mysql_execute_command(THD*))[0x55abd80c80c4]
      sql/sql_prepare.cc:5007(Prepared_statement::execute(String*, bool))[0x55abd80e032c]
      sql/sql_prepare.cc:4470(Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*))[0x55abd80e0412]
      sql/sql_class.h:1474(Item_change_list_savepoint::rollback(Item_change_list*))[0x55abd80e06d6]
      sql/sql_parse.cc:3994(mysql_execute_command(THD*))[0x55abd80c6bc4]
      sql/sql_parse.cc:8063(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x55abd80cb169]
      sql/sql_audit.h:169(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x55abd80cd215]
      sql/sql_parse.cc:1375(do_command(THD*))[0x55abd80cebdb]
      sql/sql_connect.cc:1410(do_handle_one_connection(CONNECT*, bool))[0x55abd81b9bc2]
      sql/sql_connect.cc:1318(handle_one_connection)[0x55abd81b9e84]
      perfschema/pfs.cc:2204(pfs_spawn_thread)[0x55abd853d28d]
      nptl/pthread_create.c:478(start_thread)[0x7f0ff6f54609]
      x86_64/clone.S:97(__GI___clone)[0x7f0ff6af8293]
       
      Query (0x7f0f9008baa0): SELECT 1 FROM t1 ORDER BY BIT_OR(pk) OVER (), SUM(CHAR_LENGTH(1)) OVER ()
      

      Similar case:

      -- source include/have_innodb.inc
      create table t1 (pk int) engine=innodb;
      insert into t1 values (1),(2),(3);
       
      prepare stmt from "SELECT 1 FROM t1 ORDER BY BIT_OR(pk) OVER (), SUM(1) OVER ();";
      execute stmt;
      execute stmt;
      drop table t1;
      

      210303 13:19:50 [ERROR] mysqld got signal 11 ;
      Server version: 10.5.10-MariaDB-debug-log
       
      sql/field.h:1384(Field::set_notnull(long long))[0x55f76362e183]
      sql/item.cc:6649(Item::save_decimal_in_field(Field*, bool))[0x55f76416330d]
      sql/sql_type.cc:4261(Type_handler_decimal_result::Item_save_in_field(Item*, Field*, bool) const)[0x55f763e8c68a]
      sql/item.cc:6665(Item::save_in_field(Field*, bool))[0x55f7641636a3]
      sql/sql_window.cc:2713(save_window_function_values(List<Item_window_func>&, TABLE*, unsigned char*))[0x55f763ee69ab]
      sql/sql_window.cc:2867(compute_window_func(THD*, List<Item_window_func>&, List<Cursor_manager>&, TABLE*, SORT_INFO*))[0x55f763ee748f]
      sql/sql_window.cc:2976(Window_func_runner::exec(THD*, TABLE*, SORT_INFO*))[0x55f763ee7b58]
      sql/sql_window.cc:3004(Window_funcs_sort::exec(JOIN*, bool))[0x55f763ee7da6]
      sql/sql_window.cc:3131(Window_funcs_computation::exec(JOIN*, bool))[0x55f763ee8bae]
      sql/sql_select.cc:28962(AGGR_OP::end_send())[0x55f763a633f0]
      sql/sql_select.cc:20397(sub_select_postjoin_aggr(JOIN*, st_join_table*, bool))[0x55f763a22b13]
      sql/sql_select.cc:20632(sub_select(JOIN*, st_join_table*, bool))[0x55f763a234c6]
      sql/sql_select.cc:20223(do_select(JOIN*, Procedure*))[0x55f763a21f08]
      sql/sql_select.cc:4467(JOIN::exec_inner())[0x55f7639ae6b9]
      sql/sql_select.cc:4248(JOIN::exec())[0x55f7639abca4]
      sql/sql_select.cc:4722(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*))[0x55f7639b0078]
      sql/sql_select.cc:417(handle_select(THD*, LEX*, select_result*, unsigned long))[0x55f7639818b6]
      sql/sql_parse.cc:6282(execute_sqlcom_select(THD*, TABLE_LIST*))[0x55f7638eb024]
      sql/sql_parse.cc:3978(mysql_execute_command(THD*))[0x55f7638d9f1f]
      sql/sql_prepare.cc:5007(Prepared_statement::execute(String*, bool))[0x55f76394a384]
      sql/sql_prepare.cc:4470(Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*))[0x55f76394588d]
      sql/sql_prepare.cc:3569(mysql_sql_stmt_execute(THD*))[0x55f76393f5c7]
      sql/sql_parse.cc:3995(mysql_execute_command(THD*))[0x55f7638d9f64]
      sql/sql_parse.cc:8063(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x55f7638f631e]
      sql/sql_parse.cc:1892(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x55f7638cc517]
      sql/sql_parse.cc:1370(do_command(THD*))[0x55f7638c8e40]
      sql/sql_connect.cc:1410(do_handle_one_connection(CONNECT*, bool))[0x55f763d0b6dc]
      sql/sql_connect.cc:1314(handle_one_connection)[0x55f763d0b040]
      perfschema/pfs.cc:2203(pfs_spawn_thread)[0x55f764a1abf7]
      nptl/pthread_create.c:478(start_thread)[0x7fba5ba8a609]
      x86_64/clone.S:97(__GI___clone)[0x7fba5b65e293]
       
      Query (0x62b0000a1340): SELECT 1 FROM t1 ORDER BY BIT_OR(pk) OVER (), SUM(1) OVER ()
      

      ---------------------------
      another one, just to make it searchable

      210303 14:09:29 [ERROR] mysqld got signal 11 ;
      Server version: 10.5.10-MariaDB-debug-log
       
      sigaction.c:0(__restore_rt)[0x7fd1a58a73c0]
      sql/item_sum.cc:2516(Item_sum_min::add())[0x55cc2e1deb40]
      sql/sql_window.cc:1102(Frame_cursor::add_value_to_items())[0x55cc2dd63c03]
      sql/sql_window.cc:2212(Frame_scan_cursor::compute_values_for_current_row())[0x55cc2dd684b4]
      sql/sql_window.cc:2169(Frame_scan_cursor::next_partition(unsigned long long))[0x55cc2dd68118]
      sql/sql_window.cc:1166(Cursor_manager::notify_cursors_partition_changed(unsigned long long))[0x55cc2dd643f8]
      sql/sql_window.cc:2845(compute_window_func(THD*, List<Item_window_func>&, List<Cursor_manager>&, TABLE*, SORT_INFO*))[0x55cc2dd5f34f]
      sql/sql_window.cc:2976(Window_func_runner::exec(THD*, TABLE*, SORT_INFO*))[0x55cc2dd5fb58]
      sql/sql_window.cc:3004(Window_funcs_sort::exec(JOIN*, bool))[0x55cc2dd5fda6]
      sql/sql_window.cc:3131(Window_funcs_computation::exec(JOIN*, bool))[0x55cc2dd60bae]
      sql/sql_select.cc:28962(AGGR_OP::end_send())[0x55cc2d8db3f0]
      sql/sql_select.cc:20397(sub_select_postjoin_aggr(JOIN*, st_join_table*, bool))[0x55cc2d89ab13]
      sql/sql_select.cc:20632(sub_select(JOIN*, st_join_table*, bool))[0x55cc2d89b4c6]
      sql/sql_select.cc:20223(do_select(JOIN*, Procedure*))[0x55cc2d899f08]
      sql/sql_select.cc:4467(JOIN::exec_inner())[0x55cc2d8266b9]
      sql/sql_select.cc:4248(JOIN::exec())[0x55cc2d823ca4]
      sql/sql_select.cc:4722(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*))[0x55cc2d828078]
      sql/sql_select.cc:417(handle_select(THD*, LEX*, select_result*, unsigned long))[0x55cc2d7f98b6]
      sql/sql_parse.cc:6282(execute_sqlcom_select(THD*, TABLE_LIST*))[0x55cc2d763024]
      sql/sql_parse.cc:3978(mysql_execute_command(THD*))[0x55cc2d751f1f]
      sql/sql_prepare.cc:5007(Prepared_statement::execute(String*, bool))[0x55cc2d7c2384]
      sql/sql_prepare.cc:4470(Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*))[0x55cc2d7bd88d]
      sql/sql_prepare.cc:3569(mysql_sql_stmt_execute(THD*))[0x55cc2d7b75c7]
      sql/sql_parse.cc:3995(mysql_execute_command(THD*))[0x55cc2d751f64]
      sql/sql_parse.cc:8063(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x55cc2d76e31e]
      sql/sql_parse.cc:1892(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x55cc2d744517]
      sql/sql_parse.cc:1370(do_command(THD*))[0x55cc2d740e40]
      sql/sql_connect.cc:1410(do_handle_one_connection(CONNECT*, bool))[0x55cc2db836dc]
      sql/sql_connect.cc:1314(handle_one_connection)[0x55cc2db83040]
      perfschema/pfs.cc:2203(pfs_spawn_thread)[0x55cc2e892bf7]
      nptl/pthread_create.c:478(start_thread)[0x7fd1a589b609]
      x86_64/clone.S:97(__GI___clone)[0x7fd1a546f293]
       
      Query (0x62b0000a1340): SELECT 1 FROM `v1` ORDER BY COUNT( `vcol_int` ) OVER ( ), MIN(1) OVER ()
      

      ( MDEV-25042-MDEV-25044 probably are all duplicates )

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:

                  Git Integration