Bug #113007 Show parse tree assertion error
Submitted: 8 Nov 2023 11:31 Modified: 15 Nov 2023 11:44
Reporter: Pedro Ferreira Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S6 (Debug Builds)
Version:8.2.0 OS:Ubuntu (22.04)
Assigned to: CPU Architecture:x86 (x86_64)

[8 Nov 2023 11:31] Pedro Ferreira
Description:
First, set the max allowed packet value:
SET GLOBAL MAX_ALLOWED_PACKET = 8192;

Then start another connection and do the following:

SHOW PARSE_TREE WITH RECURSIVE x(x) AS ((SELECT 1, 1 FROM x) UNION (SELECT 1, 1 FROM t0)) SELECT 1 FROM t0 JOIN x GROUP BY x.x, t0.c0;

An assertion error at sql/sql_parse.cc:7311 will trigger:

assert(!mysql_parse_status || (mysql_parse_status && thd->is_error()) ||
       (mysql_parse_status && thd->get_internal_handler()));

The compilation parameters are the same as issue 108148:

-DWITH_DEBUG=1 -DWITH_ASAN=ON -DWITH_UBSAN=ON and boost library version 1.77

This is the server configuration file:

[mysqld]
server_id=1
skip-log-bin
character_set_server=utf8mb4
collation_server=utf8mb4_0900_bin
slow_query_log=ON
long_query_time=5
gtid_mode=ON
enforce_gtid_consistency=ON
log_bin=ON
innodb_extend_and_initialize=ON
secure-file-priv=""

How to repeat:
Run the statements above.
[15 Nov 2023 11:44] MySQL Verification Team
Hello Pedro Ferreira,

Thank you for the report and feedback.
Verified as described.

regards,
Umesh
[15 Nov 2023 11:48] MySQL Verification Team
-
(gdb) bt
#0  0x00007fb646173aa1 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000057df9cf in my_write_core (sig=sig@entry=6) at /export/home/tmp/ushastry/src/mysql-8.2.0/mysys/stacktrace.cc:295
#2  0x00000000034c495f in handle_fatal_signal (sig=6) at /export/home/tmp/ushastry/src/mysql-8.2.0/sql/signal_handler.cc:230
#3  <signal handler called>
#4  0x00007fb6446c0387 in raise () from /lib64/libc.so.6
#5  0x00007fb6446c1a78 in abort () from /lib64/libc.so.6
#6  0x00007fb6446b91a6 in __assert_fail_base () from /lib64/libc.so.6
#7  0x00007fb6446b9252 in __assert_fail () from /lib64/libc.so.6
#8  0x00000000030d5248 in parse_sql (thd=thd@entry=0x627000432900, parser_state=parser_state@entry=0x7fb60feb3ca0, creation_ctx=creation_ctx@entry=0x0) at /export/home/tmp/ushastry/src/mysql-8.2.0/sql/sql_parse.cc:7335
#9  0x00000000030e822b in dispatch_sql_command (thd=0x627000432900, parser_state=parser_state@entry=0x7fb60feb3ca0) at /export/home/tmp/ushastry/src/mysql-8.2.0/sql/sql_parse.cc:5376
#10 0x00000000030eb720 in dispatch_command (thd=thd@entry=0x627000432900, com_data=com_data@entry=0x7fb60feb51e0, command=COM_QUERY) at /export/home/tmp/ushastry/src/mysql-8.2.0/sql/sql_parse.cc:2136
#11 0x00000000030eef63 in do_command (thd=thd@entry=0x627000432900) at /export/home/tmp/ushastry/src/mysql-8.2.0/sql/sql_parse.cc:1465
#12 0x00000000034a27ec in handle_connection (arg=arg@entry=0x603000304150) at /export/home/tmp/ushastry/src/mysql-8.2.0/sql/conn_handler/connection_handler_per_thread.cc:303
#13 0x00000000066ff355 in pfs_spawn_thread (arg=0x6140001f6c60) at /export/home/tmp/ushastry/src/mysql-8.2.0/storage/perfschema/pfs.cc:3049
#14 0x00007fb64616eea5 in start_thread () from /lib64/libpthread.so.0
#15 0x00007fb644788b2d in clone () from /lib64/libc.so.6