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

Assertion `n < m_size' failed, sql_array.h:64: Element_type& Bounds_checked_array<Element_type>::operator[](size_t) [with Element_type = Item*; size_t = long unsigned int]

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.3
    • Fix Version/s: 10.3.7
    • Component/s: Optimizer
    • Labels:
      None

      Description

      CREATE TABLE t (f1 int ,f2 int ,f3 int, f4 int, v1 int AS (-f4) virtual);
       
      WITH CTE AS (SELECT MIN(f4) OVER () FROM t) 
       SELECT  MEDIAN(f4) OVER () FROM t 
       ORDER BY f1, f4, f2, f3, v1;
       
      DROP TABLE t;
      

      Thread 1 (Thread 0x7f3ed84ac700 (LWP 11564)):
      #0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:62
      #1  0x000056533dc1ff33 in my_write_core (sig=6) at /home/alice/git/10.3/mysys/stacktrace.c:481
      #2  0x000056533d464a6b in handle_fatal_signal (sig=6) at /home/alice/git/10.3/sql/signal_handler.cc:305
      #3  <signal handler called>
      #4  0x00007f3ede30e428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
      #5  0x00007f3ede31002a in __GI_abort () at abort.c:89
      #6  0x00007f3ede306bd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x56533dcd7c85 "n < m_size", file=file@entry=0x56533dcd7c60 "/home/alice/git/10.3/sql/sql_array.h", line=line@entry=64, function=function@entry=0x56533dcd9580 <Bounds_checked_array<Item*>::operator[](unsigned long)::__PRETTY_FUNCTION__> "Element_type& Bounds_checked_array<Element_type>::operator[](size_t) [with Element_type = Item*; size_t = long unsigned int]") at assert.c:92
      #7  0x00007f3ede306c82 in __GI___assert_fail (assertion=0x56533dcd7c85 "n < m_size", file=0x56533dcd7c60 "/home/alice/git/10.3/sql/sql_array.h", line=64, function=0x56533dcd9580 <Bounds_checked_array<Item*>::operator[](unsigned long)::__PRETTY_FUNCTION__> "Element_type& Bounds_checked_array<Element_type>::operator[](size_t) [with Element_type = Item*; size_t = long unsigned int]") at assert.c:101
      #8  0x000056533d10cd28 in Bounds_checked_array<Item*>::operator[] (this=0x7f3ed84a9f50, n=6) at /home/alice/git/10.3/sql/sql_array.h:64
      #9  0x000056533d201ac1 in find_order_in_list (thd=0x7f3ec8000b00, ref_pointer_array=..., tables=0x7f3ec8015f08, order=0x7f3ec8017950, fields=..., all_fields=..., is_group_field=false, add_to_all_fields=true, from_window_spec=false) at /home/alice/git/10.3/sql/sql_select.cc:22931
      #10 0x000056533d201bc0 in setup_order (thd=0x7f3ec8000b00, ref_pointer_array=..., tables=0x7f3ec8015f08, fields=..., all_fields=..., order=0x7f3ec8017950, from_window_spec=false) at /home/alice/git/10.3/sql/sql_select.cc:22964
      #11 0x000056533d1c4940 in setup_without_group (thd=0x7f3ec8000b00, ref_pointer_array=..., tables=0x7f3ec8015f08, leaves=..., fields=..., all_fields=..., conds=0x7f3ec8018890, order=0x7f3ec8017390, group=0x0, win_specs=..., win_funcs=..., hidden_group_fields=0x7f3ec801876f, reserved=0x7f3ec8015214) at /home/alice/git/10.3/sql/sql_select.cc:662
      #12 0x000056533d1c6b1e in JOIN::prepare (this=0x7f3ec8018488, tables_init=0x7f3ec8015f08, wild_num=0, conds_init=0x0, og_num=0, order_init=0x7f3ec8017390, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7f3ec8014f38, unit_arg=0x7f3ec8015350) at /home/alice/git/10.3/sql/sql_select.cc:1097
      #13 0x000056533d273793 in st_select_lex_unit::prepare_join (this=0x7f3ec8015350, thd_arg=0x7f3ec8000b00, sl=0x7f3ec8014f38, tmp_result=0x0, additional_options=0, is_union_select=false) at /home/alice/git/10.3/sql/sql_union.cc:662
      #14 0x000056533d274b48 in st_select_lex_unit::prepare (this=0x7f3ec8015350, thd_arg=0x7f3ec8000b00, sel_result=0x0, additional_options=0) at /home/alice/git/10.3/sql/sql_union.cc:947
      #15 0x000056533d37f2ac in With_element::prepare_unreferenced (this=0x7f3ec8016570, thd=0x7f3ec8000b00) at /home/alice/git/10.3/sql/sql_cte.cc:981
      #16 0x000056533d37ea15 in With_clause::prepare_unreferenced_elements (this=0x7f3ec8014eb0, thd=0x7f3ec8000b00) at /home/alice/git/10.3/sql/sql_cte.cc:730
      #17 0x000056533d1c70af in JOIN::prepare (this=0x7f3ec8017ab8, tables_init=0x7f3ec8016c10, wild_num=0, conds_init=0x0, og_num=5, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7f3ec80050c0, unit_arg=0x7f3ec8004948) at /home/alice/git/10.3/sql/sql_select.cc:1171
      #18 0x000056533d1d17ac in mysql_select (thd=0x7f3ec8000b00, tables=0x7f3ec8016c10, wild_num=0, fields=..., conds=0x0, og_num=5, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f3ec8017a98, unit=0x7f3ec8004948, select_lex=0x7f3ec80050c0) at /home/alice/git/10.3/sql/sql_select.cc:4130
      #19 0x000056533d1c3e2e in handle_select (thd=0x7f3ec8000b00, lex=0x7f3ec8004880, result=0x7f3ec8017a98, setup_tables_done_option=0) at /home/alice/git/10.3/sql/sql_select.cc:382
      #20 0x000056533d18f2f0 in execute_sqlcom_select (thd=0x7f3ec8000b00, all_tables=0x7f3ec8016c10) at /home/alice/git/10.3/sql/sql_parse.cc:6539
      #21 0x000056533d185782 in mysql_execute_command (thd=0x7f3ec8000b00) at /home/alice/git/10.3/sql/sql_parse.cc:3768
      #22 0x000056533d192cb5 in mysql_parse (thd=0x7f3ec8000b00, rawbuf=0x7f3ec8014d58 "WITH CTE AS (SELECT MIN(f4) OVER () FROM t) \nSELECT  MEDIAN(f4) OVER () FROM t \nORDER BY f1, f4, f2, f3, v1", length=107, parser_state=0x7f3ed84ab5d0, is_com_multi=false, is_next_command=false) at /home/alice/git/10.3/sql/sql_parse.cc:8001
      #23 0x000056533d1801d9 in dispatch_command (command=COM_QUERY, thd=0x7f3ec8000b00, packet=0x7f3ec808ff01 "WITH CTE AS (SELECT MIN(f4) OVER () FROM t) \nSELECT  MEDIAN(f4) OVER () FROM t \nORDER BY f1, f4, f2, f3, v1", packet_length=107, is_com_multi=false, is_next_command=false) at /home/alice/git/10.3/sql/sql_parse.cc:1846
      #24 0x000056533d17ec11 in do_command (thd=0x7f3ec8000b00) at /home/alice/git/10.3/sql/sql_parse.cc:1391
      #25 0x000056533d2e1187 in do_handle_one_connection (connect=0x565341452b00) at /home/alice/git/10.3/sql/sql_connect.cc:1402
      #26 0x000056533d2e0f07 in handle_one_connection (arg=0x565341452b00) at /home/alice/git/10.3/sql/sql_connect.cc:1308
      #27 0x000056533d69d9ea in pfs_spawn_thread (arg=0x565341466460) at /home/alice/git/10.3/storage/perfschema/pfs.cc:1862
      #28 0x00007f3edef4b6ba in start_thread (arg=0x7f3ed84ac700) at pthread_create.c:333
      #29 0x00007f3ede3e041d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
      

      Version: '10.3.7-MariaDB-debug-log'  socket: '/home/alice/git/10.3/mysql-test/var/tmp/mysqld.1.sock'  port: 16000  Source distribution
      mysqld: /home/alice/git/10.3/sql/sql_array.h:64: Element_type& Bounds_checked_array<Element_type>::operator[](size_t) [with Element_type = Item*; size_t = long unsigned int]: Assertion `n < m_size' failed.
      180418 16:32:40 [ERROR] mysqld got signal 6 ;
       
      Thread pointer: 0x7f3ec8000b00
      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 = 0x7f3ed84abe70 thread_stack 0x49000
      mysys/stacktrace.c:269(my_print_stacktrace)[0x56533dc1fe41]
      sql/signal_handler.cc:168(handle_fatal_signal)[0x56533d464642]
      /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7f3edef55390]
      linux/raise.c:54(__GI_raise)[0x7f3ede30e428]
      stdlib/abort.c:91(__GI_abort)[0x7f3ede31002a]
      assert/assert.c:92(__assert_fail_base)[0x7f3ede306bd7]
      /lib/x86_64-linux-gnu/libc.so.6(+0x2dc82)[0x7f3ede306c82]
      sql/sql_array.h:65(Bounds_checked_array<Item*>::operator[](unsigned long))[0x56533d10cd28]
      sql/sql_select.cc:22931(find_order_in_list(THD*, Bounds_checked_array<Item*>, TABLE_LIST*, st_order*, List<Item>&, List<Item>&, bool, bool, bool))[0x56533d201ac1]
      sql/sql_select.cc:22964(setup_order(THD*, Bounds_checked_array<Item*>, TABLE_LIST*, List<Item>&, List<Item>&, st_order*, bool))[0x56533d201bc0]
      sql/sql_select.cc:662(setup_without_group(THD*, Bounds_checked_array<Item*>, TABLE_LIST*, List<TABLE_LIST>&, List<Item>&, List<Item>&, Item**, st_order*, st_order*, List<Window_spec>&, List<Item_window_func>&, bool*, unsigned int*))[0x56533d1c4940]
      sql/sql_select.cc:1097(JOIN::prepare(TABLE_LIST*, unsigned int, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*))[0x56533d1c6b1e]
      sql/sql_union.cc:662(st_select_lex_unit::prepare_join(THD*, st_select_lex*, select_result*, unsigned long, bool))[0x56533d273793]
      sql/sql_union.cc:947(st_select_lex_unit::prepare(THD*, select_result*, unsigned long))[0x56533d274b48]
      sql/sql_cte.cc:980(With_element::prepare_unreferenced(THD*))[0x56533d37f2ac]
      sql/sql_cte.cc:730(With_clause::prepare_unreferenced_elements(THD*))[0x56533d37ea15]
      sql/sql_select.cc:1171(JOIN::prepare(TABLE_LIST*, unsigned int, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*))[0x56533d1c70af]
      sql/sql_select.cc:4130(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*))[0x56533d1d17ac]
      sql/sql_select.cc:382(handle_select(THD*, LEX*, select_result*, unsigned long))[0x56533d1c3e2e]
      sql/sql_parse.cc:6539(execute_sqlcom_select(THD*, TABLE_LIST*))[0x56533d18f2f0]
      sql/sql_parse.cc:3768(mysql_execute_command(THD*))[0x56533d185782]
      sql/sql_parse.cc:8001(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x56533d192cb5]
      sql/sql_parse.cc:1848(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x56533d1801d9]
      sql/sql_parse.cc:1391(do_command(THD*))[0x56533d17ec11]
      sql/sql_connect.cc:1402(do_handle_one_connection(CONNECT*))[0x56533d2e1187]
      sql/sql_connect.cc:1309(handle_one_connection)[0x56533d2e0f07]
      perfschema/pfs.cc:1864(pfs_spawn_thread)[0x56533d69d9ea]
      /lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7f3edef4b6ba]
      x86_64/clone.S:111(clone)[0x7f3ede3e041d]
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x7f3ec8014d58): WITH CTE AS (SELECT MIN(f4) OVER () FROM t)  SELECT  MEDIAN(f4) OVER () FROM t  ORDER BY f1, f4, f2, f3, v1
      Connection ID (thread ID): 4
      Status: NOT_KILLED
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              igor Igor Babaev
              Reporter:
              alice Alice Sherepa
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: