diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2020-11-24 08:45:04 +0100 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2020-11-24 08:45:37 +0100 |
commit | 08b0b70daa43a539d911238e25998f7450bab9e6 (patch) | |
tree | 49af1cbfc1c839a71c30fcd00cd8eecff8bc69c8 | |
parent | 75e7132fca1c4634d4aa8d18d386c55932a5e1b6 (diff) | |
download | mariadb-git-08b0b70daa43a539d911238e25998f7450bab9e6.tar.gz |
MDEV-24084 Fix race between disconnect and KILL CONNECTION
Prior to this patch, it is possible to access freed memory
(THD::event_scheduler) from tp_post_kill_notification().
With this patch, memory is freed only when THD is no more accessible
from other threads, i.e after it is removed from the thread_list.
-rw-r--r-- | sql/threadpool_common.cc | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc index 03c39d65f23..7de7866e015 100644 --- a/sql/threadpool_common.cc +++ b/sql/threadpool_common.cc @@ -202,12 +202,11 @@ void tp_callback(TP_connection *c) error: c->thd= 0; - delete c; - if (thd) { threadpool_remove_connection(thd); } + delete c; worker_context.restore(); } |