mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-33150 double-locking of LOCK_thd_kill in performance_schema.session_status
perfschema thread walker needs to take thread's LOCK_thd_kill to prevent the thread from disappearing why it's being looked at. But there's no need to lock it for the current thread. In fact, it was harmful as some code down the stack might take LOCK_thd_kill (e.g. set_killed() does it, and my_malloc_size_cb_func() calls set_killed()). And it caused a bunch of mutexes being locked under LOCK_thd_kill, which created problems later when my_malloc_size_cb_func() called set_killed() at some unspecified point under some random mutexes.
This commit is contained in:
@@ -211,8 +211,12 @@ public:
|
||||
if (thd != m_unsafe_thd)
|
||||
return false;
|
||||
|
||||
/* Hold this lock to keep THD during materialization. */
|
||||
mysql_mutex_lock(&thd->LOCK_thd_kill);
|
||||
/*
|
||||
Hold this lock to keep THD during materialization.
|
||||
But don't lock current_thd (to be able to use set_killed() later
|
||||
*/
|
||||
if (thd != current_thd)
|
||||
mysql_mutex_lock(&thd->LOCK_thd_kill);
|
||||
return true;
|
||||
}
|
||||
void set_unsafe_thd(THD *unsafe_thd) { m_unsafe_thd= unsafe_thd; }
|
||||
|
Reference in New Issue
Block a user