From 1b4f694adfa257d41b5ddb141e5bcc23e6dfd9c8 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 10 Feb 2017 14:17:19 +0000 Subject: [PATCH] MDEV-10291 : Fix race condition in bootstrap main thread may destroy mutexes that bootstrap is using in THD destructor. --- sql/sql_parse.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ab1781edfac..e413b73f62c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1085,9 +1085,10 @@ void do_handle_bootstrap(THD *thd) handle_bootstrap_impl(thd); end: - in_bootstrap= FALSE; delete thd; + mysql_mutex_lock(&LOCK_thread_count); + in_bootstrap = FALSE; mysql_cond_broadcast(&COND_thread_count); mysql_mutex_unlock(&LOCK_thread_count);