Commit 69221746 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

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.
parent 8e80fd6b
......@@ -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),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment