Commit 860c104d authored by unknown's avatar unknown
Browse files

BUG#20598

Fix race between cleanup and thread kill at server shutdown that would
sometimes prevent proper cleanup, leading to Valgrind warnings.


sql/mysqld.cc:
  Move logger cleanup to avoid races with thread kill.
parent cb28cf8d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1266,13 +1266,13 @@ void clean_up(bool print_message)
          MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
  DBUG_PRINT("quit", ("Error messages freed"));
  /* Tell main we are ready */
  logger.cleanup_end();
  (void) pthread_mutex_lock(&LOCK_thread_count);
  DBUG_PRINT("quit", ("got thread count lock"));
  ready_to_exit=1;
  /* do the broadcast inside the lock to ensure that my_end() is not called */
  (void) pthread_cond_broadcast(&COND_thread_count);
  (void) pthread_mutex_unlock(&LOCK_thread_count);
  logger.cleanup_end();

  /*
    The following lines may never be executed as the main thread may have