[MDEV-29686] Assertion `slave == 0' failed in st_select_lex_node::attach_single Created: 2022-10-03  Updated: 2022-10-03  Resolved: 2022-10-03

Status: Closed
Project: MariaDB Server
Component/s: Parser
Affects Version/s: 10.5, 10.6
Fix Version/s: 10.5.18, 10.6.11

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Oleksandr Byelkin
Resolution: Duplicate Votes: 0
Labels: regression

Issue Links:
Duplicate
duplicates MDEV-28740 crash in INSERT RETURNING subquery in... Closed

 Description   

CREATE TABLE t (a INT);
INSERT t WITH cte AS (SELECT 1) SELECT * FROM cte RETURNING *;
 
# Cleanup
DROP TABLE t;

10.5 3a211624

mariadbd: /data/src/10.5/sql/sql_lex.cc:3049: void st_select_lex_node::attach_single(st_select_lex_node*): Assertion `slave == 0' failed.
221003 13:11:11 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f8a461fe662 in __GI___assert_fail (assertion=0x5574478aac80 "slave == 0", file=0x55744789d5a0 "/data/src/10.5/sql/sql_lex.cc", line=3049, function=0x5574478aacc0 "void st_select_lex_node::attach_single(st_select_lex_node*)") at assert.c:101
#8  0x00005574458a54d9 in st_select_lex_node::attach_single (this=0x62b000086a40, slave_arg=0x62b000088018) at /data/src/10.5/sql/sql_lex.cc:3049
#9  0x0000557445fc3792 in MYSQLparse (thd=0x62b00007e218) at /data/src/10.5/sql/sql_yacc.yy:13367
#10 0x000055744594eb72 in parse_sql (thd=0x62b00007e218, parser_state=0x7f8a25a4ec30, creation_ctx=0x0, do_pfs_digest=true) at /data/src/10.5/sql/sql_parse.cc:10472
#11 0x000055744593fada in mysql_parse (thd=0x62b00007e218, rawbuf=0x62b000085238 "INSERT t WITH cte AS (SELECT 1) SELECT * FROM cte RETURNING *", length=61, parser_state=0x7f8a25a4ec30, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:8039
#12 0x0000557445916612 in dispatch_command (command=COM_QUERY, thd=0x62b00007e218, packet=0x629000267219 "INSERT t WITH cte AS (SELECT 1) SELECT * FROM cte RETURNING *", packet_length=61, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1891
#13 0x000055744591302f in do_command (thd=0x62b00007e218) at /data/src/10.5/sql/sql_parse.cc:1375
#14 0x0000557445d4e3f3 in do_handle_one_connection (connect=0x608000002538, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1416
#15 0x0000557445d4dd90 in handle_one_connection (arg=0x6080000024b8) at /data/src/10.5/sql/sql_connect.cc:1318
#16 0x0000557446972d5c in pfs_spawn_thread (arg=0x61500000c618) at /data/src/10.5/storage/perfschema/pfs.cc:2201
#17 0x00007f8a466dcea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
#18 0x00007f8a462c9aef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

The failure started happening on 10.5 branch after this merge

commit 3a2116241b128b811ee2455845ff9710da3115ac (HEAD -> 10.5, origin/bb-10.5-serg, origin/10.5)
Merge: e29fb956145 d4f6d2f08f2
Author: Sergei Golubchik
Date:   Sun Oct 2 14:38:13 2022 +0200
 
    Merge branch '10.4' into 10.5

but since the test case is not applicable to earlier versions due to the use of INSERT .. RETURNING, I can't bisect inside the merge. There are a couple commits in there which look to me as they could be related.


Generated at Thu Feb 08 10:10:31 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.