From 61c0df94655f2dc3146456e49f3f51610251e79f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 23 Apr 2020 10:30:58 +0300 Subject: [PATCH] After-merge fix mysqld_exit(): Change the assertion failure on global_status_var.global_memory_used == 0 to fprintf, like in 0bcb65d358087bf94e217254f812f913343a6f5d It appears that in some cases, that variable may be nonzero even when LeakSanitizer (WITH_ASAN) would not report errors. This was observed in 10.4 88cf6f1c7ff5d56138c8b53a5adaca4c61752f86 with the MDEV-22348 test case (Aria startup failure when running main.default_storage_engine). --- sql/mysqld.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 74c153d57e9..2530043a729 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2191,10 +2191,10 @@ static void mysqld_exit(int exit_code) set_malloc_size_cb(NULL); if (global_status_var.global_memory_used) { -#ifdef SAFEMALLOC - sf_report_leaked_memory(0); -#endif - DBUG_SLOW_ASSERT(global_status_var.global_memory_used == 0); + fprintf(stderr, "Warning: Memory not freed: %lld\n", + (longlong) global_status_var.global_memory_used); + if (exit_code == 0) + SAFEMALLOC_REPORT_MEMORY(0); } cleanup_tls(); DBUG_LEAVE;