[MDEV-25564] Server crashed on running some EXPLAIN statements Created: 2021-04-29  Updated: 2022-10-23  Resolved: 2022-10-23

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6
Fix Version/s: 10.3.37, 10.4.27, 10.5.18, 10.6.11, 10.7.7, 10.8.6, 10.9.4, 10.10.2, 10.11.1

Type: Bug Priority: Critical
Reporter: Dmitry Shulga Assignee: Sergei Petrunia
Resolution: Duplicate Votes: 1
Labels: None

Issue Links:
Relates
relates to MDEV-23160 SIGSEGV in Explain_node::print_explai... Closed

 Description   

Executing of the statement

EXPLAIN (SELECT 1,3) UNION (SELECT 2,1) ORDER BY (SELECT 2);

results in server crash.

Stack trace to the crash point is below

  * frame #0: 0x000000010b5abf12 mysqld`Explain_node::print_explain_for_children(this=0x00007fc48f130a10, query=0x00007fc48f130680, output=0x00007fc48f12ee88, explain_flags='\x01', is_analyze=false) at sql_explain.cc:615:15
    frame #1: 0x000000010b5abc4f mysqld`Explain_union::print_explain(this=0x00007fc48f130a10, query=0x00007fc48f130680, output=0x00007fc48f12ee88, explain_flags='\x01', is_analyze=false) at sql_explain.cc:540:10
    frame #2: 0x000000010b5aaeb6 mysqld`Explain_query::print_explain(this=0x00007fc48f130680, output=0x00007fc48f12ee88, explain_flags='\x01', is_analyze=false) at sql_explain.cc:203:18
    frame #3: 0x000000010b392ffc mysqld`execute_sqlcom_select(thd=0x00007fc47e846a70, all_tables=0x0000000000000000) at sql_parse.cc:6229:25
    frame #4: 0x000000010b385f1d mysqld`mysql_execute_command(thd=0x00007fc47e846a70) at sql_parse.cc:3585:12
    frame #5: 0x000000010b3810f3 mysqld`mysql_parse(thd=0x00007fc47e846a70, rawbuf="EXPLAIN (SELECT 1,3) UNION (SELECT 2,1) ORDER BY (SELECT 2)", length=59, parser_state=0x000070000ae38fb0, is_com_multi=false, is_next_command=false) at sql_parse.cc:7796:18
    frame #6: 0x000000010b37b42b mysqld`dispatch_command(command=COM_QUERY, thd=0x00007fc47e846a70, packet="", packet_length=59, is_com_multi=false, is_next_command=false) at sql_parse.cc:1827:7



 Comments   
Comment by Elena Stepanova [ 2021-04-29 ]

There is a similar bug report in review, MDEV-23160.

Comment by Oleksandr Byelkin [ 2021-09-20 ]

commit fc1fcf5e27c40f009707d38fae0c1ba4916a9fc4 (HEAD -> bb-10.2-MDEV-25564, origin/bb-10.2-MDEV-25564)
Author: Oleksandr Byelkin <sanja@mariadb.com>
Date:   Mon Sep 20 19:55:57 2021 +0200
 
    MDEV-25564 Server crashed on running some EXPLAIN statements
    
    Exclude from explain substituted single value subquery without tables.

Comment by Sergei Petrunia [ 2022-10-23 ]

Fixed by fix for MDEV-23160.

Generated at Thu Feb 08 09:38:39 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.