[PATCH] Fix "Assertion `THR_PFS_initialized' failed" in main.bootstrap
The problem is that the manager thread may not have yet started when bootstrap exits. This causes assertion when the thread tries to access performance schema data after shutdown_performance_schema() has been called. Fix by waiting for the manager thread to have started before proceeding. Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org> --- sql/sql_manager.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sql/sql_manager.cc b/sql/sql_manager.cc index 3d3728b9e00..d4a410ce5fb 100644 --- a/sql/sql_manager.cc +++ b/sql/sql_manager.cc @@ -76,6 +76,8 @@ pthread_handler_t handle_manager(void *arg __attribute__((unused))) pthread_detach_this_thread(); manager_thread = pthread_self(); mysql_mutex_lock(&LOCK_manager); + manager_thread_in_use = 1; + mysql_cond_signal(&COND_manager); while (!abort_manager) { /* XXX: This will need to be made more general to handle different @@ -135,12 +137,19 @@ void start_handle_manager() pthread_t hThread; int err; DBUG_EXECUTE_IF("delay_start_handle_manager", my_sleep(1000);); - manager_thread_in_use = 1; mysql_cond_init(key_COND_manager, &COND_manager,NULL); mysql_mutex_init(key_LOCK_manager, &LOCK_manager, NULL); if ((err= mysql_thread_create(key_thread_handle_manager, &hThread, &connection_attrib, handle_manager, 0))) + { sql_print_warning("Can't create handle_manager thread (errno: %M)", err); + DBUG_VOID_RETURN; + } + + mysql_mutex_lock(&LOCK_manager); + while (!manager_thread_in_use) + mysql_cond_wait(&COND_manager, &LOCK_manager); + mysql_mutex_unlock(&LOCK_manager); } DBUG_VOID_RETURN; } -- 2.30.2
participants (1)
-
Kristian Nielsen