summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2019-01-17 23:17:37 +0100
committerVladislav Vaintroub <wlad@mariadb.com>2019-01-17 23:18:50 +0100
commit69221746db4814d9395fc9905e1aae4f497c92e1 (patch)
tree001c14b69a925c599af21bf4e80edca1a8b50ab9 /storage
parent8e80fd6bfdf2ea7d1870662ecd4d8129f3c76301 (diff)
downloadmariadb-git-69221746db4814d9395fc9905e1aae4f497c92e1.tar.gz
MDEV-18289 - Fix a race between thd_destructor_proxy() startup and
server shutdown. Prior to adding current thd to the global thd list, initialize thd->mysys_var->current_cond / thd->mysys_var->current_mutex. Otherwise thd_destructor_proxy can miss the abort condition, which is set by the shutdown thread.
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/handler/ha_innodb.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 195712a5e54..e439db8d828 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -317,11 +317,12 @@ thd_destructor_proxy(void *)
mysql_cond_init(PSI_NOT_INSTRUMENTED, &thd_destructor_cond, 0);
st_my_thread_var *myvar= _my_thread_var();
+ myvar->current_mutex = &thd_destructor_mutex;
+ myvar->current_cond = &thd_destructor_cond;
+
THD *thd= create_thd();
thd_proc_info(thd, "InnoDB shutdown handler");
- myvar->current_mutex = &thd_destructor_mutex;
- myvar->current_cond = &thd_destructor_cond;
mysql_mutex_lock(&thd_destructor_mutex);
my_atomic_storeptr_explicit(reinterpret_cast<void**>(&srv_running),