summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2022-09-28 14:27:55 +0200
committerSergei Golubchik <serg@mariadb.org>2022-09-29 00:11:02 +0200
commitde130323b4401ba9dfcb08ebd7f8d688cb317a80 (patch)
treeaea21ad06b034834ea8395b45bb7b496d9a51a26 /sql/sql_class.cc
parent74ac683a7e822f3287e75527d7d3a7ff1256c46c (diff)
downloadmariadb-git-de130323b4401ba9dfcb08ebd7f8d688cb317a80.tar.gz
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 9b750dcbd89e, 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.
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 87526acbdba..87f5262f9ce 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1533,6 +1533,8 @@ void THD::cleanup(void)
wsrep_client_thread= false;
#endif /* WITH_WSREP */
+ DEBUG_SYNC(this, "THD_cleanup_after_set_killed");
+
mysql_ha_cleanup(this);
locked_tables_list.unlock_locked_tables(this);