#At file:///home/malff/BZR_TREE/mysql-trunk-bugfixing-merge/ based on revid:marc.alff@stripped
3265 Marc Alff 2010-09-14 [merge]
MErge mysql-5.5-bugfixing --> mysql-trunk-bugfixing
modified:
mysql-test/valgrind.supp
sql/mysqld.cc
=== modified file 'mysql-test/valgrind.supp'
--- a/mysql-test/valgrind.supp 2010-06-07 09:14:56 +0000
+++ b/mysql-test/valgrind.supp 2010-09-14 21:51:35 +0000
@@ -745,3 +745,28 @@
Memcheck:Addr1
fun:buf_buddy_relocate
}
+
+#
+# See related Bug#56666
+# Race condition between the server main thread and the kill server thread.
+#
+# Because of this race condition, the call to shutdown_performance_schema()
+# was commented in sql/mysqld.cc, causing the reported leaks.
+#
+
+{
+ missing shutdown_performance_schema 1
+ Memcheck:Leak
+ fun:malloc
+ fun:_Z10pfs_mallocmi
+}
+
+{
+ missing shutdown_performance_schema 2
+ Memcheck:Leak
+ fun:malloc
+ fun:my_malloc
+ fun:_lf_alloc_new
+ fun:lf_hash_insert
+}
+
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2010-09-08 07:09:13 +0000
+++ b/sql/mysqld.cc 2010-09-14 21:51:35 +0000
@@ -1395,6 +1395,12 @@ static void mysqld_exit(int exit_code)
mysql_audit_finalize();
clean_up_mutexes();
clean_up_error_log_mutex();
+#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
+ /*
+ Bug#56666 needs to be fixed before calling:
+ shutdown_performance_schema();
+ */
+#endif
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
exit(exit_code); /* purecov: inspected */
}
@@ -2729,6 +2735,11 @@ pthread_handler_t signal_hand(void *arg
if (!abort_loop)
{
abort_loop=1; // mark abort for threads
+#ifdef HAVE_PSI_INTERFACE
+ /* Delete the instrumentation for the signal thread */
+ if (likely(PSI_server != NULL))
+ PSI_server->delete_current_thread();
+#endif
#ifdef USE_ONE_SIGNAL_HAND
pthread_t tmp;
if (mysql_thread_create(0, /* Not instrumented */
@@ -4749,6 +4760,15 @@ int mysqld_main(int argc, char **argv)
#endif
#endif /* __WIN__ */
+#ifdef HAVE_PSI_INTERFACE
+ /*
+ Disable the main thread instrumentation,
+ to avoid recording events during the shutdown.
+ */
+ if (PSI_server)
+ PSI_server->delete_current_thread();
+#endif
+
/* Wait until cleanup is done */
mysql_mutex_lock(&LOCK_thread_count);
while (!ready_to_exit)
@@ -4766,18 +4786,6 @@ int mysqld_main(int argc, char **argv)
}
#endif
clean_up(1);
-#ifdef HAVE_PSI_INTERFACE
- /*
- Disable the instrumentation, to avoid recording events
- during the shutdown.
- */
- if (PSI_server)
- {
- PSI_server->delete_current_thread();
- PSI_server= NULL;
- }
- shutdown_performance_schema();
-#endif
mysqld_exit(0);
}
Attachment: [text/bzr-bundle] bzr/marc.alff@oracle.com-20100914215135-qd9a79axp6oaov7d.bundle
| Thread |
|---|
| • bzr commit into mysql-trunk-bugfixing branch (marc.alff:3265) | Marc Alff | 14 Sep |