Skip to content

Commit

Permalink
MDEV-18289 - Fix a race between thd_destructor_proxy() startup and
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vaintroub committed Jan 17, 2019
1 parent 8e80fd6 commit 6922174
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 6922174

Please sign in to comment.