diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2017-07-05 19:37:57 +0000 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2017-07-06 11:36:17 +0000 |
commit | 6f1f9114971c3c158e9ac97313c92a24f6554415 (patch) | |
tree | 59ef97fd86eeb3172c4d2466c0f86c2cb23883fc | |
parent | 53d6325db0667c0011db5abfde604b13003a28ad (diff) | |
download | mariadb-git-6f1f9114971c3c158e9ac97313c92a24f6554415.tar.gz |
MDEV-12445 : Rocksdb does not shutdown worker threads and aborts in memleak check on server shutdown
Disable memory leak check in debug server, if rocksdb is loaded.
There is some subtle bug somewhere in 3rd party code we cannot
do much about.
The bug is manifested as follows
Rocksdb does not shutdown worker threads, when plugin is shut down. Thus
OS does not unload the library since there are some active threads using
this library's code. Thus global destructors in the library do not run,
and there is still some memory allocated when server exits.
The workaround disables server's memory leak check, if rocksdb engine was
loaded.
-rw-r--r-- | sql/mysqld.cc | 3 | ||||
-rw-r--r-- | storage/rocksdb/ha_rocksdb.cc | 10 | ||||
-rw-r--r-- | storage/rocksdb/mysql-test/rocksdb/t/disabled.def | 1 |
3 files changed, 12 insertions, 2 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 373f9bae26e..592cf53b5b5 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -365,6 +365,7 @@ static bool volatile select_thread_in_use, signal_thread_in_use; static volatile bool ready_to_exit; static my_bool opt_debugging= 0, opt_external_locking= 0, opt_console= 0; static my_bool opt_short_log_format= 0, opt_silent_startup= 0; +bool my_disable_leak_check= false; uint kill_cached_threads; static uint wake_thread; @@ -2155,7 +2156,7 @@ static void mysqld_exit(int exit_code) shutdown_performance_schema(); // we do it as late as possible #endif set_malloc_size_cb(NULL); - if (!opt_debugging) + if (!opt_debugging && !my_disable_leak_check) { DBUG_ASSERT(global_status_var.global_memory_used == 0); } diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index 8c9d27adee5..245cc437084 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -97,6 +97,8 @@ int thd_binlog_format(const MYSQL_THD thd); bool thd_binlog_filter_ok(const MYSQL_THD thd); } +MYSQL_PLUGIN_IMPORT bool my_disable_leak_check; + namespace myrocks { static st_global_stats global_stats; @@ -3593,6 +3595,14 @@ static int rocksdb_init_func(void *const p) { #endif sql_print_information("RocksDB instance opened"); + + /** + Rocksdb does not always shutdown its threads, when + plugin is shut down. Disable server's leak check + at exit to avoid crash. + */ + my_disable_leak_check = true; + DBUG_RETURN(HA_EXIT_SUCCESS); } diff --git a/storage/rocksdb/mysql-test/rocksdb/t/disabled.def b/storage/rocksdb/mysql-test/rocksdb/t/disabled.def index 37a6ee15e30..883f4475952 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/disabled.def +++ b/storage/rocksdb/mysql-test/rocksdb/t/disabled.def @@ -60,7 +60,6 @@ rocksdb_deadlock_stress_rr: stress test # MDEV-12474 Regularly failing tests on Buildbot autoinc_vars_thread : MDEV-12474 Regularly fails on buildbot -validate_datadic : MDEV-12474 Regularly fails on buildbot unique_check : MDEV-12474 Regularly fails on buildbot bloomfilter : MDEV-12474 Regularly fails on buildbot |