-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RocksDB v.8.3.2 Still reachable bytes and running background threads after shutdown. #11598
Comments
@JorgeMarinoDev Did you have a try at canceling all background threads first? Refer: https://github.com/apache/kvrocks/blob/unstable/src/storage/storage.cc#L76 |
Hello, we have tried that before as well.
Also attaching results with this explicit call: |
There is a leak! But it is spurious. In RocksDB, bg threads are resources shared among multiple DB. They won't be recycled until the end of the process. However, since destruction of them is a little tricky, the authors of RocksDB decide to NOT destruct them, and NOT free the memory they occuiped. After all, the process it about to exit, no need to care about memory reclaim. See Lines 44 to 45 in 70bf5ef
RocksDB provides an option for perfectionists, if you build(you should not in production) RocksDB with the hint of address_sanitizer is going to be used, then it will do the destruction. |
Hello,
We are currently working on a SIEM Tool project that is using RocksDB v8.3.2.
Since this kind of programs must remain up and running for really long periods of time, in terms of weeks, even months, we have a strict policy regarding memory profiling on the RCs.
valgrind_issue_memcheck_report.log
BEFORE adding the Module using RocksDB, we had this summary after doing a valgrind memcheck.
But, after adding RocksDB, a Single DB and a couple of Column Families, just by opening the DB and creating the CFs handlers, not performing any operation either, we had this summary after shutdown: (with 12,351 still reachable bytes).
Important Note : Several shutdown procedures were tried, following the official documentation and examples. It means:
Also checking the opStatus and trying Close twice as the source code suggests somewhere in a header comment.
Valgrind reports still reachable bytes related to the background threads:
Even further, performing TSAN and checking the running threads, the BG worker threads don't get destroyed after closing rocksDB.
No operations were pending even. Just starting the environment.
issue : There is no way to free these bytes or close the bg threads.
Environment
RocksDB added with CPM
Initialize Options
m_rocksDBOptions = rocksdb::Options(); m_rocksDBOptions.IncreaseParallelism(); m_rocksDBOptions.OptimizeLevelStyleCompaction(); m_rocksDBOptions.create_if_missing = true;
Open call
Shutdown
Expected behavior
Actual behavior
Steps to reproduce the behavior
Environment was detailed above.
The text was updated successfully, but these errors were encountered: