From 9f9eb682d54fedf38e02df1d28228e68c10ee77d Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 13 Jun 2016 19:50:45 +0200 Subject: [PATCH] MDEV-10098 main.create_delayed fails with ps-protocol: assertion `global_status_var.global_memory_used >= 0' failed Remove the assert. We cannot verify that global_memory_used value is valid (>=0) because some of updates are cached in individual THD's (e.g. THD1 can have +300 cached, while the other THD2 can have -300 cached. If the second THD exists before the first one, global_memory_used will be -300 temporarily). Instead add the assert just before the exit, when all THDs been already destroyed. --- sql/mysqld.cc | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index c9945044e66..0e3b474f5fb 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2141,6 +2141,7 @@ static void mysqld_exit(int exit_code) shutdown_performance_schema(); // we do it as late as possible #endif set_malloc_size_cb(NULL); + DBUG_ASSERT(global_status_var.global_memory_used == 0); cleanup_tls(); DBUG_LEAVE; if (opt_endinfo && global_status_var.global_memory_used) @@ -4109,14 +4110,6 @@ static void my_malloc_size_cb_func(long long size, my_bool is_thread_specific) else { update_global_memory_status(size); -#ifndef EMBEDDED_LIBRARY - /* - Check if we have missed some mallocs. THis can't be done for embedded - server as the main code may have done calls to malloc before starting - the embedded library. - */ - DBUG_ASSERT(global_status_var.global_memory_used >= 0); -#endif } } }