1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-29368 Assertion `trx->mysql_thd == thd' failed in innobase_kill_query from process_timers/timer_handler and use-after-poison in innobase_kill_query

This is a 10.5 version of 9b750dcbd8, fix for
MDEV-23536 Race condition between KILL and transaction commit

InnoDB needs to remove trx from thd before destroying it (trx), otherwise
a concurrent KILL might get a pointer from thd to a destroyed trx.

ha_close_connection() should allow engines to clear ha_data in
hton->on close_connection(). To prevent the engine from being unloaded
while hton->close_connection() is running, we remove the lock from
ha_data and unlock the plugin manually.
This commit is contained in:
Sergei Golubchik
2022-09-28 14:27:55 +02:00
parent 74ac683a7e
commit de130323b4
6 changed files with 45 additions and 6 deletions

View File

@ -221,3 +221,19 @@ DROP FUNCTION MY_KILL;
set global sql_mode=default;
disconnect con1;
disconnect con2;
#
# MDEV-29368 Assertion `trx->mysql_thd == thd' failed in innobase_kill_query from process_timers/timer_handler and use-after-poison in innobase_kill_query
#
connect foo,localhost,root;
create table t1 (a int) engine=innodb;
insert t1 values (1);
set debug_sync='THD_cleanup_after_set_killed SIGNAL go0 WAIT_FOR go1';
set debug_sync='innobase_connection_closed SIGNAL go2 WAIT_FOR go3';
disconnect foo;
connection default;
set debug_sync='now WAIT_FOR go0';
set debug_sync='found_killee SIGNAL go1 WAIT_FOR go2';
kill $id;
set debug_sync='now SIGNAL go3';
drop table t1;
set debug_sync='reset';