[MDEV-23011] SIGSEGV in row_create_prebuilt on DELETE (on optimized builds) Created: 2020-06-25  Updated: 2023-09-02  Resolved: 2023-09-02

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB, Virtual Columns
Affects Version/s: 10.2, 10.3, 10.4, 10.5
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: not-10.1

Issue Links:
Relates
relates to MDEV-24971 SEGV in in row_create_prebuilt Closed

 Description   

USE test;
CREATE TABLE t (a TEXT, FULLTEXT KEY(a)) ENGINE=InnoDB;
INSERT INTO t VALUES ('a');
ALTER TABLE t ADD COLUMN (h INT GENERATED ALWAYS AS (a+1) VIRTUAL), ADD INDEX idx (h), ALGORITHM=INPLACE;
DELETE FROM a2,a3 USING t AS a1 JOIN t AS a2 INNER JOIN t AS a3;

Leads to:

10.5.4 4080e3acefd7e58d88c2f3539fb6a0fb359cf057

Core was generated by `/test/MD150620-mariadb-10.5.4-linux-x86_64-opt/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
[Current thread is 1 (Thread 0x14793e739700 (LWP 923673))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x0000556f5d0730b7 in my_write_core (sig=sig@entry=11) at /test/10.5_opt/mysys/stacktrace.c:518
#2  0x0000556f5ca3ce4a in handle_fatal_signal (sig=11) at /test/10.5_opt/sql/signal_handler.cc:330
#3  <signal handler called>
#4  row_create_prebuilt (table=table@entry=0x14791a889300, mysql_row_len=11) at /test/10.5_opt/storage/innobase/row/row0mysql.cc:890
#5  0x0000556f5cd67854 in ha_innobase::open (this=0x14791a872030, name=0x14791a8219c8 "./test/t") at /test/10.5_opt/storage/innobase/handler/ha_innodb.cc:5882
#6  0x0000556f5ca4171a in handler::ha_open (this=0x14791a872030, table_arg=table_arg@entry=0x14791a95b618, name=0x14791a8219c8 "./test/t", mode=2, test_if_locked=test_if_locked@entry=18, mem_root=mem_root@entry=0x0, partitions_to_open=0x0) at /test/10.5_opt/sql/handler.cc:2954
#7  0x0000556f5c906af0 in open_table_from_share (thd=thd@entry=0x14791a812018, share=share@entry=0x14791a821530, alias=alias@entry=0x14791a8486f0, db_stat=db_stat@entry=33, prgflag=<optimized out>, prgflag@entry=8, ha_open_flags=18, outparam=<optimized out>, is_create_table=<optimized out>, partitions_to_open=<optimized out>) at /test/10.5_opt/sql/table.cc:4186
#8  0x0000556f5c7e2796 in open_table (thd=thd@entry=0x14791a812018, table_list=table_list@entry=0x14791a8486a8, ot_ctx=ot_ctx@entry=0x14793e737c00) at /test/10.5_opt/sql/sql_base.cc:1984
#9  0x0000556f5c7e57e3 in open_and_process_table (ot_ctx=0x14793e737c00, has_prelocking_list=false, prelocking_strategy=0x14793e737f68, flags=0, counter=0x14793e737e6c, tables=0x14791a8486a8, thd=0x14791a812018) at /test/10.5_opt/sql/sql_base.cc:3783
#10 open_tables (thd=thd@entry=0x14791a812018, options=@0x14791a817330: {m_options = DDL_options_st::OPT_NONE}, start=start@entry=0x14793e737e58, counter=counter@entry=0x14793e737e6c, flags=flags@entry=0, prelocking_strategy=prelocking_strategy@entry=0x14793e737f68) at /test/10.5_opt/sql/sql_base.cc:4255
#11 0x0000556f5c7e63e5 in open_and_lock_tables (thd=thd@entry=0x14791a812018, options=<optimized out>, tables=<optimized out>, derived=derived@entry=true, flags=flags@entry=0, prelocking_strategy=prelocking_strategy@entry=0x14793e737f68) at /test/10.5_opt/sql/sql_base.cc:5159
#12 0x0000556f5c846404 in open_and_lock_tables (flags=0, derived=true, tables=<optimized out>, thd=0x14791a812018) at /test/10.5_opt/sql/sql_base.h:509
#13 mysql_execute_command (thd=thd@entry=0x14791a812018) at /test/10.5_opt/sql/sql_parse.cc:4826
#14 0x0000556f5c84c85c in mysql_parse (thd=0x14791a812018, rawbuf=<optimized out>, length=63, parser_state=0x14793e738430, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /test/10.5_opt/sql/sql_parse.cc:7993
#15 0x0000556f5c841b65 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14791a812018, packet=packet@entry=0x14791a83a019 "DELETE FROM a2,a3 USING t AS a1 JOIN t AS a2 INNER JOIN t AS a3", packet_length=packet_length@entry=63, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_opt/sql/sql_parse.cc:1874
#16 0x0000556f5c83ff74 in do_command (thd=0x14791a812018) at /test/10.5_opt/sql/sql_parse.cc:1355
#17 0x0000556f5c935b51 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x14793b433958, put_in_cache=put_in_cache@entry=true) at /test/10.5_opt/sql/sql_connect.cc:1411
#18 0x0000556f5c935eb4 in handle_one_connection (arg=arg@entry=0x14793b433958) at /test/10.5_opt/sql/sql_connect.cc:1313
#19 0x0000556f5cca4bca in pfs_spawn_thread (arg=0x14793b44f218) at /test/10.5_opt/storage/perfschema/pfs.cc:2201
#20 0x000014793d6b26db in start_thread (arg=0x14793e739700) at pthread_create.c:463
#21 0x000014793cab088f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.2.33 (dbg), 10.2.33 (opt), 10.3.24 (dbg), 10.3.24 (opt), 10.4.14 (dbg), 10.4.14 (opt), 10.5.4 (dbg), 10.5.4 (opt)

Bug confirmed not present in:
MariaDB: 10.1.46 (dbg), 10.1.46 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)



 Comments   
Comment by Alice Sherepa [ 2021-03-17 ]

mtr:

--source include/have_innodb.inc
CREATE TABLE t (a TEXT, FULLTEXT KEY(a)) ENGINE=InnoDB;
INSERT INTO t VALUES ('a');
--error 1292
ALTER TABLE t ADD COLUMN (h INT GENERATED ALWAYS AS (a+1) VIRTUAL), ADD INDEX idx (h), ALGORITHM=INPLACE;
DELETE FROM a2,a3 USING t AS a1 JOIN t AS a2 INNER JOIN t AS a3;

Comment by Roel Van de Paar [ 2023-09-02 ]

No longer reproduces. Tested 10.4-11.3 (dbg+opt). Closing.

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