[MDEV-29602] Galera debug build crashes when the spider plugin is enabled Created: 2022-09-22  Updated: 2023-04-05  Resolved: 2023-04-05

Status: Closed
Project: MariaDB Server
Component/s: Galera
Affects Version/s: 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
Fix Version/s: 11.1.1, 10.11.3, 10.4.29, 10.5.20, 10.6.13, 10.8.8, 10.9.6, 10.10.4

Type: Bug Priority: Critical
Reporter: Ramesh Sivaraman Assignee: Julius Goryavsky
Resolution: Fixed Votes: 0
Labels: affects-tests, debuu, not-10.3

Issue Links:
Blocks
Duplicate
is duplicated by MDEV-29420 Galera server hangs when trying to cr... Stalled

 Description   

INSTALL PLUGIN spider SONAME 'ha_spider.so';
SELECT SLEEP(3);

Leads to:

10.11.0 6ebdd3013a18b01dbecec76b870810329eb76586 (Debug)

mysqld: /test/10.11_dbg/wsrep-lib/src/client_state.cpp:433: int wsrep::client_state::enter_toi_local(const key_array&, const wsrep::const_buffer&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > >): Assertion `state_ == s_exec' failed.

10.11.0 6ebdd3013a18b01dbecec76b870810329eb76586 (Debug)

Core was generated by `/test/GAL_MD190922-mariadb-10.11.0-linux-x86_64-dbg/bin/mysqld --defaults-file='.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
[Current thread is 1 (Thread 0x1483fa239700 (LWP 1327512))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
#1  0x00005567ace8dde7 in my_write_core (sig=sig@entry=6) at /test/10.11_dbg/mysys/stacktrace.c:424
#2  0x00005567ac7472e3 in handle_fatal_signal (sig=6) at /test/10.11_dbg/sql/signal_handler.cc:355
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#5  0x0000148430205859 in __GI_abort () at abort.c:79
#6  0x0000148430205729 in __assert_fail_base (fmt=0x14843039b588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5567ad04b018 "state_ == s_exec", file=0x5567ad62df58 "/test/10.11_dbg/wsrep-lib/src/client_state.cpp", line=433, function=<optimized out>) at assert.c:92
#7  0x0000148430216fd6 in __GI___assert_fail (assertion=assertion@entry=0x5567ad04b018 "state_ == s_exec", file=file@entry=0x5567ad62df58 "/test/10.11_dbg/wsrep-lib/src/client_state.cpp", line=line@entry=433, function=function@entry=0x5567ad62e710 "int wsrep::client_state::enter_toi_local(const key_array&, const wsrep::const_buffer&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long int, std::ratio<1, 1000000000>"...) at assert.c:101
#8  0x00005567acff32c7 in wsrep::client_state::enter_toi_local (this=this@entry=0x1483bc00abb0, keys=std::vector of length 2, capacity 2 = {{type_ = wsrep::key::exclusive, key_parts_ = {{ptr_ = 0x1483bc015f88, size_ = 5}, {ptr_ = 0x1483bc015f90, size_ = 9}, {ptr_ = 0x0, size_ = 0}}, key_parts_len_ = 2}, {type_ = wsrep::key::exclusive, key_parts_ = {{ptr_ = 0x1483bc015f88, size_ = 5}, {ptr_ = 0x1483bc015f90, size_ = 9}, {ptr_ = 0x0, size_ = 0}}, key_parts_len_ = 2}}, buffer=@0x1483fa235d10: {ptr_ = 0x1483bc017f88, size_ = 676}, wait_until=wait_until@entry={__d = {__r = 0}}) at /test/10.11_dbg/wsrep-lib/src/client_state.cpp:440
#9  0x00005567aca26df5 in wsrep_TOI_begin (create_info=0x1483fa236100, fk_tables=0x0, alter_info=0x1483fa235f20, table_list=0x1483bc017f88, table=0x1483bc015f90 "spider_xa", db=0x1483bc015f88 "mysql", thd=0x1483bc0043e8) at /test/10.11_dbg/wsrep-lib/include/wsrep/buffer.hpp:36
#10 wsrep_to_isolation_begin (thd=thd@entry=0x1483bc0043e8, db_=0x1483bc015f88 "mysql", table_=0x1483bc015f90 "spider_xa", table_list=table_list@entry=0x1483bc016080, alter_info=alter_info@entry=0x1483fa235f20, fk_tables=fk_tables@entry=0x0, create_info=0x1483fa236100) at /test/10.11_dbg/sql/wsrep_mysqld.cc:2970
#11 0x00005567ac540313 in Sql_cmd_create_table_like::execute (this=<optimized out>, thd=0x1483bc0043e8) at /test/10.11_dbg/sql/sql_table.cc:12781
#12 0x00005567ac465e2b in mysql_execute_command (thd=thd@entry=0x1483bc0043e8, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.11_dbg/sql/sql_parse.cc:5997
#13 0x00005567ac44df21 in mysql_parse (thd=thd@entry=0x1483bc0043e8, rawbuf=rawbuf@entry=0x1483bc015bb0 "create table if not exists mysql.spider_xa(  format_id int not null default 0,  gtrid_length int not null default 0,  bqual_length int not null default 0,  data char(128) charset binary not null defau"..., length=length@entry=361, parser_state=parser_state@entry=0x1483fa2383f0) at /test/10.11_dbg/sql/sql_parse.cc:8037
#14 0x00005567ac44d909 in wsrep_mysql_parse (thd=thd@entry=0x1483bc0043e8, rawbuf=0x1483bc015bb0 "create table if not exists mysql.spider_xa(  format_id int not null default 0,  gtrid_length int not null default 0,  bqual_length int not null default 0,  data char(128) charset binary not null defau"..., length=361, parser_state=parser_state@entry=0x1483fa2383f0) at /test/10.11_dbg/sql/sql_parse.cc:7850
#15 0x00005567ac45b63b in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x1483bc0043e8, packet=0x1483e41c43d8 "create table if not exists mysql.spider_xa(  format_id int not null default 0,  gtrid_length int not null default 0,  bqual_length int not null default 0,  data char(128) charset binary not null defau"..., packet_length=<optimized out>, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_class.h:1345
#16 0x00001483e4136347 in spider_table_bg_sts_action (arg=0x1483b80515c8) at /test/10.11_dbg/storage/spider/spd_table.cc:9099
#17 0x0000148430716609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#18 0x0000148430302133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.4.26 (dbg), 10.5.17 (dbg), 10.6.9 (dbg), 10.7.5 (dbg), 10.8.4 (dbg), 10.9.2 (dbg), 10.10.2 (dbg), 10.11.0 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.4.26 (opt), 10.5.17 (opt), 10.6.9 (opt), 10.7.5 (opt), 10.8.4 (opt), 10.9.2 (opt), 10.10.2 (opt), 10.11.0 (opt)



 Comments   
Comment by Jan Lindström (Inactive) [ 2022-10-11 ]

https://github.com/MariaDB/server/commit/d6db7071f6dc81a09d53ba1f0053afa499b83e9a

I could not add mtr testcase because even with UNINSTALL PLUGIN spider; Spider leaves lot of system tables and mtr complains about them.

Comment by Nayuta Yanagisawa (Inactive) [ 2022-10-24 ]

jplindst The fix itself looks good to me. I'd recommend using test_init.inc and test_deinit.inc in MTR for the ease of cleanup.

You can check https://github.com/MariaDB/server/blob/10.11/storage/spider/mysql-test/spider/bugfix/t/mdev_29008.test as a reference.

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