Bug #99641 crashed in srv_free if -DDISABLE_PSI_MEMORY=1
Submitted: 20 May 2020 7:15 Modified: 20 May 2020 9:22
Reporter: zhai weixiang (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:8.0, 8.0.20 OS:Any
Assigned to: CPU Architecture:Any

[20 May 2020 7:15] zhai weixiang
Description:
srv_threads.m_page_cleaner_workers/srv_threads.m_purge_workers (in srv_init) are created using UT_NEW_ARRAY_NOKEY and should use UT_DELETE_ARRAY to free it, but actually it uses ut_free in srv_free() 

How to repeat:
cmake with -DDISABLE_PSI_MEMORY=1 and run any test case

Suggested fix:
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -1186,7 +1186,7 @@ void srv_free(void) {
     for (size_t i = 0; i < srv_threads.m_page_cleaner_workers_n; ++i) {
       srv_threads.m_page_cleaner_workers[i] = {};
     }
-    ut_free(srv_threads.m_page_cleaner_workers);
+    UT_DELETE_ARRAY(srv_threads.m_page_cleaner_workers);
     srv_threads.m_page_cleaner_workers = nullptr;
   }

@@ -1194,7 +1194,7 @@ void srv_free(void) {
     for (size_t i = 0; i < srv_threads.m_purge_workers_n; ++i) {
       srv_threads.m_purge_workers[i] = {};
     }
-    ut_free(srv_threads.m_purge_workers);
+    UT_DELETE_ARRAY(srv_threads.m_purge_workers);
     srv_threads.m_purge_workers = nullptr;
   }
[20 May 2020 9:22] MySQL Verification Team
Hello zhai,

Thank you for the report and feedback.

regards,
Umesh