diff options
author | Marc Alff <marc.alff@oracle.com> | 2010-09-09 15:33:35 -0600 |
---|---|---|
committer | Marc Alff <marc.alff@oracle.com> | 2010-09-09 15:33:35 -0600 |
commit | 2779f0aad1af99abd8295d41c99e208668ef317e (patch) | |
tree | 85e02c4bce2c97ed573d7aa8794d35a8dbbc6923 /mysql-test/valgrind.supp | |
parent | 788d3c4518492c211a4aaea562ebbbbe75a7d8b0 (diff) | |
download | mariadb-git-2779f0aad1af99abd8295d41c99e208668ef317e.tar.gz |
Bug#56324 Race Condition while shutting down MySQL: "PSI_server"
Before this fix, the server could crash during shutdown,
due to race conditions, that occured when killing the server.
In particular, the performance schema instrumentation handle,
PSI_server, and the performance schema itself would be cleaned up
too soon, causing race conditions with a running kill server thread.
The specifics of the race condition found are that:
the main thread executing "PSI_server= NULL" can cause crashes in
other threads still running, which are executing
"if (PSI_server != NULL) PSI_server->xxx()"
as part of the performance schema instrumentation.
While the bug was reported for the kill server thread,
in theory the same crash could happen with the signal thread,
as found by code analysis.
The correct fix would be to only shutdown the performance schema
and set PSI_server to NULL after every other thread is guaranteed
to be completed, including the kill_server_thread.
However, due to the existing mysqld server design, this is not the case.
See in particular bug number 56666.
The work around used to fix this race condition is to simply not
perform the call to shutdown_performance_schema() when the server exits,
and to keep the PSI_server pointer unchanged.
This will cause memory leaks to be reported by tools like valgrind,
but no memory leak actually happen because the process is about to exit().
As a result, the file mysql-test/valgrind.supp has been updated
to filter out these false positive messages.
This code has been tested with running in a loop the following
tests in parallel, which have been known to fail with race conditions
in the past:
- rpl_change_master
- binlog_max_extension
- events_restart
- rpl_heartbeat_basic
and no crash of test failure has been seen with the changed code.
Diffstat (limited to 'mysql-test/valgrind.supp')
-rw-r--r-- | mysql-test/valgrind.supp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index 83896378883..4b323b0bbfc 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -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 +} + |