Details
-
Bug
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
10.2, 10.3, 10.4, 10.5, 10.6, 10.10, 10.11, 11.0, 11.1, 11.2
Description
ThreadLocalPtr::StaticMeta instance is a singleton.
It is created once, immediately when ha_rocksdb.so is dlopened [1] and it doesn't seem to be freed anywhere. This triggers leak sanitizer in ASAN builds. It can perhaps exhaust memory if one installs/uninstalls (or runs show plugin soname) in a loop.
[1] static variable rocksdb_db_options initialized by calling rdb_init_rocksdb_db_options() that calls DBOptions::DBOptions(), Env::Default(), ThreadLocalPtr::InitSingletons(), ThreadLocalPtr::Instance().
Explicit delete seems to help:
diff --git a/util/thread_local.cc b/util/thread_local.cc
|
--- a/util/thread_local.cc
|
+++ b/util/thread_local.cc
|
@@ -335,6 +335,7 @@ ThreadLocalPtr::StaticMeta::StaticMeta()
|
if (tls_) {
|
OnThreadExit(tls_);
|
}
|
+ delete Instance();
|
}
|
} a;
|
#endif // !defined(OS_WIN) |