diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2019-01-21 19:10:38 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2019-01-22 00:19:02 +0400 |
commit | 382115b99297ceaa4c3067f79efb5c2515013be5 (patch) | |
tree | 34de88c10c824309e6a60b9e4e3b697905b0ea67 | |
parent | 71261e31887a48a081051e8a880e8c4fb259ce44 (diff) | |
download | mariadb-git-382115b99297ceaa4c3067f79efb5c2515013be5.tar.gz |
MDEV-12747 - main.mysqld_option_err fails in buildbot with timeout
thd_destructor_proxy() may miss abort signal if innobase_end() is running
concurrently, which causes server hang in pthread_join() on shutdown.
The problem was that aborting wasn't protected by mutex:
proxy thr: while (!myvar->abort)
end thr: running->abort = 1;
end thr: mysql_cond_broadcast(...);
proxy thr: mysql_cond_wait(...); // nobody to awake it
end thr: pthread_join(...); // waits for proxy thr
Also made main.mysqld_option_err reentrant.
-rw-r--r-- | mysql-test/main/mysqld_option_err.test | 2 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 18 |
2 files changed, 11 insertions, 9 deletions
diff --git a/mysql-test/main/mysqld_option_err.test b/mysql-test/main/mysqld_option_err.test index 0c38eba7ca9..e9655fd4bfe 100644 --- a/mysql-test/main/mysqld_option_err.test +++ b/mysql-test/main/mysqld_option_err.test @@ -56,4 +56,6 @@ mkdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err; --error 2 --exec $MYSQLD_BOOTSTRAP_CMD --not-known-option --help --verbose >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1 +rmdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err; + --echo Done. diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 35c8b7fb1c5..2690ff9f736 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -4339,15 +4339,15 @@ innobase_end(handlerton*, ha_panic_function) } } - st_my_thread_var* running = - srv_running.load(std::memory_order_relaxed); - if (!abort_loop && running) { - // may be UNINSTALL PLUGIN statement - running->abort = 1; - mysql_cond_broadcast(running->current_cond); - } - - if (!srv_read_only_mode) { + if (auto r = srv_running.load(std::memory_order_relaxed)) { + ut_ad(!srv_read_only_mode); + if (!abort_loop) { + // may be UNINSTALL PLUGIN statement + mysql_mutex_lock(r->current_mutex); + r->abort = 1; + mysql_cond_broadcast(r->current_cond); + mysql_mutex_unlock(r->current_mutex); + } pthread_join(thd_destructor_thread, NULL); } |