[MDEV-25810] Assertion `!thd || thd->locked_tables_mode || !thd->mdl_context.has_locks() || thd->handler_tables_hash.records || thd->ull_hash.records || thd->global_read_lock.is_acquired() || thd->mdl_backup_lock || thd->current_backup_stage != BACKUP_FINISHED' failed Created: 2021-05-28  Updated: 2022-01-13  Resolved: 2022-01-13

Status: Closed
Project: MariaDB Server
Component/s: Galera
Affects Version/s: 10.5, 10.6
Fix Version/s: 10.5.13, 10.6.5

Type: Bug Priority: Critical
Reporter: Ramesh Sivaraman Assignee: Jan Lindström (Inactive)
Resolution: Fixed Votes: 0
Labels: not-10.2, not-10.3, not-10.4


 Description   

The crash is happening only if we reduce max_ws_size to 512. The assertion is similar to MDEV-25589 but the versions affected are different

SET GLOBAL wsrep_provider_options='repl.max_ws_size=512';
CREATE TABLE t1 (c1 int);
CREATE TABLE t2 (c2 int);
CREATE TRIGGER tr AFTER INSERT ON t1 FOR EACH ROW UPDATE t2 SET t2.c2 = t2.c2+1;
DROP TABLE t1;
FLUSH TABLE t1;

Leads to:

10.6.1 370b310b1d67ad42df96b75c3876fdcf67a8694f (Debug)

mysqld: /test/10.6_dbg/sql/sql_reload.cc:216: bool reload_acl_and_cache(THD*, long long unsigned int, TABLE_LIST*, int*): Assertion `!thd || thd->locked_tables_mode || !thd->mdl_context.has_locks() || thd->handler_tables_hash.records || thd->ull_hash.records || thd->global_read_lock.is_acquired() || thd->mdl_backup_lock || thd->current_backup_stage != BACKUP_FINISHED' failed.

10.6.1 370b310b1d67ad42df96b75c3876fdcf67a8694f (Debug)

Core was generated by `/test/GAL_MD120521-mariadb-10.6.1-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 0x14b7c80ed700 (LWP 959903))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
#1  0x0000556178a221f1 in my_write_core (sig=sig@entry=6) at /test/10.6_dbg/mysys/stacktrace.c:424
#2  0x00005561781bad3e in handle_fatal_signal (sig=6) at /test/10.6_dbg/sql/signal_handler.cc:343
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#5  0x000014b7d951e859 in __GI_abort () at abort.c:79
#6  0x000014b7d951e729 in __assert_fail_base (fmt=0x14b7d96b4588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x556178bdb048 "!thd || thd->locked_tables_mode || !thd->mdl_context.has_locks() || thd->handler_tables_hash.records || thd->ull_hash.records || thd->global_read_lock.is_acquired() || thd->mdl_backup_lock || thd->cur"..., file=0x556178bdb020 "/test/10.6_dbg/sql/sql_reload.cc", line=216, function=<optimized out>) at assert.c:92
#7  0x000014b7d952ff36 in __GI___assert_fail (assertion=assertion@entry=0x556178bdb048 "!thd || thd->locked_tables_mode || !thd->mdl_context.has_locks() || thd->handler_tables_hash.records || thd->ull_hash.records || thd->global_read_lock.is_acquired() || thd->mdl_backup_lock || thd->cur"..., file=file@entry=0x556178bdb020 "/test/10.6_dbg/sql/sql_reload.cc", line=line@entry=216, function=function@entry=0x556178bdafd0 "bool reload_acl_and_cache(THD*, long long unsigned int, TABLE_LIST*, int*)") at assert.c:101
#8  0x00005561780802b2 in reload_acl_and_cache (thd=thd@entry=0x14b758000db8, options=4, tables=tables@entry=0x14b758014090, write_to_binlog=write_to_binlog@entry=0x14b7c80ebf30) at /test/10.6_dbg/sql/sql_class.h:2148
#9  0x0000556177ef5caf in mysql_execute_command (thd=thd@entry=0x14b758000db8) at /test/10.6_dbg/sql/sql_parse.cc:5452
#10 0x0000556177edda81 in mysql_parse (thd=thd@entry=0x14b758000db8, rawbuf=rawbuf@entry=0x14b758013fe0 "FLUSH TABLE t1", length=length@entry=14, parser_state=parser_state@entry=0x14b7c80ec410) at /test/10.6_dbg/sql/sql_parse.cc:8018
#11 0x0000556177edd41a in wsrep_mysql_parse (thd=thd@entry=0x14b758000db8, rawbuf=0x14b758013fe0 "FLUSH TABLE t1", length=14, parser_state=parser_state@entry=0x14b7c80ec410) at /test/10.6_dbg/sql/sql_parse.cc:7832
#12 0x0000556177eec994 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14b758000db8, packet=packet@entry=0x14b75800b799 "FLUSH TABLE t1", packet_length=packet_length@entry=14, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1333
#13 0x0000556177eefd79 in do_command (thd=0x14b758000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1406
#14 0x000055617804bde7 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55617b979b38, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
#15 0x000055617804c3ef in handle_one_connection (arg=arg@entry=0x55617b979b38) at /test/10.6_dbg/sql/sql_connect.cc:1312
#16 0x0000556178501bc1 in pfs_spawn_thread (arg=0x55617b9f6258) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
#17 0x000014b7d9a2c609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#18 0x000014b7d961b293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

10.5.11 4d53a7585c532c2cfcea184259e3153f95b35683 (Debug)

mysqld: /test/10.5_dbg/sql/sql_reload.cc:216: bool reload_acl_and_cache(THD*, long long unsigned int, TABLE_LIST*, int*): Assertion `!thd || thd->locked_tables_mode || !thd->mdl_context.has_locks() || thd->handler_tables_hash.records || thd->ull_hash.records || thd->global_read_lock.is_acquired() || thd->mdl_backup_lock || thd->current_backup_stage != BACKUP_FINISHED' failed.

10.5.11 4d53a7585c532c2cfcea184259e3153f95b35683 (Debug)

Core was generated by `/test/GAL_MD120521-mariadb-10.5.11-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 0x154120426700 (LWP 1417427))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
#1  0x0000558b70e5233c in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:424
#2  0x0000558b70598830 in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:343
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#5  0x0000154131665859 in __GI_abort () at abort.c:79
#6  0x0000154131665729 in __assert_fail_base (fmt=0x1541317fb588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x558b7100b078 "!thd || thd->locked_tables_mode || !thd->mdl_context.has_locks() || thd->handler_tables_hash.records || thd->ull_hash.records || thd->global_read_lock.is_acquired() || thd->mdl_backup_lock || thd->cur"..., file=0x558b7100b050 "/test/10.5_dbg/sql/sql_reload.cc", line=216, function=<optimized out>) at assert.c:92
#7  0x0000154131676f36 in __GI___assert_fail (assertion=assertion@entry=0x558b7100b078 "!thd || thd->locked_tables_mode || !thd->mdl_context.has_locks() || thd->handler_tables_hash.records || thd->ull_hash.records || thd->global_read_lock.is_acquired() || thd->mdl_backup_lock || thd->cur"..., file=file@entry=0x558b7100b050 "/test/10.5_dbg/sql/sql_reload.cc", line=line@entry=216, function=function@entry=0x558b7100b000 "bool reload_acl_and_cache(THD*, long long unsigned int, TABLE_LIST*, int*)") at assert.c:101
#8  0x0000558b70461323 in reload_acl_and_cache (thd=thd@entry=0x1540c4000db8, options=4, tables=tables@entry=0x1540c4013da0, write_to_binlog=write_to_binlog@entry=0x154120424e90) at /test/10.5_dbg/sql/sql_class.h:2084
#9  0x0000558b702d4774 in mysql_execute_command (thd=thd@entry=0x1540c4000db8) at /test/10.5_dbg/sql/sql_parse.cc:5521
#10 0x0000558b702bbc3e in mysql_parse (thd=thd@entry=0x1540c4000db8, rawbuf=rawbuf@entry=0x1540c4013cf0 "FLUSH TABLE t1", length=length@entry=14, parser_state=parser_state@entry=0x1541204253d0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:8099
#11 0x0000558b702bb569 in wsrep_mysql_parse (thd=thd@entry=0x1540c4000db8, rawbuf=0x1540c4013cf0 "FLUSH TABLE t1", length=14, parser_state=parser_state@entry=0x1541204253d0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7902
#12 0x0000558b702caf48 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x1540c4000db8, packet=packet@entry=0x1540c400b4a9 "FLUSH TABLE t1", packet_length=packet_length@entry=14, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_class.h:1271
#13 0x0000558b702ce7b6 in do_command (thd=0x1540c4000db8) at /test/10.5_dbg/sql/sql_parse.cc:1370
#14 0x0000558b7042c0e2 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x558b730c3668, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1410
#15 0x0000558b7042c7e9 in handle_one_connection (arg=arg@entry=0x558b730c3668) at /test/10.5_dbg/sql/sql_connect.cc:1312
#16 0x0000558b708e88b5 in pfs_spawn_thread (arg=0x558b73127818) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
#17 0x0000154131b73609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#18 0x0000154131762293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.5.11 (dbg), 10.6.1 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.2.39 (dbg), 10.3.30 (dbg), 10.4.20 (dbg)



 Comments   
Comment by Jan Lindström (Inactive) [ 2022-01-13 ]

I think this is already fixed as I can't reproduce it.

connection node_2;
connection node_1;
SET GLOBAL wsrep_provider_options='repl.max_ws_size=512';
CREATE TABLE t1 (c1 int);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
CREATE TABLE t2 (c2 int);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
CREATE TRIGGER tr AFTER INSERT ON t1 FOR EACH ROW UPDATE t2 SET t2.c2 = t2.c2+1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
DROP TABLE t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
FLUSH TABLE t1;
galera.jan 'innodb'                      [ fail ]
        Test ended at 2022-01-13 12:25:17
 
CURRENT_TEST: galera.jan
mysqltest: At line 12: query 'FLUSH TABLE t1' failed: 1205: Lock wait timeout exceeded; try restarting transaction

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