[MDEV-29706] SIGSEGV in wsrep_TOI_begin on non-Galera builds Created: 2022-10-05  Updated: 2022-10-11  Resolved: 2022-10-11

Status: Closed
Project: MariaDB Server
Component/s: Galera
Affects Version/s: 10.3
Fix Version/s: 10.3.37

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Jan Lindström (Inactive)
Resolution: Fixed Votes: 0
Labels: wsrep


 Description   

SET GLOBAL wsrep_on=ON;
CREATE TABLE t (c INT) ENGINE=InnoDB;

Leads to:

10.3.37 32bab2ce0518d829b4f97a272fc2431169744c75 (Optimized)

Core was generated by `/test/MD190922-mariadb-10.3.37-linux-x86_64-opt/bin/mysqld --no-defaults --core'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00005568f329ddce in wsrep_TOI_begin (alter_info=<optimized out>, 
    table_list=0x0, table_=<optimized out>, db_=<optimized out>, thd=
    0x14d974000c48) at /test/10.3_opt/sql/wsrep_mysqld.cc:1237
[Current thread is 1 (Thread 0x14d9cc073700 (LWP 2304835))]
(gdb) bt
#0  0x00005568f329ddce in wsrep_TOI_begin (alter_info=<optimized out>, table_list=0x0, table_=<optimized out>, db_=<optimized out>, thd=0x14d974000c48) at /test/10.3_opt/sql/wsrep_mysqld.cc:1237
#1  wsrep_to_isolation_begin (alter_info=0x0, table_list=0x0, table_=<optimized out>, db_=<optimized out>, thd=0x14d974000c48) at /test/10.3_opt/sql/wsrep_mysqld.cc:1916
#2  wsrep_to_isolation_begin (thd=thd@entry=0x14d974000c48, db_=<optimized out>, table_=<optimized out>, table_list=table_list@entry=0x0, alter_info=alter_info@entry=0x0) at /test/10.3_opt/sql/wsrep_mysqld.cc:1860
#3  0x00005568f31d96ce in Sql_cmd_create_table_like::execute (this=<optimized out>, thd=0x14d974000c48) at /test/10.3_opt/sql/handler.h:2037
#4  0x00005568f31412e0 in mysql_execute_command (thd=<optimized out>) at /test/10.3_opt/sql/sql_parse.cc:6076
#5  0x00005568f3148162 in mysql_parse (thd=thd@entry=0x14d974000c48, rawbuf=rawbuf@entry=0x14d97400f4d0 "CREATE TABLE t (c INT) ENGINE=InnoDB", length=length@entry=36, parser_state=parser_state@entry=0x14d9cc0725d0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.3_opt/sql/sql_parse.cc:7871
#6  0x00005568f31489f6 in wsrep_mysql_parse (thd=0x14d974000c48, rawbuf=0x14d97400f4d0 "CREATE TABLE t (c INT) ENGINE=InnoDB", length=36, parser_state=0x14d9cc0725d0, is_com_multi=false, is_next_command=false) at /test/10.3_opt/sql/sql_parse.cc:7663
#7  0x00005568f314a203 in dispatch_command (command=COM_QUERY, thd=0x14d974000c48, packet=<optimized out>, packet_length=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /test/10.3_opt/sql/sql_parse.cc:1938
#8  0x00005568f314b8fd in do_command (thd=0x14d974000c48) at /test/10.3_opt/sql/sql_parse.cc:1398
#9  0x00005568f3229a9e in do_handle_one_connection (connect=<optimized out>) at /test/10.3_opt/sql/sql_connect.cc:1403
#10 0x00005568f3229b1d in handle_one_connection (arg=<optimized out>) at /test/10.3_opt/sql/sql_connect.cc:1308
#11 0x000014d9d8035609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#12 0x000014d9d7f5a133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

10.3.37 32bab2ce0518d829b4f97a272fc2431169744c75 (Debug)

Core was generated by `/test/MD190922-mariadb-10.3.37-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000055eb029ae1ed in wsrep_TOI_begin (alter_info=0x0, table_list=0x0, 
    table_=0x14cb04010a18 "t", db_=0x14cb040110c8 "test", thd=0x14cb04000d28)
    at /test/10.3_dbg/sql/wsrep_mysqld.cc:1708
[Current thread is 1 (Thread 0x14cb500ec700 (LWP 2305563))]
(gdb) bt
#0  0x000055eb029ae1ed in wsrep_TOI_begin (alter_info=0x0, table_list=0x0, table_=0x14cb04010a18 "t", db_=0x14cb040110c8 "test", thd=0x14cb04000d28) at /test/10.3_dbg/sql/wsrep_mysqld.cc:1708
#1  wsrep_to_isolation_begin (thd=thd@entry=0x14cb04000d28, db_=0x14cb040110c8 "test", table_=0x14cb04010a18 "t", table_list=table_list@entry=0x0, alter_info=alter_info@entry=0x0) at /test/10.3_dbg/sql/wsrep_mysqld.cc:1916
#2  0x000055eb028b39b9 in Sql_cmd_create_table_like::execute (this=0x14cb04010a48, thd=0x14cb04000d28) at /test/10.3_dbg/sql/sql_table.cc:11441
#3  0x000055eb0280b1f6 in mysql_execute_command (thd=thd@entry=0x14cb04000d28) at /test/10.3_dbg/sql/sql_parse.cc:6076
#4  0x000055eb0280cb1b in mysql_parse (thd=thd@entry=0x14cb04000d28, rawbuf=rawbuf@entry=0x14cb04010960 "CREATE TABLE t (c INT) ENGINE=InnoDB", length=length@entry=36, parser_state=parser_state@entry=0x14cb500eb5e0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.3_dbg/sql/sql_parse.cc:7871
#5  0x000055eb0280dc04 in wsrep_mysql_parse (thd=thd@entry=0x14cb04000d28, rawbuf=0x14cb04010960 "CREATE TABLE t (c INT) ENGINE=InnoDB", length=36, parser_state=parser_state@entry=0x14cb500eb5e0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.3_dbg/sql/sql_parse.cc:7663
#6  0x000055eb0280ebd4 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14cb04000d28, packet=packet@entry=0x14cb04018aa9 "CREATE TABLE t (c INT) ENGINE=InnoDB", packet_length=packet_length@entry=36, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.3_dbg/sql/sql_class.h:1152
#7  0x000055eb0281102b in do_command (thd=0x14cb04000d28) at /test/10.3_dbg/sql/sql_parse.cc:1398
#8  0x000055eb0291b17f in do_handle_one_connection (connect=<optimized out>) at /test/10.3_dbg/sql/sql_connect.cc:1403
#9  0x000055eb0291b2af in handle_one_connection (arg=<optimized out>) at /test/10.3_dbg/sql/sql_connect.cc:1308
#10 0x000014cb65962609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#11 0x000014cb65887133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.3.37 (dbg), 10.3.37 (opt)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.4.27 (dbg), 10.4.27 (opt), 10.5.18 (dbg), 10.5.18 (opt), 10.6.10 (dbg), 10.6.10 (opt), 10.7.6 (dbg), 10.7.6 (opt), 10.8.5 (dbg), 10.8.5 (opt), 10.9.3 (dbg), 10.9.3 (opt), 10.10.2 (dbg), 10.10.2 (opt), 10.11.0 (dbg), 10.11.0 (opt)

$ cat BUILD_CMD_CMAKE  # optimized
cmake . -DWITH_SSL=bundled -DBUILD_CONFIG=mysql_release -DWITH_JEMALLOC=no -DWITH_TOKUDB=0 -DFEATURE_SET=community -DDEBUG_EXTNAME=OFF -DWITH_EMBEDDED_SERVER=0 -DENABLE_DOWNLOADS=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/tmp/boost_405270 -DENABLED_LOCAL_INFILE=1 -DENABLE_DTRACE=0 -DWITH_SAFEMALLOC=OFF -DPLUGIN_PERFSCHEMA=NO -DWITH_DBUG_TRACE=OFF -DWITH_ZLIB=bundled -DWITH_ROCKSDB=1 -DWITH_PAM=ON -DWITH_MARIABACKUP=0 -DFORCE_INSOURCE_BUILD=1 -DCMAKE_C_FLAGS='-Og -march=native -mtune=native' -DCMAKE_CXX_FLAGS='-Og -march=native -mtune=native'
$ cat BUILD_CMD_CMAKE  # debug
cmake . -DWITH_SSL=bundled -DCMAKE_BUILD_TYPE=Debug -DBUILD_CONFIG=mysql_release -DWITH_TOKUDB=0 -DWITH_JEMALLOC=no -DFEATURE_SET=community -DDEBUG_EXTNAME=OFF -DWITH_EMBEDDED_SERVER=0 -DENABLE_DOWNLOADS=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/tmp/boost_834136 -DENABLED_LOCAL_INFILE=1 -DENABLE_DTRACE=0 -DWITH_SAFEMALLOC=OFF -DPLUGIN_PERFSCHEMA=NO -DWITH_DBUG_TRACE=OFF -DWITH_ZLIB=bundled -DWITH_ROCKSDB=1 -DWITH_PAM=ON -DWITH_MARIABACKUP=0 -DFORCE_INSOURCE_BUILD=1 -DCMAKE_C_FLAGS='-Og -march=native -mtune=native' -DCMAKE_CXX_FLAGS='-Og -march=native -mtune=native' -DMYSQL_MAINTAINER_MODE=OFF



 Comments   
Comment by Roel Van de Paar [ 2022-10-05 ]

UniqueID's seen

SIGSEGV|wsrep_TOI_begin|wsrep_to_isolation_begin|Sql_cmd_create_table_like::execute|mysql_execute_command
SIGSEGV|wsrep_TOI_begin|wsrep_to_isolation_begin|wsrep_to_isolation_begin|Sql_cmd_create_table_like::execute

Comment by Roel Van de Paar [ 2022-10-05 ]

10.4+ Produces this output:

10.11.0 6ebdd3013a18b01dbecec76b870810329eb76586 (Debug)

10.11.0-dbg>SET GLOBAL wsrep_on=ON;
ERROR 1210 (HY000): WSREP (galera) can't be enabled if the wsrep_provider is unset or set to 'none'

So the bug may still be present, but masked.

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