diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2015-11-04 13:17:40 +0100 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2015-11-04 17:47:21 +0100 |
commit | 1216429cfdb0e2015cc98ab0145228a7837722d7 (patch) | |
tree | c794b7da77322052c3e76c099b7eeaaad05c2e5a | |
parent | 95289e5b665d6a3e37f938d0db978d0d0166e493 (diff) | |
download | mariadb-git-1216429cfdb0e2015cc98ab0145228a7837722d7.tar.gz |
MDEV-8738 Application Verifier stop during server shutdown
The verifier exception is caused by using thread local storage key
after key was deleted.
my_free() used current_thd within malloc size callback, which does
pthread_get_specific(THR_THD), but THR_THD is already deleted at this
point.
The fix moves pthread_key_delete() to a later point in shutdown.
-rw-r--r-- | sql/mysqld.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 1a32f37b139..932bb0c20ba 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2046,6 +2046,16 @@ extern "C" void unireg_abort(int exit_code) mysqld_exit(exit_code); } + +static void cleanup_tls() +{ + if (THR_THD) + (void)pthread_key_delete(THR_THD); + if (THR_MALLOC) + (void)pthread_key_delete(THR_MALLOC); +} + + static void mysqld_exit(int exit_code) { DBUG_ENTER("mysqld_exit"); @@ -2064,6 +2074,7 @@ static void mysqld_exit(int exit_code) #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE shutdown_performance_schema(); // we do it as late as possible #endif + cleanup_tls(); DBUG_LEAVE; sd_notify(0, "STATUS=MariaDB server is down"); exit(exit_code); /* purecov: inspected */ @@ -2186,12 +2197,6 @@ void clean_up(bool print_message) #endif free_list(opt_plugin_load_list_ptr); - if (THR_THD) - (void) pthread_key_delete(THR_THD); - - if (THR_MALLOC) - (void) pthread_key_delete(THR_MALLOC); - /* The following lines may never be executed as the main thread may have killed us |