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

main.having_cond_pushdown test failure - crash server (s390x)

Details

    Description

      Given s390x and AIX only assuming this is a bigendian fault.

       
      Server version: 10.11.9-MariaDB-log source revision: 284489576611aebc565c052d344d06eb3f40e31a
      key_buffer_size=1048576
      read_buffer_size=131072
      max_used_connections=1
      max_threads=153
      thread_count=8
      It is possible that mysqld could use up to 
      key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 63839 K  bytes of memory
      Hope that's ok; if not, decrease some variables in the equation.
       
      Thread pointer: 0x3ff80000c58
      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 = 0x3ffa5e7ebd8 thread_stack 0x49000
      mysys/stacktrace.c:215(my_print_stacktrace)[0x2aa09ee40d6]
      sql/signal_handler.cc:239(handle_fatal_signal)[0x2aa099dd306]
      [0x3ffa5e7c9d6]
      sql/sql_analyze_stmt.h:172(JOIN::exec())[0x2aa097f0082]
      sql/sql_select.cc:5203(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*))[0x2aa097ee3f6]
      sql/sql_select.cc:29496(mysql_explain_union(THD*, st_select_lex_unit*, select_result*))[0x2aa097eee9a]
      sql/sql_select.cc:29450(select_describe(JOIN*, bool, bool, bool, char const*) [clone .isra.534])[0x2aa097eefa0]
      sql/sql_select.cc:4905(JOIN::exec_inner())[0x2aa097ef9c2]
      sql/sql_select.cc:4722(JOIN::exec())[0x2aa097f00a2]
      sql/sql_select.cc:5203(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*))[0x2aa097ee3f6]
      sql/sql_select.cc:29496(mysql_explain_union(THD*, st_select_lex_unit*, select_result*))[0x2aa097eee9a]
      sql/sql_parse.cc:6324(execute_sqlcom_select(THD*, TABLE_LIST*))[0x2aa0976d1c4]
      sql/sql_parse.cc:6126(mysql_execute_command(THD*, bool))[0x2aa09777fa8]
      sql/sql_parse.cc:8146(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x2aa09767830]
      sql/sql_parse.cc:1866(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x2aa09773ff4]
      sql/sql_parse.cc:1408(do_command(THD*, bool))[0x2aa09775ffc]
      sql/sql_connect.cc:1417(do_handle_one_connection(CONNECT*, bool))[0x2aa098a22d4]
      sql/sql_connect.cc:1323(handle_one_connection)[0x2aa098a269a]
      perfschema/pfs.cc:2204(pfs_spawn_thread)[0x2aa09bfa2a6]
      /lib64/libpthread.so.0(+0x80de)[0x3ffa66080de]
      /lib64/libc.so.6(+0x28b42)[0x3ffa6028b42]
      [0x0]
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x3ff80010ba0): EXPLAIN FORMAT=JSON SELECT * FROM t1
      GROUP BY b
      HAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3
      

      Attachments

        Issue Links

          Activity

            danblack Daniel Black added a comment -

            x.test - simplied case

            $ cat mysql-test/main/x.test
            --echo #
            --echo # MDEV-32608: Expression with constant subquery causes a crash
            --echo # in pushdown from HAVING
            --echo #
             
            CREATE TABLE t1 (a INT, b INT);
            INSERT INTO t1 VALUES (2, 1), (3, 2);
             
            let $q=
            SELECT * FROM t1
            GROUP BY b
            HAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3;
             
            eval EXPLAIN FORMAT=JSON $q;
             
            DROP TABLE t1;
            

            Breakpoints:

            b mysql_explain_union
            c
            b Time_and_counter_tracker::incr_loops
            c
            (point of crash on s390x)
            this -> (Time_and_counter_tracker *)  on s390x is freed memory.
            

            rr replay mysql-test/var/log/mysqld.1.rr/mariadbd-0 (10.6-b7b2d2bde4f7d92e2f98e28774199bf24dea37a4)

            crash location:
            #0  Time_and_counter_tracker::incr_loops (this=0x7f307801b740) at /home/dan/repos/mariadb-server-10.6/sql/sql_analyze_stmt.h:170
            #1  0x00000000009b9c68 in JOIN::exec (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:4711
            #2  0x0000000000990c6b in mysql_select (thd=0x7f3078000dc8, tables=0x7f3078016f18, 
                fields=@0x7f3078016a40: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7f3078016eb0, last = 0x7f3078016eb0, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, 
                having=0x0, proc_param=0x0, select_options=2147748612, result=0x0, unit=0x7f3078017640, select_lex=0x7f3078016780) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:5191
            #3  0x00000000009e8ce1 in mysql_explain_union (thd=0x7f3078000dc8, unit=0x7f3078017640, result=0x0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:29443
            #4  0x00000000009bb26b in select_describe (join=0x7f30780193c0, need_tmp_table=true, need_order=true, distinct=false, message=0x0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:29397
            #5  0x00000000009bac0a in JOIN::exec_inner (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:4896
            #6  0x00000000009b9cae in JOIN::exec (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:4712
            #7  0x0000000000990c6b in mysql_select (thd=0x7f3078000dc8, tables=0x7f3078015ef0, 
                fields=@0x7f3078015b78: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7f3078015ea0, last = 0x7f3078019d60, elements = 2}, <No data fields>}, conds=0x0, og_num=1, order=0x0, 
                group=0x7f3078016728, having=0x7f30780188c0, proc_param=0x0, select_options=2147748612, result=0x7f30780192f8, unit=0x7f30780051b0, select_lex=0x7f30780158b8)
                at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:5191
            #8  0x00000000009e8ce1 in mysql_explain_union (thd=0x7f3078000dc8, unit=0x7f30780051b0, result=0x7f30780192f8) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:29443
            #9  0x0000000000945343 in execute_sqlcom_select (thd=0x7f3078000dc8, all_tables=0x7f3078015ef0) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:6335
            #10 0x0000000000938b75 in mysql_execute_command (thd=0x7f3078000dc8, is_called_from_prepared_stmt=false) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:3988
            #11 0x000000000092f62a in mysql_parse (thd=0x7f3078000dc8, rawbuf=0x7f3078015790 "EXPLAIN FORMAT=JSON SELECT * FROM t1\nGROUP BY b\nHAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3", length=96, 
                parser_state=0x7f3098ce6898) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:8181
            #12 0x000000000092bfed in dispatch_command (command=COM_QUERY, thd=0x7f3078000dc8, packet=0x7f307800ba29 "", packet_length=96, blocking=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:1897
            #13 0x00000000009308c7 in do_command (thd=0x7f3078000dc8, blocking=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:1410
            #14 0x0000000000b2e106 in do_handle_one_connection (connect=0x3d464e38, put_in_cache=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_connect.cc:1417
            #15 0x0000000000b2de5a in handle_one_connection (arg=0x3d451808) at /home/dan/repos/mariadb-server-10.6/sql/sql_connect.cc:1319
            #16 0x000000000110ee2f in pfs_spawn_thread (arg=0x3d455f68) at /home/dan/repos/mariadb-server-10.6/storage/perfschema/pfs.cc:2201
            #17 0x00007f309d4a66d7 in start_thread () from /lib64/libc.so.6
            #18 0x00007f309d52a414 in clone () from /lib64/libc.so.6
             
            (rr) watch -l last_start
            Hardware watchpoint 4: -location last_start
            (rr) reverse-continue 
            ..
            Allocation location:
            (rr) bt
            #0  0x00007f309d58cb31 in __memset_evex_unaligned_erms () from /lib64/libc.so.6
            #1  0x000000000174cf34 in alloc_root (mem_root=0x7f3078006d68, length=240) at /home/dan/repos/mariadb-server-10.6/mysys/my_alloc.c:270
            #2  0x00000000007af92d in Sql_alloc::operator new (size=240, mem_root=0x7f3078006d68) at /home/dan/repos/mariadb-server-10.6/sql/sql_alloc.h:37
            #3  0x00000000009b91bb in JOIN::save_explain_data_intern (this=0x7f307801a088, output=0x7f3078019970, need_tmp_table_arg=false, need_order_arg=false, distinct_arg=false, message=0x0)
                at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:29229
            #4  0x00000000009996ca in JOIN::save_explain_data (this=0x7f307801a088, output=0x7f3078019970, can_overwrite=false, need_tmp_table=false, need_order=false, distinct=false)
                at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:4671
            #5  0x0000000000998d4c in JOIN::build_explain (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1868
            #6  0x0000000000999b10 in JOIN::optimize (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1933
            #7  0x00000000008f6e0e in st_select_lex::optimize_unflattened_subqueries (this=0x7f30780158b8, const_only=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_lex.cc:5017
            #8  0x0000000000ba5b47 in JOIN::optimize_constant_subqueries (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/opt_subselect.cc:5717
            #9  0x000000000099d92f in JOIN::optimize_inner (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:2259
            #10 0x0000000000999ac9 in JOIN::optimize (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1927
            #11 0x0000000000990b80 in mysql_select (thd=0x7f3078000dc8, tables=0x7f3078015ef0, 
                fields=@0x7f3078015b78: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7f3078015ea0, last = 0x7f3078019d60, elements = 2}, <No data fields>}, conds=0x0, og_num=1, order=0x0, 
                group=0x7f3078016728, having=0x7f30780188c0, proc_param=0x0, select_options=2147748612, result=0x7f30780192f8, unit=0x7f30780051b0, select_lex=0x7f30780158b8)
                at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:5177
            #12 0x00000000009e8ce1 in mysql_explain_union (thd=0x7f3078000dc8, unit=0x7f30780051b0, result=0x7f30780192f8) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:29443
            #13 0x0000000000945343 in execute_sqlcom_select (thd=0x7f3078000dc8, all_tables=0x7f3078015ef0) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:6335
            #14 0x0000000000938b75 in mysql_execute_command (thd=0x7f3078000dc8, is_called_from_prepared_stmt=false) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:3988
            #15 0x000000000092f62a in mysql_parse (thd=0x7f3078000dc8, rawbuf=0x7f3078015790 "EXPLAIN FORMAT=JSON SELECT * FROM t1\nGROUP BY b\nHAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3", length=96, 
                parser_state=0x7f3098ce6898) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:8181
            #16 0x000000000092bfed in dispatch_command (command=COM_QUERY, thd=0x7f3078000dc8, packet=0x7f307800ba29 "", packet_length=96, blocking=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:1897
            #17 0x00000000009308c7 in do_command (thd=0x7f3078000dc8, blocking=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:1410
            #18 0x0000000000b2e106 in do_handle_one_connection (connect=0x3d464e38, put_in_cache=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_connect.cc:1417
            #19 0x0000000000b2de5a in handle_one_connection (arg=0x3d451808) at /home/dan/repos/mariadb-server-10.6/sql/sql_connect.cc:1319
            #20 0x000000000110ee2f in pfs_spawn_thread (arg=0x3d455f68) at /home/dan/repos/mariadb-server-10.6/storage/perfschema/pfs.cc:2201
            #21 0x00007f309d4a66d7 in start_thread () from /lib64/libc.so.6
            #22 0x00007f309d52a414 in clone () from /lib64/libc.so.6
            

            text diff of traces - use https://www.diffchecker.com/text-compare/

            #11 0x0000000000990b80 in mysql_select sql/sql_select.cc:5177 - point of initalization

            point of failure:

            #2 0x0000000000990c6b in mysql_select sql/sql_select.cc:5191 (14 lines later)

            s390x

            root@fbbde0e0d899:/build# mysql-test/mtr --manual-gdb='b mysql_explain_union; r' x.test
            

            term2

            mdborg@ibm-s390x-ubuntu22:~$ docker exec -ti build bash
            root@fbbde0e0d899:/build# gdb -x /build/mysql-test/var/tmp/gdbinit.mysqld.1   /build/sql/mariadbd
             
            Thread 6 "mariadbd" hit Breakpoint 1, mysql_explain_union (thd=0x3ff7c000dc8, unit=0x3ff7c0051b0, result=0x3ff7c01bb58) at /source/sql/sql_select.cc:29407
            29407	  DBUG_ENTER("mysql_explain_union");
            (gdb) bt
            #0  mysql_explain_union (thd=0x3ff7c000dc8, unit=0x3ff7c0051b0, result=0x3ff7c01bb58) at /source/sql/sql_select.cc:29407
            #1  0x000002aa059346ae in execute_sqlcom_select (thd=0x3ff7c000dc8, all_tables=0x3ff7c018750) at /source/sql/sql_parse.cc:6335
            #2  0x000002aa0592af60 in mysql_execute_command (thd=0x3ff7c000dc8, is_called_from_prepared_stmt=false) at /source/sql/sql_parse.cc:3988
            #3  0x000002aa0593a8e2 in mysql_parse (thd=0x3ff7c000dc8, rawbuf=0x3ff7c017ff0 "EXPLAIN FORMAT=JSON SELECT * FROM t1\nGROUP BY b\nHAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3", length=96, 
                parser_state=0x3ff9347e138) at /source/sql/sql_parse.cc:8181
            #4  0x000002aa05923ea4 in dispatch_command (command=COM_QUERY, thd=0x3ff7c000dc8, packet=0x3ff7c00baf9 "", packet_length=96, blocking=true) at /source/sql/sql_parse.cc:1897
            #5  0x000002aa05922626 in do_command (thd=0x3ff7c000dc8, blocking=true) at /source/sql/sql_parse.cc:1410
            #6  0x000002aa05b4cf70 in do_handle_one_connection (connect=0x2aa0a3ed668, put_in_cache=true) at /source/sql/sql_connect.cc:1417
            #7  0x000002aa05b4cb90 in handle_one_connection (arg=0x2aa0a3ed668) at /source/sql/sql_connect.cc:1319
            #8  0x000002aa0621e8ee in pfs_spawn_thread (arg=0x2aa0a4127b8) at /source/storage/perfschema/pfs.cc:2201
            #9  0x000003ff93196296 in ?? () from /lib/s390x-linux-gnu/libc.so.6
            #10 0x000003ff9320ff8e in ?? () from /lib/s390x-linux-gnu/libc.so.6
            (gdb) b JOIN::save_explain_data_intern
            Breakpoint 2 at 0x2aa059e6f30: file /source/sql/sql_select.cc, line 29163.
            (gdb) c
            Continuing.
             
            Thread 6 "mariadbd" hit Breakpoint 2, JOIN::save_explain_data_intern (this=0x3ff7c01c8e8, output=0x3ff7c01c1d0, need_tmp_table_arg=false, need_order_arg=false, distinct_arg=false, message=0x0) at /source/sql/sql_select.cc:29163
            29163	  JOIN *join= this; /* Legacy: this code used to be a non-member function */
            (gdb) bt
            #0  JOIN::save_explain_data_intern (this=0x3ff7c01c8e8, output=0x3ff7c01c1d0, need_tmp_table_arg=false, need_order_arg=false, distinct_arg=false, message=0x0) at /source/sql/sql_select.cc:29163
            #1  0x000002aa05998912 in JOIN::save_explain_data (this=0x3ff7c01c8e8, output=0x3ff7c01c1d0, can_overwrite=false, need_tmp_table=false, need_order=false, distinct=false) at /source/sql/sql_select.cc:4671
            #2  0x000002aa0598cfc4 in JOIN::build_explain (this=0x3ff7c01c8e8) at /source/sql/sql_select.cc:1868
            #3  0x000002aa0598d474 in JOIN::optimize (this=0x3ff7c01c8e8) at /source/sql/sql_select.cc:1933
            #4  0x000002aa058e2778 in st_select_lex::optimize_unflattened_subqueries (this=0x3ff7c018118, const_only=true) at /source/sql/sql_lex.cc:5017
            #5  0x000002aa05be62d8 in JOIN::optimize_constant_subqueries (this=0x3ff7c01bc20) at /source/sql/opt_subselect.cc:5717
            #6  0x000002aa0598e652 in JOIN::optimize_inner (this=0x3ff7c01bc20) at /source/sql/sql_select.cc:2259
            #7  0x000002aa0598d41e in JOIN::optimize (this=0x3ff7c01bc20) at /source/sql/sql_select.cc:1927
            #8  0x000002aa0599a892 in mysql_select (thd=0x3ff7c000dc8, tables=0x3ff7c018750, fields=..., conds=0x0, og_num=1, order=0x0, group=0x3ff7c018f88, having=0x3ff7c01b120, proc_param=0x0, 
                select_options=2147748612, result=0x3ff7c01bb58, unit=0x3ff7c0051b0, select_lex=0x3ff7c018118) at /source/sql/sql_select.cc:5177
            #9  0x000002aa059e8640 in mysql_explain_union (thd=0x3ff7c000dc8, unit=0x3ff7c0051b0, result=0x3ff7c01bb58) at /source/sql/sql_select.cc:29443
            #10 0x000002aa059346ae in execute_sqlcom_select (thd=0x3ff7c000dc8, all_tables=0x3ff7c018750) at /source/sql/sql_parse.cc:6335
            #11 0x000002aa0592af60 in mysql_execute_command (thd=0x3ff7c000dc8, is_called_from_prepared_stmt=false) at /source/sql/sql_parse.cc:3988
            #12 0x000002aa0593a8e2 in mysql_parse (thd=0x3ff7c000dc8, rawbuf=0x3ff7c017ff0 "EXPLAIN FORMAT=JSON SELECT * FROM t1\nGROUP BY b\nHAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3", length=96, 
                parser_state=0x3ff9347e138) at /source/sql/sql_parse.cc:8181
            #13 0x000002aa05923ea4 in dispatch_command (command=COM_QUERY, thd=0x3ff7c000dc8, packet=0x3ff7c00baf9 "", packet_length=96, blocking=true) at /source/sql/sql_parse.cc:1897
            #14 0x000002aa05922626 in do_command (thd=0x3ff7c000dc8, blocking=true) at /source/sql/sql_parse.cc:1410
            #15 0x000002aa05b4cf70 in do_handle_one_connection (connect=0x2aa0a3ed668, put_in_cache=true) at /source/sql/sql_connect.cc:1417
            #16 0x000002aa05b4cb90 in handle_one_connection (arg=0x2aa0a3ed668) at /source/sql/sql_connect.cc:1319
            #17 0x000002aa0621e8ee in pfs_spawn_thread (arg=0x2aa0a4127b8) at /source/storage/perfschema/pfs.cc:2201
            #18 0x000003ff93196296 in ?? () from /lib/s390x-linux-gnu/libc.so.6
            #19 0x000003ff9320ff8e in ?? () from /lib/s390x-linux-gnu/libc.so.6
            

            danblack Daniel Black added a comment - x.test - simplied case $ cat mysql-test/main/x.test --echo # --echo # MDEV-32608: Expression with constant subquery causes a crash --echo # in pushdown from HAVING --echo #   CREATE TABLE t1 (a INT, b INT); INSERT INTO t1 VALUES (2, 1), (3, 2);   let $q= SELECT * FROM t1 GROUP BY b HAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3;   eval EXPLAIN FORMAT=JSON $q;   DROP TABLE t1; Breakpoints: b mysql_explain_union c b Time_and_counter_tracker::incr_loops c (point of crash on s390x) this -> (Time_and_counter_tracker *) on s390x is freed memory. rr replay mysql-test/var/log/mysqld.1.rr/mariadbd-0 (10.6-b7b2d2bde4f7d92e2f98e28774199bf24dea37a4) crash location: #0 Time_and_counter_tracker::incr_loops (this=0x7f307801b740) at /home/dan/repos/mariadb-server-10.6/sql/sql_analyze_stmt.h:170 #1 0x00000000009b9c68 in JOIN::exec (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:4711 #2 0x0000000000990c6b in mysql_select (thd=0x7f3078000dc8, tables=0x7f3078016f18, fields=@0x7f3078016a40: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7f3078016eb0, last = 0x7f3078016eb0, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748612, result=0x0, unit=0x7f3078017640, select_lex=0x7f3078016780) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:5191 #3 0x00000000009e8ce1 in mysql_explain_union (thd=0x7f3078000dc8, unit=0x7f3078017640, result=0x0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:29443 #4 0x00000000009bb26b in select_describe (join=0x7f30780193c0, need_tmp_table=true, need_order=true, distinct=false, message=0x0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:29397 #5 0x00000000009bac0a in JOIN::exec_inner (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:4896 #6 0x00000000009b9cae in JOIN::exec (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:4712 #7 0x0000000000990c6b in mysql_select (thd=0x7f3078000dc8, tables=0x7f3078015ef0, fields=@0x7f3078015b78: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7f3078015ea0, last = 0x7f3078019d60, elements = 2}, <No data fields>}, conds=0x0, og_num=1, order=0x0, group=0x7f3078016728, having=0x7f30780188c0, proc_param=0x0, select_options=2147748612, result=0x7f30780192f8, unit=0x7f30780051b0, select_lex=0x7f30780158b8) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:5191 #8 0x00000000009e8ce1 in mysql_explain_union (thd=0x7f3078000dc8, unit=0x7f30780051b0, result=0x7f30780192f8) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:29443 #9 0x0000000000945343 in execute_sqlcom_select (thd=0x7f3078000dc8, all_tables=0x7f3078015ef0) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:6335 #10 0x0000000000938b75 in mysql_execute_command (thd=0x7f3078000dc8, is_called_from_prepared_stmt=false) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:3988 #11 0x000000000092f62a in mysql_parse (thd=0x7f3078000dc8, rawbuf=0x7f3078015790 "EXPLAIN FORMAT=JSON SELECT * FROM t1\nGROUP BY b\nHAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3", length=96, parser_state=0x7f3098ce6898) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:8181 #12 0x000000000092bfed in dispatch_command (command=COM_QUERY, thd=0x7f3078000dc8, packet=0x7f307800ba29 "", packet_length=96, blocking=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:1897 #13 0x00000000009308c7 in do_command (thd=0x7f3078000dc8, blocking=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:1410 #14 0x0000000000b2e106 in do_handle_one_connection (connect=0x3d464e38, put_in_cache=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_connect.cc:1417 #15 0x0000000000b2de5a in handle_one_connection (arg=0x3d451808) at /home/dan/repos/mariadb-server-10.6/sql/sql_connect.cc:1319 #16 0x000000000110ee2f in pfs_spawn_thread (arg=0x3d455f68) at /home/dan/repos/mariadb-server-10.6/storage/perfschema/pfs.cc:2201 #17 0x00007f309d4a66d7 in start_thread () from /lib64/libc.so.6 #18 0x00007f309d52a414 in clone () from /lib64/libc.so.6   (rr) watch -l last_start Hardware watchpoint 4: -location last_start (rr) reverse-continue .. Allocation location: (rr) bt #0 0x00007f309d58cb31 in __memset_evex_unaligned_erms () from /lib64/libc.so.6 #1 0x000000000174cf34 in alloc_root (mem_root=0x7f3078006d68, length=240) at /home/dan/repos/mariadb-server-10.6/mysys/my_alloc.c:270 #2 0x00000000007af92d in Sql_alloc::operator new (size=240, mem_root=0x7f3078006d68) at /home/dan/repos/mariadb-server-10.6/sql/sql_alloc.h:37 #3 0x00000000009b91bb in JOIN::save_explain_data_intern (this=0x7f307801a088, output=0x7f3078019970, need_tmp_table_arg=false, need_order_arg=false, distinct_arg=false, message=0x0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:29229 #4 0x00000000009996ca in JOIN::save_explain_data (this=0x7f307801a088, output=0x7f3078019970, can_overwrite=false, need_tmp_table=false, need_order=false, distinct=false) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:4671 #5 0x0000000000998d4c in JOIN::build_explain (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1868 #6 0x0000000000999b10 in JOIN::optimize (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1933 #7 0x00000000008f6e0e in st_select_lex::optimize_unflattened_subqueries (this=0x7f30780158b8, const_only=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_lex.cc:5017 #8 0x0000000000ba5b47 in JOIN::optimize_constant_subqueries (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/opt_subselect.cc:5717 #9 0x000000000099d92f in JOIN::optimize_inner (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:2259 #10 0x0000000000999ac9 in JOIN::optimize (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1927 #11 0x0000000000990b80 in mysql_select (thd=0x7f3078000dc8, tables=0x7f3078015ef0, fields=@0x7f3078015b78: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7f3078015ea0, last = 0x7f3078019d60, elements = 2}, <No data fields>}, conds=0x0, og_num=1, order=0x0, group=0x7f3078016728, having=0x7f30780188c0, proc_param=0x0, select_options=2147748612, result=0x7f30780192f8, unit=0x7f30780051b0, select_lex=0x7f30780158b8) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:5177 #12 0x00000000009e8ce1 in mysql_explain_union (thd=0x7f3078000dc8, unit=0x7f30780051b0, result=0x7f30780192f8) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:29443 #13 0x0000000000945343 in execute_sqlcom_select (thd=0x7f3078000dc8, all_tables=0x7f3078015ef0) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:6335 #14 0x0000000000938b75 in mysql_execute_command (thd=0x7f3078000dc8, is_called_from_prepared_stmt=false) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:3988 #15 0x000000000092f62a in mysql_parse (thd=0x7f3078000dc8, rawbuf=0x7f3078015790 "EXPLAIN FORMAT=JSON SELECT * FROM t1\nGROUP BY b\nHAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3", length=96, parser_state=0x7f3098ce6898) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:8181 #16 0x000000000092bfed in dispatch_command (command=COM_QUERY, thd=0x7f3078000dc8, packet=0x7f307800ba29 "", packet_length=96, blocking=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:1897 #17 0x00000000009308c7 in do_command (thd=0x7f3078000dc8, blocking=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:1410 #18 0x0000000000b2e106 in do_handle_one_connection (connect=0x3d464e38, put_in_cache=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_connect.cc:1417 #19 0x0000000000b2de5a in handle_one_connection (arg=0x3d451808) at /home/dan/repos/mariadb-server-10.6/sql/sql_connect.cc:1319 #20 0x000000000110ee2f in pfs_spawn_thread (arg=0x3d455f68) at /home/dan/repos/mariadb-server-10.6/storage/perfschema/pfs.cc:2201 #21 0x00007f309d4a66d7 in start_thread () from /lib64/libc.so.6 #22 0x00007f309d52a414 in clone () from /lib64/libc.so.6 text diff of traces - use https://www.diffchecker.com/text-compare/ #11 0x0000000000990b80 in mysql_select sql/sql_select.cc:5177 - point of initalization point of failure: #2 0x0000000000990c6b in mysql_select sql/sql_select.cc:5191 (14 lines later) s390x root@fbbde0e0d899:/build# mysql-test/mtr --manual-gdb='b mysql_explain_union; r' x.test term2 mdborg@ibm-s390x-ubuntu22:~$ docker exec -ti build bash root@fbbde0e0d899:/build# gdb -x /build/mysql-test/var/tmp/gdbinit.mysqld.1 /build/sql/mariadbd   Thread 6 "mariadbd" hit Breakpoint 1, mysql_explain_union (thd=0x3ff7c000dc8, unit=0x3ff7c0051b0, result=0x3ff7c01bb58) at /source/sql/sql_select.cc:29407 29407 DBUG_ENTER("mysql_explain_union"); (gdb) bt #0 mysql_explain_union (thd=0x3ff7c000dc8, unit=0x3ff7c0051b0, result=0x3ff7c01bb58) at /source/sql/sql_select.cc:29407 #1 0x000002aa059346ae in execute_sqlcom_select (thd=0x3ff7c000dc8, all_tables=0x3ff7c018750) at /source/sql/sql_parse.cc:6335 #2 0x000002aa0592af60 in mysql_execute_command (thd=0x3ff7c000dc8, is_called_from_prepared_stmt=false) at /source/sql/sql_parse.cc:3988 #3 0x000002aa0593a8e2 in mysql_parse (thd=0x3ff7c000dc8, rawbuf=0x3ff7c017ff0 "EXPLAIN FORMAT=JSON SELECT * FROM t1\nGROUP BY b\nHAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3", length=96, parser_state=0x3ff9347e138) at /source/sql/sql_parse.cc:8181 #4 0x000002aa05923ea4 in dispatch_command (command=COM_QUERY, thd=0x3ff7c000dc8, packet=0x3ff7c00baf9 "", packet_length=96, blocking=true) at /source/sql/sql_parse.cc:1897 #5 0x000002aa05922626 in do_command (thd=0x3ff7c000dc8, blocking=true) at /source/sql/sql_parse.cc:1410 #6 0x000002aa05b4cf70 in do_handle_one_connection (connect=0x2aa0a3ed668, put_in_cache=true) at /source/sql/sql_connect.cc:1417 #7 0x000002aa05b4cb90 in handle_one_connection (arg=0x2aa0a3ed668) at /source/sql/sql_connect.cc:1319 #8 0x000002aa0621e8ee in pfs_spawn_thread (arg=0x2aa0a4127b8) at /source/storage/perfschema/pfs.cc:2201 #9 0x000003ff93196296 in ?? () from /lib/s390x-linux-gnu/libc.so.6 #10 0x000003ff9320ff8e in ?? () from /lib/s390x-linux-gnu/libc.so.6 (gdb) b JOIN::save_explain_data_intern Breakpoint 2 at 0x2aa059e6f30: file /source/sql/sql_select.cc, line 29163. (gdb) c Continuing.   Thread 6 "mariadbd" hit Breakpoint 2, JOIN::save_explain_data_intern (this=0x3ff7c01c8e8, output=0x3ff7c01c1d0, need_tmp_table_arg=false, need_order_arg=false, distinct_arg=false, message=0x0) at /source/sql/sql_select.cc:29163 29163 JOIN *join= this; /* Legacy: this code used to be a non-member function */ (gdb) bt #0 JOIN::save_explain_data_intern (this=0x3ff7c01c8e8, output=0x3ff7c01c1d0, need_tmp_table_arg=false, need_order_arg=false, distinct_arg=false, message=0x0) at /source/sql/sql_select.cc:29163 #1 0x000002aa05998912 in JOIN::save_explain_data (this=0x3ff7c01c8e8, output=0x3ff7c01c1d0, can_overwrite=false, need_tmp_table=false, need_order=false, distinct=false) at /source/sql/sql_select.cc:4671 #2 0x000002aa0598cfc4 in JOIN::build_explain (this=0x3ff7c01c8e8) at /source/sql/sql_select.cc:1868 #3 0x000002aa0598d474 in JOIN::optimize (this=0x3ff7c01c8e8) at /source/sql/sql_select.cc:1933 #4 0x000002aa058e2778 in st_select_lex::optimize_unflattened_subqueries (this=0x3ff7c018118, const_only=true) at /source/sql/sql_lex.cc:5017 #5 0x000002aa05be62d8 in JOIN::optimize_constant_subqueries (this=0x3ff7c01bc20) at /source/sql/opt_subselect.cc:5717 #6 0x000002aa0598e652 in JOIN::optimize_inner (this=0x3ff7c01bc20) at /source/sql/sql_select.cc:2259 #7 0x000002aa0598d41e in JOIN::optimize (this=0x3ff7c01bc20) at /source/sql/sql_select.cc:1927 #8 0x000002aa0599a892 in mysql_select (thd=0x3ff7c000dc8, tables=0x3ff7c018750, fields=..., conds=0x0, og_num=1, order=0x0, group=0x3ff7c018f88, having=0x3ff7c01b120, proc_param=0x0, select_options=2147748612, result=0x3ff7c01bb58, unit=0x3ff7c0051b0, select_lex=0x3ff7c018118) at /source/sql/sql_select.cc:5177 #9 0x000002aa059e8640 in mysql_explain_union (thd=0x3ff7c000dc8, unit=0x3ff7c0051b0, result=0x3ff7c01bb58) at /source/sql/sql_select.cc:29443 #10 0x000002aa059346ae in execute_sqlcom_select (thd=0x3ff7c000dc8, all_tables=0x3ff7c018750) at /source/sql/sql_parse.cc:6335 #11 0x000002aa0592af60 in mysql_execute_command (thd=0x3ff7c000dc8, is_called_from_prepared_stmt=false) at /source/sql/sql_parse.cc:3988 #12 0x000002aa0593a8e2 in mysql_parse (thd=0x3ff7c000dc8, rawbuf=0x3ff7c017ff0 "EXPLAIN FORMAT=JSON SELECT * FROM t1\nGROUP BY b\nHAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3", length=96, parser_state=0x3ff9347e138) at /source/sql/sql_parse.cc:8181 #13 0x000002aa05923ea4 in dispatch_command (command=COM_QUERY, thd=0x3ff7c000dc8, packet=0x3ff7c00baf9 "", packet_length=96, blocking=true) at /source/sql/sql_parse.cc:1897 #14 0x000002aa05922626 in do_command (thd=0x3ff7c000dc8, blocking=true) at /source/sql/sql_parse.cc:1410 #15 0x000002aa05b4cf70 in do_handle_one_connection (connect=0x2aa0a3ed668, put_in_cache=true) at /source/sql/sql_connect.cc:1417 #16 0x000002aa05b4cb90 in handle_one_connection (arg=0x2aa0a3ed668) at /source/sql/sql_connect.cc:1319 #17 0x000002aa0621e8ee in pfs_spawn_thread (arg=0x2aa0a4127b8) at /source/storage/perfschema/pfs.cc:2201 #18 0x000003ff93196296 in ?? () from /lib/s390x-linux-gnu/libc.so.6 #19 0x000003ff9320ff8e in ?? () from /lib/s390x-linux-gnu/libc.so.6
            danblack Daniel Black added a comment -

            s390x assert

            ]
            5  0x000002aa078187b8 in JOIN::save_explain_data (this=0x3ff9808a570, output=0x3ff9801c1d0, can_overwrite=false, need_tmp_table=false, need_order=false, distinct=false) at /source/sql/sql_select.cc:4652
            4652	  DBUG_ASSERT(select_lex->select_number == FAKE_SELECT_LEX_ID || !output ||
            (gdb) p optimization_state
            $3 = JOIN::OPTIMIZATION_IN_PROGRESS
            (gdb) p output.selects
            $4 = {array = {buffer = 0x3ff9801c2d0 "", elements = 3, max_element = 16, alloc_increment = 16, size_of_element = 8, m_psi_key = 7, malloc_flags = 256}}
            (gdb) p optimization_state
            $5 = JOIN::OPTIMIZATION_IN_PROGRESS
            (gdb) bt
            #0  0x000003ffaeb98116 in ?? () from /lib/s390x-linux-gnu/libc.so.6
            #1  0x000003ffaeb48ac0 in raise () from /lib/s390x-linux-gnu/libc.so.6
            #2  0x000003ffaeb2a460 in abort () from /lib/s390x-linux-gnu/libc.so.6
            #3  0x000003ffaeb40184 in ?? () from /lib/s390x-linux-gnu/libc.so.6
            #4  0x000003ffaeb401fe in __assert_fail () from /lib/s390x-linux-gnu/libc.so.6
            #5  0x000002aa078187b8 in JOIN::save_explain_data (this=0x3ff9808a570, output=0x3ff9801c1d0, can_overwrite=false, need_tmp_table=false, need_order=false, distinct=false) at /source/sql/sql_select.cc:4652
            #6  0x000002aa0780cfc4 in JOIN::build_explain (this=0x3ff9808a570) at /source/sql/sql_select.cc:1868
            #7  0x000002aa0780d474 in JOIN::optimize (this=0x3ff9808a570) at /source/sql/sql_select.cc:1933
            #8  0x000002aa07762778 in st_select_lex::optimize_unflattened_subqueries (this=0x3ff98018118, const_only=false) at /source/sql/sql_lex.cc:5017
            #9  0x000002aa07a66250 in JOIN::optimize_unflattened_subqueries (this=0x3ff9801bc20) at /source/sql/opt_subselect.cc:5683
            #10 0x000002aa07812680 in JOIN::optimize_stage2 (this=0x3ff9801bc20) at /source/sql/sql_select.cc:3227
            #11 0x000002aa0781006a in JOIN::optimize_inner (this=0x3ff9801bc20) at /source/sql/sql_select.cc:2636
            #12 0x000002aa0780d41e in JOIN::optimize (this=0x3ff9801bc20) at /source/sql/sql_select.cc:1927
            #13 0x000002aa0781a892 in mysql_select (thd=0x3ff98000dc8, tables=0x3ff98018750, fields=..., conds=0x0, og_num=1, order=0x0, group=0x3ff98018f88, having=0x3ff9801b120, proc_param=0x0, 
                select_options=2147748612, result=0x3ff9801bb58, unit=0x3ff980051b0, select_lex=0x3ff98018118) at /source/sql/sql_select.cc:5177
            #14 0x000002aa07868640 in mysql_explain_union (thd=0x3ff98000dc8, unit=0x3ff980051b0, result=0x3ff9801bb58) at /source/sql/sql_select.cc:29443
            #15 0x000002aa077b46ae in execute_sqlcom_select (thd=0x3ff98000dc8, all_tables=0x3ff98018750) at /source/sql/sql_parse.cc:6335
            #16 0x000002aa077aaf60 in mysql_execute_command (thd=0x3ff98000dc8, is_called_from_prepared_stmt=false) at /source/sql/sql_parse.cc:3988
            #17 0x000002aa077ba8e2 in mysql_parse (thd=0x3ff98000dc8, rawbuf=0x3ff98017ff0 "EXPLAIN FORMAT=JSON SELECT * FROM t1\nGROUP BY b\nHAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3", length=96, 
                parser_state=0x3ffaee7e138) at /source/sql/sql_parse.cc:8181
            #18 0x000002aa077a3ea4 in dispatch_command (command=COM_QUERY, thd=0x3ff98000dc8, packet=0x3ff9800baf9 "", packet_length=96, blocking=true) at /source/sql/sql_parse.cc:1897
            #19 0x000002aa077a2626 in do_command (thd=0x3ff98000dc8, blocking=true) at /source/sql/sql_parse.cc:1410
            #20 0x000002aa079ccf70 in do_handle_one_connection (connect=0x2aa0bfb1668, put_in_cache=true) at /source/sql/sql_connect.cc:1417
            #21 0x000002aa079ccb90 in handle_one_connection (arg=0x2aa0bfb1668) at /source/sql/sql_connect.cc:1319
            #22 0x000002aa0809e8ee in pfs_spawn_thread (arg=0x2aa0bfd67b8) at /source/storage/perfschema/pfs.cc:2201
            #23 0x000003ffaeb96296 in ?? () from /lib/s390x-linux-gnu/libc.so.6
            #24 0x000003ffaec0ff8e in ?? () from /lib/s390x-linux-gnu/libc.so.6
            

            x86_64 at same point

            (rr) bt
            #0  JOIN::save_explain_data (this=0x7f307801a088, output=0x7f3078019970, can_overwrite=false, need_tmp_table=false, need_order=false, distinct=false)
                at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:4639
            #1  0x0000000000998d4c in JOIN::build_explain (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1868
            #2  0x0000000000999b10 in JOIN::optimize (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1933
            #3  0x00000000008f6e0e in st_select_lex::optimize_unflattened_subqueries (this=0x7f30780158b8, const_only=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_lex.cc:5017
            #4  0x0000000000ba5b47 in JOIN::optimize_constant_subqueries (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/opt_subselect.cc:5717
            #5  0x000000000099d92f in JOIN::optimize_inner (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:2259
            #6  0x0000000000999ac9 in JOIN::optimize (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1927
            #7  0x0000000000990b80 in mysql_select (thd=0x7f3078000dc8, tables=0x7f3078015ef0, 
                fields=@0x7f3078015b78: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7f3078015ea0, last = 0x7f3078019d60, elements = 2}, <No data fields>}, conds=0x0, og_num=1, order=0x0, 
                group=0x7f3078016728, having=0x7f30780188c0, proc_param=0x0, select_options=2147748612, result=0x7f30780192f8, unit=0x7f30780051b0, select_lex=0x7f30780158b8)
                at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:5177
            #8  0x00000000009e8ce1 in mysql_explain_union (thd=0x7f3078000dc8, unit=0x7f30780051b0, result=0x7f30780192f8) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:29443
            #9  0x0000000000945343 in execute_sqlcom_select (thd=0x7f3078000dc8, all_tables=0x7f3078015ef0) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:6335
            #10 0x0000000000938b75 in mysql_execute_command (thd=0x7f3078000dc8, is_called_from_prepared_stmt=false) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:3988
            #11 0x000000000092f62a in mysql_parse (thd=0x7f3078000dc8, rawbuf=0x7f3078015790 "EXPLAIN FORMAT=JSON SELECT * FROM t1\nGROUP BY b\nHAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3", length=96, 
                parser_state=0x7f3098ce6898) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:8181
            #12 0x000000000092bfed in dispatch_command (command=COM_QUERY, thd=0x7f3078000dc8, packet=0x7f307800ba29 "", packet_length=96, blocking=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:1897
            #13 0x00000000009308c7 in do_command (thd=0x7f3078000dc8, blocking=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:1410
            #14 0x0000000000b2e106 in do_handle_one_connection (connect=0x3d464e38, put_in_cache=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_connect.cc:1417
            #15 0x0000000000b2de5a in handle_one_connection (arg=0x3d451808) at /home/dan/repos/mariadb-server-10.6/sql/sql_connect.cc:1319
            #16 0x000000000110ee2f in pfs_spawn_thread (arg=0x3d455f68) at /home/dan/repos/mariadb-server-10.6/storage/perfschema/pfs.cc:2201
            #17 0x00007f309d4a66d7 in start_thread () from /lib64/libc.so.6
            #18 0x00007f309d52a414 in clone () from /lib64/libc.so.6
            (rr) p optimization_state
            $9 = JOIN::OPTIMIZATION_IN_PROGRESS
            (rr) p output.selects
            $10 = {array = {buffer = 0x7f3078019a70 '\245' <repeats 128 times>, "\250\3410\002", elements = 0, max_element = 16, alloc_increment = 16, size_of_element = 8, m_psi_key = 7, malloc_flags = 256}}
            

            output.selects has 0 elements and not 3 which s390x has.

            output is thd->lex->explain

            x86-64 getting its 3 elements - later in JOIN::save_explain_data than the s390x assertion

            Thread 2 hit Hardware watchpoint 11: -location output.selects.array.elements
             
            Old value = 0
            New value = 3
            set_dynamic (array=0x7f30780199b0, element=0x7f3098ce3c50, idx=2) at /home/dan/repos/mariadb-server-10.6/mysys/array.c:212
            212	  memcpy(array->buffer+(idx * array->size_of_element),element,
            (rr) bt
            #0  set_dynamic (array=0x7f30780199b0, element=0x7f3098ce3c50, idx=2) at /home/dan/repos/mariadb-server-10.6/mysys/array.c:212
            #1  0x0000000000b7de5d in Dynamic_array<Explain_select*>::resize (this=0x7f30780199b0, new_size=3, default_val=0x0) at /home/dan/repos/mariadb-server-10.6/sql/sql_array.h:275
            #2  0x0000000000b707f9 in Explain_query::add_node (this=0x7f3078019970, node=0x7f307801b698) at /home/dan/repos/mariadb-server-10.6/sql/sql_explain.cc:129
            #3  0x00000000009b99fb in JOIN::save_explain_data_intern (this=0x7f307801a088, output=0x7f3078019970, need_tmp_table_arg=false, need_order_arg=false, distinct_arg=false, message=0x0)
                at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:29320
            #4  0x00000000009996ca in JOIN::save_explain_data (this=0x7f307801a088, output=0x7f3078019970, can_overwrite=false, need_tmp_table=false, need_order=false, distinct=false)
                at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:4671
            #5  0x0000000000998d4c in JOIN::build_explain (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1868
            #6  0x0000000000999b10 in JOIN::optimize (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1933
            #7  0x00000000008f6e0e in st_select_lex::optimize_unflattened_subqueries (this=0x7f30780158b8, const_only=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_lex.cc:5017
            #8  0x0000000000ba5b47 in JOIN::optimize_constant_subqueries (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/opt_subselect.cc:5717
            #9  0x000000000099d92f in JOIN::optimize_inner (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:2259
            #10 0x0000000000999ac9 in JOIN::optimize (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1927
            #11 0x0000000000990b80 in mysql_select (thd=0x7f3078000dc8, tables=0x7f3078015ef0, 
                fields=@0x7f3078015b78: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7f3078015ea0, last = 0x7f3078019d60, elements = 2}, <No data fields>}, conds=0x0, og_num=1, order=0x0, 
                group=0x7f3078016728, having=0x7f30780188c0, proc_param=0x0, select_options=2147748612, result=0x7f30780192f8, unit=0x7f30780051b0, select_lex=0x7f30780158b8)
                at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:5177
            #12 0x00000000009e8ce1 in mysql_explain_union (thd=0x7f3078000dc8, unit=0x7f30780051b0, result=0x7f30780192f8) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:29443
            #13 0x0000000000945343 in execute_sqlcom_select (thd=0x7f3078000dc8, all_tables=0x7f3078015ef0) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:6335
            #14 0x0000000000938b75 in mysql_execute_command (thd=0x7f3078000dc8, is_called_from_prepared_stmt=false) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:3988
            #15 0x000000000092f62a in mysql_parse (thd=0x7f3078000dc8, rawbuf=0x7f3078015790 "EXPLAIN FORMAT=JSON SELECT * FROM t1\nGROUP BY b\nHAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3", length=96, 
                parser_state=0x7f3098ce6898) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:8181
            #16 0x000000000092bfed in dispatch_command (command=COM_QUERY, thd=0x7f3078000dc8, packet=0x7f307800ba29 "", packet_length=96, blocking=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:1897
            #17 0x00000000009308c7 in do_command (thd=0x7f3078000dc8, blocking=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:1410
            #18 0x0000000000b2e106 in do_handle_one_connection (connect=0x3d464e38, put_in_cache=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_connect.cc:1417
            #19 0x0000000000b2de5a in handle_one_connection (arg=0x3d451808) at /home/dan/repos/mariadb-server-10.6/sql/sql_connect.cc:1319
            #20 0x000000000110ee2f in pfs_spawn_thread (arg=0x3d455f68) at /home/dan/repos/mariadb-server-10.6/storage/perfschema/pfs.cc:2201
            #21 0x00007f309d4a66d7 in start_thread () from /lib64/libc.so.6
            #22 0x00007f309d52a414 in clone () from /lib64/libc.so.6
            (rr) up
            #1  0x0000000000b7de5d in Dynamic_array<Explain_select*>::resize (this=0x7f30780199b0, new_size=3, default_val=0x0) at /home/dan/repos/mariadb-server-10.6/sql/sql_array.h:275
            275	      set_dynamic(&array, (uchar*)&default_val, (uint)(new_size - 1));
            (rr) up
            #2  0x0000000000b707f9 in Explain_query::add_node (this=0x7f3078019970, node=0x7f307801b698) at /home/dan/repos/mariadb-server-10.6/sql/sql_explain.cc:129
            129	        selects.resize(MY_MAX(select_id+1, selects.elements()*2), NULL);
            (rr) up
            #3  0x00000000009b99fb in JOIN::save_explain_data_intern (this=0x7f307801a088, output=0x7f3078019970, need_tmp_table_arg=false, need_order_arg=false, distinct_arg=false, message=0x0)
                at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:29320
            29320	    output->add_node(xpl_sel);
            (rr) p optimization_state 
            $14 = JOIN::OPTIMIZATION_IN_PROGRESS
            (rr) c
            Continuing.
             
            Thread 2 hit Hardware watchpoint 6: -location optimization_state
             
            Old value = JOIN::OPTIMIZATION_IN_PROGRESS
            New value = JOIN::OPTIMIZATION_DONE
            

            danblack Daniel Black added a comment - s390x assert ] 5 0x000002aa078187b8 in JOIN::save_explain_data (this=0x3ff9808a570, output=0x3ff9801c1d0, can_overwrite=false, need_tmp_table=false, need_order=false, distinct=false) at /source/sql/sql_select.cc:4652 4652 DBUG_ASSERT(select_lex->select_number == FAKE_SELECT_LEX_ID || !output || (gdb) p optimization_state $3 = JOIN::OPTIMIZATION_IN_PROGRESS (gdb) p output.selects $4 = {array = {buffer = 0x3ff9801c2d0 "", elements = 3, max_element = 16, alloc_increment = 16, size_of_element = 8, m_psi_key = 7, malloc_flags = 256}} (gdb) p optimization_state $5 = JOIN::OPTIMIZATION_IN_PROGRESS (gdb) bt #0 0x000003ffaeb98116 in ?? () from /lib/s390x-linux-gnu/libc.so.6 #1 0x000003ffaeb48ac0 in raise () from /lib/s390x-linux-gnu/libc.so.6 #2 0x000003ffaeb2a460 in abort () from /lib/s390x-linux-gnu/libc.so.6 #3 0x000003ffaeb40184 in ?? () from /lib/s390x-linux-gnu/libc.so.6 #4 0x000003ffaeb401fe in __assert_fail () from /lib/s390x-linux-gnu/libc.so.6 #5 0x000002aa078187b8 in JOIN::save_explain_data (this=0x3ff9808a570, output=0x3ff9801c1d0, can_overwrite=false, need_tmp_table=false, need_order=false, distinct=false) at /source/sql/sql_select.cc:4652 #6 0x000002aa0780cfc4 in JOIN::build_explain (this=0x3ff9808a570) at /source/sql/sql_select.cc:1868 #7 0x000002aa0780d474 in JOIN::optimize (this=0x3ff9808a570) at /source/sql/sql_select.cc:1933 #8 0x000002aa07762778 in st_select_lex::optimize_unflattened_subqueries (this=0x3ff98018118, const_only=false) at /source/sql/sql_lex.cc:5017 #9 0x000002aa07a66250 in JOIN::optimize_unflattened_subqueries (this=0x3ff9801bc20) at /source/sql/opt_subselect.cc:5683 #10 0x000002aa07812680 in JOIN::optimize_stage2 (this=0x3ff9801bc20) at /source/sql/sql_select.cc:3227 #11 0x000002aa0781006a in JOIN::optimize_inner (this=0x3ff9801bc20) at /source/sql/sql_select.cc:2636 #12 0x000002aa0780d41e in JOIN::optimize (this=0x3ff9801bc20) at /source/sql/sql_select.cc:1927 #13 0x000002aa0781a892 in mysql_select (thd=0x3ff98000dc8, tables=0x3ff98018750, fields=..., conds=0x0, og_num=1, order=0x0, group=0x3ff98018f88, having=0x3ff9801b120, proc_param=0x0, select_options=2147748612, result=0x3ff9801bb58, unit=0x3ff980051b0, select_lex=0x3ff98018118) at /source/sql/sql_select.cc:5177 #14 0x000002aa07868640 in mysql_explain_union (thd=0x3ff98000dc8, unit=0x3ff980051b0, result=0x3ff9801bb58) at /source/sql/sql_select.cc:29443 #15 0x000002aa077b46ae in execute_sqlcom_select (thd=0x3ff98000dc8, all_tables=0x3ff98018750) at /source/sql/sql_parse.cc:6335 #16 0x000002aa077aaf60 in mysql_execute_command (thd=0x3ff98000dc8, is_called_from_prepared_stmt=false) at /source/sql/sql_parse.cc:3988 #17 0x000002aa077ba8e2 in mysql_parse (thd=0x3ff98000dc8, rawbuf=0x3ff98017ff0 "EXPLAIN FORMAT=JSON SELECT * FROM t1\nGROUP BY b\nHAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3", length=96, parser_state=0x3ffaee7e138) at /source/sql/sql_parse.cc:8181 #18 0x000002aa077a3ea4 in dispatch_command (command=COM_QUERY, thd=0x3ff98000dc8, packet=0x3ff9800baf9 "", packet_length=96, blocking=true) at /source/sql/sql_parse.cc:1897 #19 0x000002aa077a2626 in do_command (thd=0x3ff98000dc8, blocking=true) at /source/sql/sql_parse.cc:1410 #20 0x000002aa079ccf70 in do_handle_one_connection (connect=0x2aa0bfb1668, put_in_cache=true) at /source/sql/sql_connect.cc:1417 #21 0x000002aa079ccb90 in handle_one_connection (arg=0x2aa0bfb1668) at /source/sql/sql_connect.cc:1319 #22 0x000002aa0809e8ee in pfs_spawn_thread (arg=0x2aa0bfd67b8) at /source/storage/perfschema/pfs.cc:2201 #23 0x000003ffaeb96296 in ?? () from /lib/s390x-linux-gnu/libc.so.6 #24 0x000003ffaec0ff8e in ?? () from /lib/s390x-linux-gnu/libc.so.6 x86_64 at same point (rr) bt #0 JOIN::save_explain_data (this=0x7f307801a088, output=0x7f3078019970, can_overwrite=false, need_tmp_table=false, need_order=false, distinct=false) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:4639 #1 0x0000000000998d4c in JOIN::build_explain (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1868 #2 0x0000000000999b10 in JOIN::optimize (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1933 #3 0x00000000008f6e0e in st_select_lex::optimize_unflattened_subqueries (this=0x7f30780158b8, const_only=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_lex.cc:5017 #4 0x0000000000ba5b47 in JOIN::optimize_constant_subqueries (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/opt_subselect.cc:5717 #5 0x000000000099d92f in JOIN::optimize_inner (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:2259 #6 0x0000000000999ac9 in JOIN::optimize (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1927 #7 0x0000000000990b80 in mysql_select (thd=0x7f3078000dc8, tables=0x7f3078015ef0, fields=@0x7f3078015b78: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7f3078015ea0, last = 0x7f3078019d60, elements = 2}, <No data fields>}, conds=0x0, og_num=1, order=0x0, group=0x7f3078016728, having=0x7f30780188c0, proc_param=0x0, select_options=2147748612, result=0x7f30780192f8, unit=0x7f30780051b0, select_lex=0x7f30780158b8) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:5177 #8 0x00000000009e8ce1 in mysql_explain_union (thd=0x7f3078000dc8, unit=0x7f30780051b0, result=0x7f30780192f8) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:29443 #9 0x0000000000945343 in execute_sqlcom_select (thd=0x7f3078000dc8, all_tables=0x7f3078015ef0) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:6335 #10 0x0000000000938b75 in mysql_execute_command (thd=0x7f3078000dc8, is_called_from_prepared_stmt=false) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:3988 #11 0x000000000092f62a in mysql_parse (thd=0x7f3078000dc8, rawbuf=0x7f3078015790 "EXPLAIN FORMAT=JSON SELECT * FROM t1\nGROUP BY b\nHAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3", length=96, parser_state=0x7f3098ce6898) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:8181 #12 0x000000000092bfed in dispatch_command (command=COM_QUERY, thd=0x7f3078000dc8, packet=0x7f307800ba29 "", packet_length=96, blocking=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:1897 #13 0x00000000009308c7 in do_command (thd=0x7f3078000dc8, blocking=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:1410 #14 0x0000000000b2e106 in do_handle_one_connection (connect=0x3d464e38, put_in_cache=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_connect.cc:1417 #15 0x0000000000b2de5a in handle_one_connection (arg=0x3d451808) at /home/dan/repos/mariadb-server-10.6/sql/sql_connect.cc:1319 #16 0x000000000110ee2f in pfs_spawn_thread (arg=0x3d455f68) at /home/dan/repos/mariadb-server-10.6/storage/perfschema/pfs.cc:2201 #17 0x00007f309d4a66d7 in start_thread () from /lib64/libc.so.6 #18 0x00007f309d52a414 in clone () from /lib64/libc.so.6 (rr) p optimization_state $9 = JOIN::OPTIMIZATION_IN_PROGRESS (rr) p output.selects $10 = {array = {buffer = 0x7f3078019a70 '\245' <repeats 128 times>, "\250\3410\002", elements = 0, max_element = 16, alloc_increment = 16, size_of_element = 8, m_psi_key = 7, malloc_flags = 256}} output.selects has 0 elements and not 3 which s390x has. output is thd->lex->explain x86-64 getting its 3 elements - later in JOIN::save_explain_data than the s390x assertion Thread 2 hit Hardware watchpoint 11: -location output.selects.array.elements   Old value = 0 New value = 3 set_dynamic (array=0x7f30780199b0, element=0x7f3098ce3c50, idx=2) at /home/dan/repos/mariadb-server-10.6/mysys/array.c:212 212 memcpy(array->buffer+(idx * array->size_of_element),element, (rr) bt #0 set_dynamic (array=0x7f30780199b0, element=0x7f3098ce3c50, idx=2) at /home/dan/repos/mariadb-server-10.6/mysys/array.c:212 #1 0x0000000000b7de5d in Dynamic_array<Explain_select*>::resize (this=0x7f30780199b0, new_size=3, default_val=0x0) at /home/dan/repos/mariadb-server-10.6/sql/sql_array.h:275 #2 0x0000000000b707f9 in Explain_query::add_node (this=0x7f3078019970, node=0x7f307801b698) at /home/dan/repos/mariadb-server-10.6/sql/sql_explain.cc:129 #3 0x00000000009b99fb in JOIN::save_explain_data_intern (this=0x7f307801a088, output=0x7f3078019970, need_tmp_table_arg=false, need_order_arg=false, distinct_arg=false, message=0x0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:29320 #4 0x00000000009996ca in JOIN::save_explain_data (this=0x7f307801a088, output=0x7f3078019970, can_overwrite=false, need_tmp_table=false, need_order=false, distinct=false) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:4671 #5 0x0000000000998d4c in JOIN::build_explain (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1868 #6 0x0000000000999b10 in JOIN::optimize (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1933 #7 0x00000000008f6e0e in st_select_lex::optimize_unflattened_subqueries (this=0x7f30780158b8, const_only=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_lex.cc:5017 #8 0x0000000000ba5b47 in JOIN::optimize_constant_subqueries (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/opt_subselect.cc:5717 #9 0x000000000099d92f in JOIN::optimize_inner (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:2259 #10 0x0000000000999ac9 in JOIN::optimize (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1927 #11 0x0000000000990b80 in mysql_select (thd=0x7f3078000dc8, tables=0x7f3078015ef0, fields=@0x7f3078015b78: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7f3078015ea0, last = 0x7f3078019d60, elements = 2}, <No data fields>}, conds=0x0, og_num=1, order=0x0, group=0x7f3078016728, having=0x7f30780188c0, proc_param=0x0, select_options=2147748612, result=0x7f30780192f8, unit=0x7f30780051b0, select_lex=0x7f30780158b8) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:5177 #12 0x00000000009e8ce1 in mysql_explain_union (thd=0x7f3078000dc8, unit=0x7f30780051b0, result=0x7f30780192f8) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:29443 #13 0x0000000000945343 in execute_sqlcom_select (thd=0x7f3078000dc8, all_tables=0x7f3078015ef0) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:6335 #14 0x0000000000938b75 in mysql_execute_command (thd=0x7f3078000dc8, is_called_from_prepared_stmt=false) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:3988 #15 0x000000000092f62a in mysql_parse (thd=0x7f3078000dc8, rawbuf=0x7f3078015790 "EXPLAIN FORMAT=JSON SELECT * FROM t1\nGROUP BY b\nHAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3", length=96, parser_state=0x7f3098ce6898) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:8181 #16 0x000000000092bfed in dispatch_command (command=COM_QUERY, thd=0x7f3078000dc8, packet=0x7f307800ba29 "", packet_length=96, blocking=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:1897 #17 0x00000000009308c7 in do_command (thd=0x7f3078000dc8, blocking=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:1410 #18 0x0000000000b2e106 in do_handle_one_connection (connect=0x3d464e38, put_in_cache=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_connect.cc:1417 #19 0x0000000000b2de5a in handle_one_connection (arg=0x3d451808) at /home/dan/repos/mariadb-server-10.6/sql/sql_connect.cc:1319 #20 0x000000000110ee2f in pfs_spawn_thread (arg=0x3d455f68) at /home/dan/repos/mariadb-server-10.6/storage/perfschema/pfs.cc:2201 #21 0x00007f309d4a66d7 in start_thread () from /lib64/libc.so.6 #22 0x00007f309d52a414 in clone () from /lib64/libc.so.6 (rr) up #1 0x0000000000b7de5d in Dynamic_array<Explain_select*>::resize (this=0x7f30780199b0, new_size=3, default_val=0x0) at /home/dan/repos/mariadb-server-10.6/sql/sql_array.h:275 275 set_dynamic(&array, (uchar*)&default_val, (uint)(new_size - 1)); (rr) up #2 0x0000000000b707f9 in Explain_query::add_node (this=0x7f3078019970, node=0x7f307801b698) at /home/dan/repos/mariadb-server-10.6/sql/sql_explain.cc:129 129 selects.resize(MY_MAX(select_id+1, selects.elements()*2), NULL); (rr) up #3 0x00000000009b99fb in JOIN::save_explain_data_intern (this=0x7f307801a088, output=0x7f3078019970, need_tmp_table_arg=false, need_order_arg=false, distinct_arg=false, message=0x0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:29320 29320 output->add_node(xpl_sel); (rr) p optimization_state $14 = JOIN::OPTIMIZATION_IN_PROGRESS (rr) c Continuing.   Thread 2 hit Hardware watchpoint 6: -location optimization_state   Old value = JOIN::OPTIMIZATION_IN_PROGRESS New value = JOIN::OPTIMIZATION_DONE
            danblack Daniel Black added a comment -

            s390 adding to array

            (gdb) p selects
            $7 = {array = {buffer = 0x3ff7401c2d0 "", elements = 3, max_element = 16, alloc_increment = 16, size_of_element = 8, m_psi_key = 7, malloc_flags = 256}}
            (gdb) watch -l selects.array.elements
            Hardware watchpoint 3: -location selects.array.elements
            (gdb) bt
            #0  Explain_query::add_node (this=0x3ff7401c1d0, node=0x3ff7401def8) at /source/sql/sql_explain.cc:131
            #1  0x000002aa192e7d4e in JOIN::save_explain_data_intern (this=0x3ff7401c8e8, output=0x3ff7401c1d0, need_tmp_table_arg=false, need_order_arg=false, distinct_arg=false, message=0x0)
                at /source/sql/sql_select.cc:29320
            #2  0x000002aa19298912 in JOIN::save_explain_data (this=0x3ff7401c8e8, output=0x3ff7401c1d0, can_overwrite=false, need_tmp_table=false, need_order=false, distinct=false) at /source/sql/sql_select.cc:4671
            #3  0x000002aa1928cfc4 in JOIN::build_explain (this=0x3ff7401c8e8) at /source/sql/sql_select.cc:1868
            #4  0x000002aa1928d474 in JOIN::optimize (this=0x3ff7401c8e8) at /source/sql/sql_select.cc:1933
            #5  0x000002aa191e2778 in st_select_lex::optimize_unflattened_subqueries (this=0x3ff74018118, const_only=true) at /source/sql/sql_lex.cc:5017
            #6  0x000002aa194e62d8 in JOIN::optimize_constant_subqueries (this=0x3ff7401bc20) at /source/sql/opt_subselect.cc:5717
            #7  0x000002aa1928e652 in JOIN::optimize_inner (this=0x3ff7401bc20) at /source/sql/sql_select.cc:2259
            #8  0x000002aa1928d41e in JOIN::optimize (this=0x3ff7401bc20) at /source/sql/sql_select.cc:1927
            #9  0x000002aa1929a892 in mysql_select (thd=0x3ff74000dc8, tables=0x3ff74018750, fields=..., conds=0x0, og_num=1, order=0x0, group=0x3ff74018f88, having=0x3ff7401b120, proc_param=0x0, 
                select_options=2147748612, result=0x3ff7401bb58, unit=0x3ff740051b0, select_lex=0x3ff74018118) at /source/sql/sql_select.cc:5177
            #10 0x000002aa192e8640 in mysql_explain_union (thd=0x3ff74000dc8, unit=0x3ff740051b0, result=0x3ff7401bb58) at /source/sql/sql_select.cc:29443
            #11 0x000002aa192346ae in execute_sqlcom_select (thd=0x3ff74000dc8, all_tables=0x3ff74018750) at /source/sql/sql_parse.cc:6335
            #12 0x000002aa1922af60 in mysql_execute_command (thd=0x3ff74000dc8, is_called_from_prepared_stmt=false) at /source/sql/sql_parse.cc:3988
            #13 0x000002aa1923a8e2 in mysql_parse (thd=0x3ff74000dc8, rawbuf=0x3ff74017ff0 "EXPLAIN FORMAT=JSON SELECT * FROM t1\nGROUP BY b\nHAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3", length=96, 
                parser_state=0x3ff8b67e138) at /source/sql/sql_parse.cc:8181
            #14 0x000002aa19223ea4 in dispatch_command (command=COM_QUERY, thd=0x3ff74000dc8, packet=0x3ff7400baf9 "", packet_length=96, blocking=true) at /source/sql/sql_parse.cc:1897
            #15 0x000002aa19222626 in do_command (thd=0x3ff74000dc8, blocking=true) at /source/sql/sql_parse.cc:1410
            #16 0x000002aa1944cf70 in do_handle_one_connection (connect=0x2aa1ce72668, put_in_cache=true) at /source/sql/sql_connect.cc:1417
            #17 0x000002aa1944cb90 in handle_one_connection (arg=0x2aa1ce72668) at /source/sql/sql_connect.cc:1319
            #18 0x000002aa19b1e8ee in pfs_spawn_thread (arg=0x2aa1ce977b8) at /source/storage/perfschema/pfs.cc:2201
            #19 0x000003ff8b396296 in ?? () from /lib/s390x-linux-gnu/libc.so.6
            #20 0x000003ff8b40ff8e in ?? () from /lib/s390x-linux-gnu/libc.so.6
            (gdb) p optimization_state 
            $8 = JOIN::OPTIMIZATION_IN_PROGRESS
            (gdb) c
            Continuing.
             
            Thread 6 "mariadbd" received signal SIGABRT, Aborted.
            0x000003ff8b398116 in ?? () from /lib/s390x-linux-gnu/libc.so.6
            
            

            danblack Daniel Black added a comment - s390 adding to array (gdb) p selects $7 = {array = {buffer = 0x3ff7401c2d0 "", elements = 3, max_element = 16, alloc_increment = 16, size_of_element = 8, m_psi_key = 7, malloc_flags = 256}} (gdb) watch -l selects.array.elements Hardware watchpoint 3: -location selects.array.elements (gdb) bt #0 Explain_query::add_node (this=0x3ff7401c1d0, node=0x3ff7401def8) at /source/sql/sql_explain.cc:131 #1 0x000002aa192e7d4e in JOIN::save_explain_data_intern (this=0x3ff7401c8e8, output=0x3ff7401c1d0, need_tmp_table_arg=false, need_order_arg=false, distinct_arg=false, message=0x0) at /source/sql/sql_select.cc:29320 #2 0x000002aa19298912 in JOIN::save_explain_data (this=0x3ff7401c8e8, output=0x3ff7401c1d0, can_overwrite=false, need_tmp_table=false, need_order=false, distinct=false) at /source/sql/sql_select.cc:4671 #3 0x000002aa1928cfc4 in JOIN::build_explain (this=0x3ff7401c8e8) at /source/sql/sql_select.cc:1868 #4 0x000002aa1928d474 in JOIN::optimize (this=0x3ff7401c8e8) at /source/sql/sql_select.cc:1933 #5 0x000002aa191e2778 in st_select_lex::optimize_unflattened_subqueries (this=0x3ff74018118, const_only=true) at /source/sql/sql_lex.cc:5017 #6 0x000002aa194e62d8 in JOIN::optimize_constant_subqueries (this=0x3ff7401bc20) at /source/sql/opt_subselect.cc:5717 #7 0x000002aa1928e652 in JOIN::optimize_inner (this=0x3ff7401bc20) at /source/sql/sql_select.cc:2259 #8 0x000002aa1928d41e in JOIN::optimize (this=0x3ff7401bc20) at /source/sql/sql_select.cc:1927 #9 0x000002aa1929a892 in mysql_select (thd=0x3ff74000dc8, tables=0x3ff74018750, fields=..., conds=0x0, og_num=1, order=0x0, group=0x3ff74018f88, having=0x3ff7401b120, proc_param=0x0, select_options=2147748612, result=0x3ff7401bb58, unit=0x3ff740051b0, select_lex=0x3ff74018118) at /source/sql/sql_select.cc:5177 #10 0x000002aa192e8640 in mysql_explain_union (thd=0x3ff74000dc8, unit=0x3ff740051b0, result=0x3ff7401bb58) at /source/sql/sql_select.cc:29443 #11 0x000002aa192346ae in execute_sqlcom_select (thd=0x3ff74000dc8, all_tables=0x3ff74018750) at /source/sql/sql_parse.cc:6335 #12 0x000002aa1922af60 in mysql_execute_command (thd=0x3ff74000dc8, is_called_from_prepared_stmt=false) at /source/sql/sql_parse.cc:3988 #13 0x000002aa1923a8e2 in mysql_parse (thd=0x3ff74000dc8, rawbuf=0x3ff74017ff0 "EXPLAIN FORMAT=JSON SELECT * FROM t1\nGROUP BY b\nHAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3", length=96, parser_state=0x3ff8b67e138) at /source/sql/sql_parse.cc:8181 #14 0x000002aa19223ea4 in dispatch_command (command=COM_QUERY, thd=0x3ff74000dc8, packet=0x3ff7400baf9 "", packet_length=96, blocking=true) at /source/sql/sql_parse.cc:1897 #15 0x000002aa19222626 in do_command (thd=0x3ff74000dc8, blocking=true) at /source/sql/sql_parse.cc:1410 #16 0x000002aa1944cf70 in do_handle_one_connection (connect=0x2aa1ce72668, put_in_cache=true) at /source/sql/sql_connect.cc:1417 #17 0x000002aa1944cb90 in handle_one_connection (arg=0x2aa1ce72668) at /source/sql/sql_connect.cc:1319 #18 0x000002aa19b1e8ee in pfs_spawn_thread (arg=0x2aa1ce977b8) at /source/storage/perfschema/pfs.cc:2201 #19 0x000003ff8b396296 in ?? () from /lib/s390x-linux-gnu/libc.so.6 #20 0x000003ff8b40ff8e in ?? () from /lib/s390x-linux-gnu/libc.so.6 (gdb) p optimization_state $8 = JOIN::OPTIMIZATION_IN_PROGRESS (gdb) c Continuing.   Thread 6 "mariadbd" received signal SIGABRT, Aborted. 0x000003ff8b398116 in ?? () from /lib/s390x-linux-gnu/libc.so.6
            danblack Daniel Black added a comment -

            s390x Item_subselect

            JOIN::is_in_subquery (this=0x3ff9c01c8e8) at /source/sql/sql_select.h:1803
            1803	    return (unit->item && unit->item->is_in_predicate());
            (gdb) p unit->item
            $15 = (Item_subselect *) 0x3ff9c01a6c0
            (gdb) p  unit->item->is_in_predicate()
            $16 = false
            (gdb) p *unit->item
            $17 = {<Item_result_field> = {<Item_fixed_hybrid> = {<Item> = {<Value_source> = {<No data fields>}, <Type_all_attributes> = {<Type_std_attributes> = {<Type_numeric_attributes> = {max_length = 11, decimals = 0, unsigned_flag = false}, collation = {
                          collation = 0x2aa03b64070 <my_charset_latin1>, derivation = DERIVATION_NUMERIC, repertoire = MY_REPERTOIRE_ASCII}}, 
                      _vptr.Type_all_attributes = 0x2aa039f6500 <vtable for Item_singlerow_subselect+16>}, next = 0x3ff9c0195d0, str_value = {<Charset> = {
                        m_charset = 0x2aa03ac11e0 <my_charset_bin>}, <Binary_string> = {<Sql_alloc> = {<No data fields>}, Ptr = 0x0, str_length = 0, 
                        Alloced_length = 0, extra_alloc = 0, alloced = false, thread_specific = false}, <No data fields>}, name = {str = 0x0, length = 0}, 
                    orig_name = 0x0, base_flags = (item_base_t::MAYBE_NULL | item_base_t::FIXED), with_flags = item_with_t::SUBQUERY, marker = 0, 
                    null_value = true, is_expensive_cache = -1 '\377', join_tab_idx = 61 '='}, <No data fields>}, 
                result_field = 0x0}, <Used_tables_and_const_cache> = {used_tables_cache = 0, const_item_cache = true}, value_assigned = false, own_engine = false, 
              thd = 0x3ff9c000dc8, old_engine = 0x0, max_columns = 1, parsing_place = IN_HAVING, have_to_be_excluded = false, 
              inside_first_fix_fields = false, done_first_fix_fields = false, expr_cache = 0x0, forced_const = false, expensive_fl = false, exec_counter = 0, 
              substitution = 0x0, engine = 0x3ff9c01a848, unit = 0x3ff9c019ea0, filesort_buffer = {m_next_rec_ptr = 0x0, m_rawmem = 0x0, 
                m_record_pointers = 0x0, m_sort_keys = 0x0, m_num_records = 0, m_record_length = 0, m_sort_length = 0, m_size_in_bytes = 0, m_idx = 0}, 
              sortbuffer = {str = 0x0, length = 11936128518282651045}, upper_refs = {<base_list> = {<Sql_alloc> = {<No data fields>}, 
                  first = 0x2aa03c81a38 <end_of_list>, last = 0x3ff9c01a7d8, elements = 0}, <No data fields>}, parent_select = 0x3ff9c018118, 
              eliminated = false, changed = true, is_correlated = false, with_recursive_reference = false, next_with_rec_ref = 0xa5a5a5a5a5a5a5a5}
            (gdb) bt
            #0  JOIN::is_in_subquery (this=0x3ff9c01c8e8) at /source/sql/sql_select.h:1803
            #1  0x000002aa01c8d234 in JOIN::build_explain (this=0x3ff9c01c8e8) at /source/sql/sql_select.cc:1894
            #2  0x000002aa01c8d474 in JOIN::optimize (this=0x3ff9c01c8e8) at /source/sql/sql_select.cc:1933
            #3  0x000002aa01be2778 in st_select_lex::optimize_unflattened_subqueries (this=0x3ff9c018118, const_only=true) at /source/sql/sql_lex.cc:5017
            #4  0x000002aa01ee62d8 in JOIN::optimize_constant_subqueries (this=0x3ff9c01bc20) at /source/sql/opt_subselect.cc:5717
            #5  0x000002aa01c8e652 in JOIN::optimize_inner (this=0x3ff9c01bc20) at /source/sql/sql_select.cc:2259
            #6  0x000002aa01c8d41e in JOIN::optimize (this=0x3ff9c01bc20) at /source/sql/sql_select.cc:1927
            #7  0x000002aa01c9a892 in mysql_select (thd=0x3ff9c000dc8, tables=0x3ff9c018750, fields=..., conds=0x0, og_num=1, order=0x0, group=0x3ff9c018f88, 
                having=0x3ff9c01b120, proc_param=0x0, select_options=2147748612, result=0x3ff9c01bb58, unit=0x3ff9c0051b0, select_lex=0x3ff9c018118)
                at /source/sql/sql_select.cc:5177
            #8  0x000002aa01ce8640 in mysql_explain_union (thd=0x3ff9c000dc8, unit=0x3ff9c0051b0, result=0x3ff9c01bb58) at /source/sql/sql_select.cc:29443
            #9  0x000002aa01c346ae in execute_sqlcom_select (thd=0x3ff9c000dc8, all_tables=0x3ff9c018750) at /source/sql/sql_parse.cc:6335
            #10 0x000002aa01c2af60 in mysql_execute_command (thd=0x3ff9c000dc8, is_called_from_prepared_stmt=false) at /source/sql/sql_parse.cc:3988
            #11 0x000002aa01c3a8e2 in mysql_parse (thd=0x3ff9c000dc8, 
                rawbuf=0x3ff9c017ff0 "EXPLAIN FORMAT=JSON SELECT * FROM t1\nGROUP BY b\nHAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3", length=96, 
                parser_state=0x3ffb497e138) at /source/sql/sql_parse.cc:8181
            #12 0x000002aa01c23ea4 in dispatch_command (command=COM_QUERY, thd=0x3ff9c000dc8, packet=0x3ff9c00baf9 "", packet_length=96, blocking=true)
                at /source/sql/sql_parse.cc:1897
            #13 0x000002aa01c22626 in do_command (thd=0x3ff9c000dc8, blocking=true) at /source/sql/sql_parse.cc:1410
            #14 0x000002aa01e4cf70 in do_handle_one_connection (connect=0x2aa05f593b8, put_in_cache=true) at /source/sql/sql_connect.cc:1417
            #15 0x000002aa01e4cb90 in handle_one_connection (arg=0x2aa05f593b8) at /source/sql/sql_connect.cc:1319
            #16 0x000002aa0251e8ee in pfs_spawn_thread (arg=0x2aa05f7e508) at /source/storage/perfschema/pfs.cc:2201
            #17 0x000003ffb4696296 in ?? () from /lib/s390x-linux-gnu/libc.so.6
            #18 0x000003ffb470ff8e in ?? () from /lib/s390x-linux-gnu/libc.so.6
            

            vs x86_64:

            x86_64 Item_singlerow_subselect

            OIN::is_in_subquery (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.h:1803
            1803	    return (unit->item && unit->item->is_in_predicate());
            (rr) p unit->item
            $33 = (Item_singlerow_subselect *) 0x7f3078017e60
            (rr) p unit->item->is_in_predicate()
            $34 = false
            (rr) p *unit->item
            $35 = (Item_singlerow_subselect) {<Item_subselect> = {<Item_result_field> = {<Item_fixed_hybrid> = {<Item> = {<Value_source> = {<No data fields>}, <Type_all_attributes> = {<Type_std_attributes> = {<Type_numeric_attributes> = {max_length = 11, decimals = 0, unsigned_flag = false}, 
                          collation = {collation = 0x21eedd0 <my_charset_latin1>, derivation = DERIVATION_NUMERIC, repertoire = MY_REPERTOIRE_ASCII}}, 
                        _vptr$Type_all_attributes = 0x20aebc0 <vtable for Item_singlerow_subselect+16>}, next = 0x7f3078016d70, str_value = {<Charset> = {
                          m_charset = 0x214bf30 <my_charset_bin>}, <Binary_string> = {<Sql_alloc> = {<No data fields>}, Ptr = 0x0, str_length = 0, 
                          Alloced_length = 0, extra_alloc = 0, alloced = false, thread_specific = false}, <No data fields>}, name = {str = 0x0, length = 0}, 
                      orig_name = 0x0, base_flags = (item_base_t::MAYBE_NULL | item_base_t::FIXED), with_flags = item_with_t::SUBQUERY, marker = 0, 
                      null_value = true, is_expensive_cache = -1 '\377', join_tab_idx = 61 '='}, <No data fields>}, 
                  result_field = 0x0}, <Used_tables_and_const_cache> = {used_tables_cache = 0, const_item_cache = true}, value_assigned = false, 
                own_engine = false, thd = 0x7f3078000dc8, old_engine = 0x0, max_columns = 1, parsing_place = IN_HAVING, have_to_be_excluded = false, 
                inside_first_fix_fields = false, done_first_fix_fields = false, expr_cache = 0x0, forced_const = false, expensive_fl = false, 
                exec_counter = 0, substitution = 0x0, engine = 0x7f3078017fe8, unit = 0x7f3078017640, filesort_buffer = {m_next_rec_ptr = 0x0, 
                  m_rawmem = 0x0, m_record_pointers = 0x0, m_sort_keys = 0x0, m_num_records = 0, m_record_length = 0, m_sort_length = 0, m_size_in_bytes = 0, 
                  m_idx = 0}, sortbuffer = {str = 0x0, length = 11936128518282651045}, upper_refs = {<base_list> = {<Sql_alloc> = {<No data fields>}, 
                    first = 0x230e1a8 <end_of_list>, last = 0x7f3078017f78, elements = 0}, <No data fields>}, parent_select = 0x7f30780158b8, 
                eliminated = false, changed = true, is_correlated = false, with_recursive_reference = false, next_with_rec_ref = 0xa5a5a5a5a5a5a5a5}, 
              value = 0x7f307801a9e8, row = 0x7f3078017fa8}
            (rr) bt
            #0  JOIN::is_in_subquery (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.h:1803
            #1  0x0000000000999025 in JOIN::build_explain (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1894
            #2  0x0000000000999b10 in JOIN::optimize (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1933
            #3  0x00000000008f6e0e in st_select_lex::optimize_unflattened_subqueries (this=0x7f30780158b8, const_only=true)
                at /home/dan/repos/mariadb-server-10.6/sql/sql_lex.cc:5017
            #4  0x0000000000ba5b47 in JOIN::optimize_constant_subqueries (this=0x7f30780193c0)
                at /home/dan/repos/mariadb-server-10.6/sql/opt_subselect.cc:5717
            #5  0x000000000099d92f in JOIN::optimize_inner (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:2259
            #6  0x0000000000999ac9 in JOIN::optimize (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1927
            #7  0x0000000000990b80 in mysql_select (thd=0x7f3078000dc8, tables=0x7f3078015ef0, 
                fields=@0x7f3078015b78: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7f3078015ea0, last = 0x7f3078019d60, elements = 2}, <No data fields>}, conds=0x0, og_num=1, order=0x0, group=0x7f3078016728, having=0x7f30780188c0, proc_param=0x0, select_options=2147748612, 
                result=0x7f30780192f8, unit=0x7f30780051b0, select_lex=0x7f30780158b8) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:5177
            #8  0x00000000009e8ce1 in mysql_explain_union (thd=0x7f3078000dc8, unit=0x7f30780051b0, result=0x7f30780192f8)
                at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:29443
            #9  0x0000000000945343 in execute_sqlcom_select (thd=0x7f3078000dc8, all_tables=0x7f3078015ef0)
                at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:6335
            #10 0x0000000000938b75 in mysql_execute_command (thd=0x7f3078000dc8, is_called_from_prepared_stmt=false)
                at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:3988
            #11 0x000000000092f62a in mysql_parse (thd=0x7f3078000dc8, 
                rawbuf=0x7f3078015790 "EXPLAIN FORMAT=JSON SELECT * FROM t1\nGROUP BY b\nHAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3", length=96, 
                parser_state=0x7f3098ce6898) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:8181
            #12 0x000000000092bfed in dispatch_command (command=COM_QUERY, thd=0x7f3078000dc8, packet=0x7f307800ba29 "", packet_length=96, blocking=true)
                at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:1897
            #13 0x00000000009308c7 in do_command (thd=0x7f3078000dc8, blocking=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:1410
            #14 0x0000000000b2e106 in do_handle_one_connection (connect=0x3d464e38, put_in_cache=true)
                at /home/dan/repos/mariadb-server-10.6/sql/sql_connect.cc:1417
            #15 0x0000000000b2de5a in handle_one_connection (arg=0x3d451808) at /home/dan/repos/mariadb-server-10.6/sql/sql_connect.cc:1319
            #16 0x000000000110ee2f in pfs_spawn_thread (arg=0x3d455f68) at /home/dan/repos/mariadb-server-10.6/storage/perfschema/pfs.cc:2201
            #17 0x00007f309d4a66d7 in start_thread () from /lib64/libc.so.6
            #18 0x00007f309d52a414 in clone () from /lib64/libc.so.6
            

            danblack Daniel Black added a comment - s390x Item_subselect JOIN::is_in_subquery (this=0x3ff9c01c8e8) at /source/sql/sql_select.h:1803 1803 return (unit->item && unit->item->is_in_predicate()); (gdb) p unit->item $15 = (Item_subselect *) 0x3ff9c01a6c0 (gdb) p unit->item->is_in_predicate() $16 = false (gdb) p *unit->item $17 = {<Item_result_field> = {<Item_fixed_hybrid> = {<Item> = {<Value_source> = {<No data fields>}, <Type_all_attributes> = {<Type_std_attributes> = {<Type_numeric_attributes> = {max_length = 11, decimals = 0, unsigned_flag = false}, collation = { collation = 0x2aa03b64070 <my_charset_latin1>, derivation = DERIVATION_NUMERIC, repertoire = MY_REPERTOIRE_ASCII}}, _vptr.Type_all_attributes = 0x2aa039f6500 <vtable for Item_singlerow_subselect+16>}, next = 0x3ff9c0195d0, str_value = {<Charset> = { m_charset = 0x2aa03ac11e0 <my_charset_bin>}, <Binary_string> = {<Sql_alloc> = {<No data fields>}, Ptr = 0x0, str_length = 0, Alloced_length = 0, extra_alloc = 0, alloced = false, thread_specific = false}, <No data fields>}, name = {str = 0x0, length = 0}, orig_name = 0x0, base_flags = (item_base_t::MAYBE_NULL | item_base_t::FIXED), with_flags = item_with_t::SUBQUERY, marker = 0, null_value = true, is_expensive_cache = -1 '\377', join_tab_idx = 61 '='}, <No data fields>}, result_field = 0x0}, <Used_tables_and_const_cache> = {used_tables_cache = 0, const_item_cache = true}, value_assigned = false, own_engine = false, thd = 0x3ff9c000dc8, old_engine = 0x0, max_columns = 1, parsing_place = IN_HAVING, have_to_be_excluded = false, inside_first_fix_fields = false, done_first_fix_fields = false, expr_cache = 0x0, forced_const = false, expensive_fl = false, exec_counter = 0, substitution = 0x0, engine = 0x3ff9c01a848, unit = 0x3ff9c019ea0, filesort_buffer = {m_next_rec_ptr = 0x0, m_rawmem = 0x0, m_record_pointers = 0x0, m_sort_keys = 0x0, m_num_records = 0, m_record_length = 0, m_sort_length = 0, m_size_in_bytes = 0, m_idx = 0}, sortbuffer = {str = 0x0, length = 11936128518282651045}, upper_refs = {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x2aa03c81a38 <end_of_list>, last = 0x3ff9c01a7d8, elements = 0}, <No data fields>}, parent_select = 0x3ff9c018118, eliminated = false, changed = true, is_correlated = false, with_recursive_reference = false, next_with_rec_ref = 0xa5a5a5a5a5a5a5a5} (gdb) bt #0 JOIN::is_in_subquery (this=0x3ff9c01c8e8) at /source/sql/sql_select.h:1803 #1 0x000002aa01c8d234 in JOIN::build_explain (this=0x3ff9c01c8e8) at /source/sql/sql_select.cc:1894 #2 0x000002aa01c8d474 in JOIN::optimize (this=0x3ff9c01c8e8) at /source/sql/sql_select.cc:1933 #3 0x000002aa01be2778 in st_select_lex::optimize_unflattened_subqueries (this=0x3ff9c018118, const_only=true) at /source/sql/sql_lex.cc:5017 #4 0x000002aa01ee62d8 in JOIN::optimize_constant_subqueries (this=0x3ff9c01bc20) at /source/sql/opt_subselect.cc:5717 #5 0x000002aa01c8e652 in JOIN::optimize_inner (this=0x3ff9c01bc20) at /source/sql/sql_select.cc:2259 #6 0x000002aa01c8d41e in JOIN::optimize (this=0x3ff9c01bc20) at /source/sql/sql_select.cc:1927 #7 0x000002aa01c9a892 in mysql_select (thd=0x3ff9c000dc8, tables=0x3ff9c018750, fields=..., conds=0x0, og_num=1, order=0x0, group=0x3ff9c018f88, having=0x3ff9c01b120, proc_param=0x0, select_options=2147748612, result=0x3ff9c01bb58, unit=0x3ff9c0051b0, select_lex=0x3ff9c018118) at /source/sql/sql_select.cc:5177 #8 0x000002aa01ce8640 in mysql_explain_union (thd=0x3ff9c000dc8, unit=0x3ff9c0051b0, result=0x3ff9c01bb58) at /source/sql/sql_select.cc:29443 #9 0x000002aa01c346ae in execute_sqlcom_select (thd=0x3ff9c000dc8, all_tables=0x3ff9c018750) at /source/sql/sql_parse.cc:6335 #10 0x000002aa01c2af60 in mysql_execute_command (thd=0x3ff9c000dc8, is_called_from_prepared_stmt=false) at /source/sql/sql_parse.cc:3988 #11 0x000002aa01c3a8e2 in mysql_parse (thd=0x3ff9c000dc8, rawbuf=0x3ff9c017ff0 "EXPLAIN FORMAT=JSON SELECT * FROM t1\nGROUP BY b\nHAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3", length=96, parser_state=0x3ffb497e138) at /source/sql/sql_parse.cc:8181 #12 0x000002aa01c23ea4 in dispatch_command (command=COM_QUERY, thd=0x3ff9c000dc8, packet=0x3ff9c00baf9 "", packet_length=96, blocking=true) at /source/sql/sql_parse.cc:1897 #13 0x000002aa01c22626 in do_command (thd=0x3ff9c000dc8, blocking=true) at /source/sql/sql_parse.cc:1410 #14 0x000002aa01e4cf70 in do_handle_one_connection (connect=0x2aa05f593b8, put_in_cache=true) at /source/sql/sql_connect.cc:1417 #15 0x000002aa01e4cb90 in handle_one_connection (arg=0x2aa05f593b8) at /source/sql/sql_connect.cc:1319 #16 0x000002aa0251e8ee in pfs_spawn_thread (arg=0x2aa05f7e508) at /source/storage/perfschema/pfs.cc:2201 #17 0x000003ffb4696296 in ?? () from /lib/s390x-linux-gnu/libc.so.6 #18 0x000003ffb470ff8e in ?? () from /lib/s390x-linux-gnu/libc.so.6 vs x86_64: x86_64 Item_singlerow_subselect OIN::is_in_subquery (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.h:1803 1803 return (unit->item && unit->item->is_in_predicate()); (rr) p unit->item $33 = (Item_singlerow_subselect *) 0x7f3078017e60 (rr) p unit->item->is_in_predicate() $34 = false (rr) p *unit->item $35 = (Item_singlerow_subselect) {<Item_subselect> = {<Item_result_field> = {<Item_fixed_hybrid> = {<Item> = {<Value_source> = {<No data fields>}, <Type_all_attributes> = {<Type_std_attributes> = {<Type_numeric_attributes> = {max_length = 11, decimals = 0, unsigned_flag = false}, collation = {collation = 0x21eedd0 <my_charset_latin1>, derivation = DERIVATION_NUMERIC, repertoire = MY_REPERTOIRE_ASCII}}, _vptr$Type_all_attributes = 0x20aebc0 <vtable for Item_singlerow_subselect+16>}, next = 0x7f3078016d70, str_value = {<Charset> = { m_charset = 0x214bf30 <my_charset_bin>}, <Binary_string> = {<Sql_alloc> = {<No data fields>}, Ptr = 0x0, str_length = 0, Alloced_length = 0, extra_alloc = 0, alloced = false, thread_specific = false}, <No data fields>}, name = {str = 0x0, length = 0}, orig_name = 0x0, base_flags = (item_base_t::MAYBE_NULL | item_base_t::FIXED), with_flags = item_with_t::SUBQUERY, marker = 0, null_value = true, is_expensive_cache = -1 '\377', join_tab_idx = 61 '='}, <No data fields>}, result_field = 0x0}, <Used_tables_and_const_cache> = {used_tables_cache = 0, const_item_cache = true}, value_assigned = false, own_engine = false, thd = 0x7f3078000dc8, old_engine = 0x0, max_columns = 1, parsing_place = IN_HAVING, have_to_be_excluded = false, inside_first_fix_fields = false, done_first_fix_fields = false, expr_cache = 0x0, forced_const = false, expensive_fl = false, exec_counter = 0, substitution = 0x0, engine = 0x7f3078017fe8, unit = 0x7f3078017640, filesort_buffer = {m_next_rec_ptr = 0x0, m_rawmem = 0x0, m_record_pointers = 0x0, m_sort_keys = 0x0, m_num_records = 0, m_record_length = 0, m_sort_length = 0, m_size_in_bytes = 0, m_idx = 0}, sortbuffer = {str = 0x0, length = 11936128518282651045}, upper_refs = {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x230e1a8 <end_of_list>, last = 0x7f3078017f78, elements = 0}, <No data fields>}, parent_select = 0x7f30780158b8, eliminated = false, changed = true, is_correlated = false, with_recursive_reference = false, next_with_rec_ref = 0xa5a5a5a5a5a5a5a5}, value = 0x7f307801a9e8, row = 0x7f3078017fa8} (rr) bt #0 JOIN::is_in_subquery (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.h:1803 #1 0x0000000000999025 in JOIN::build_explain (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1894 #2 0x0000000000999b10 in JOIN::optimize (this=0x7f307801a088) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1933 #3 0x00000000008f6e0e in st_select_lex::optimize_unflattened_subqueries (this=0x7f30780158b8, const_only=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_lex.cc:5017 #4 0x0000000000ba5b47 in JOIN::optimize_constant_subqueries (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/opt_subselect.cc:5717 #5 0x000000000099d92f in JOIN::optimize_inner (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:2259 #6 0x0000000000999ac9 in JOIN::optimize (this=0x7f30780193c0) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:1927 #7 0x0000000000990b80 in mysql_select (thd=0x7f3078000dc8, tables=0x7f3078015ef0, fields=@0x7f3078015b78: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x7f3078015ea0, last = 0x7f3078019d60, elements = 2}, <No data fields>}, conds=0x0, og_num=1, order=0x0, group=0x7f3078016728, having=0x7f30780188c0, proc_param=0x0, select_options=2147748612, result=0x7f30780192f8, unit=0x7f30780051b0, select_lex=0x7f30780158b8) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:5177 #8 0x00000000009e8ce1 in mysql_explain_union (thd=0x7f3078000dc8, unit=0x7f30780051b0, result=0x7f30780192f8) at /home/dan/repos/mariadb-server-10.6/sql/sql_select.cc:29443 #9 0x0000000000945343 in execute_sqlcom_select (thd=0x7f3078000dc8, all_tables=0x7f3078015ef0) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:6335 #10 0x0000000000938b75 in mysql_execute_command (thd=0x7f3078000dc8, is_called_from_prepared_stmt=false) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:3988 #11 0x000000000092f62a in mysql_parse (thd=0x7f3078000dc8, rawbuf=0x7f3078015790 "EXPLAIN FORMAT=JSON SELECT * FROM t1\nGROUP BY b\nHAVING (SELECT MAX(b) FROM t1) = a AND a + b = 3", length=96, parser_state=0x7f3098ce6898) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:8181 #12 0x000000000092bfed in dispatch_command (command=COM_QUERY, thd=0x7f3078000dc8, packet=0x7f307800ba29 "", packet_length=96, blocking=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:1897 #13 0x00000000009308c7 in do_command (thd=0x7f3078000dc8, blocking=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_parse.cc:1410 #14 0x0000000000b2e106 in do_handle_one_connection (connect=0x3d464e38, put_in_cache=true) at /home/dan/repos/mariadb-server-10.6/sql/sql_connect.cc:1417 #15 0x0000000000b2de5a in handle_one_connection (arg=0x3d451808) at /home/dan/repos/mariadb-server-10.6/sql/sql_connect.cc:1319 #16 0x000000000110ee2f in pfs_spawn_thread (arg=0x3d455f68) at /home/dan/repos/mariadb-server-10.6/storage/perfschema/pfs.cc:2201 #17 0x00007f309d4a66d7 in start_thread () from /lib64/libc.so.6 #18 0x00007f309d52a414 in clone () from /lib64/libc.so.6
            danblack Daniel Black added a comment -

            Turns out, wrong type:

            s390x in a5e4c34991ed98357fafd6821eb756ad37ee0353 code

            (gdb) b set_extraction_flag_processor
            Breakpoint 5 at 0x2aa18b9837c: file /source/sql/item.h, line 2275.
            (gdb) c
            Continuing.
             
            Thread 6 "mariadbd" hit Breakpoint 5, Item::set_extraction_flag_processor (this=0x3ffa401a6c0, arg=0x3ffbbd7c69c) at /source/sql/item.h:2275
            2275	    set_extraction_flag(*(int16*)arg);
            (gdb) s
            Item::set_extraction_flag (this=0x3ffa401a6c0, flags=0) at /source/sql/item.h:2730
            2730	    marker &= ~MARKER_EXTRACTION_MASK;
            (gdb) up
            #1  0x000002aa18b9839a in Item::set_extraction_flag_processor (this=0x3ffa401a6c0, arg=0x3ffbbd7c69c) at /source/sql/item.h:2275
            2275	    set_extraction_flag(*(int16*)arg);
            (gdb) p *(int16*)arg
            $9 = 0
            (gdb) p *(int*)arg
            $10 = 512
            

            danblack Daniel Black added a comment - Turns out, wrong type: s390x in a5e4c34991ed98357fafd6821eb756ad37ee0353 code (gdb) b set_extraction_flag_processor Breakpoint 5 at 0x2aa18b9837c: file /source/sql/item.h, line 2275. (gdb) c Continuing.   Thread 6 "mariadbd" hit Breakpoint 5, Item::set_extraction_flag_processor (this=0x3ffa401a6c0, arg=0x3ffbbd7c69c) at /source/sql/item.h:2275 2275 set_extraction_flag(*(int16*)arg); (gdb) s Item::set_extraction_flag (this=0x3ffa401a6c0, flags=0) at /source/sql/item.h:2730 2730 marker &= ~MARKER_EXTRACTION_MASK; (gdb) up #1 0x000002aa18b9839a in Item::set_extraction_flag_processor (this=0x3ffa401a6c0, arg=0x3ffbbd7c69c) at /source/sql/item.h:2275 2275 set_extraction_flag(*(int16*)arg); (gdb) p *(int16*)arg $9 = 0 (gdb) p *(int*)arg $10 = 512

            People

              danblack Daniel Black
              danblack Daniel Black
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.