Skip to content
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

Memory Leaks in tests: LeakSanitizer: 13486 byte(s) leaked in 38 allocation(s). #77

Closed
3 tasks
andelf opened this issue Jun 26, 2017 · 3 comments
Closed
3 tasks
Assignees

Comments

@andelf
Copy link

andelf commented Jun 26, 2017

refer #76

Leak Positions:

  • crocksdb_get_pinned librocksdb_sys/crocksdb/c.cc:2881 💣
    • VERY BAD, used very often in our project
  • crocksdb_cache_create_lru librocksdb_sys/crocksdb/c.cc:2487 ⚠️
    • test::test_rocksdb_options::test_get_block_cache_usage leaks 4k
@siddontang
Copy link

@andelf
What is the more detailed output for these leaks?

/cc @zhangjinpeng1987

@andelf
Copy link
Author

andelf commented Jun 27, 2017

Indirect leak of 2699 byte(s) in 1 object(s) allocated from:
    #0 0x5644c8fa249f in operator new[](unsigned long) /checkout/src/compiler-rt/lib/lsan/lsan_interceptors.cc:191 (discriminator 2)
    #1 0x5644c8fa249f in ?? ??:0
    #2 0x7f2f50e1bc1b in rocksdb::UncompressBlockContentsForCompressionType(char const*, unsigned long, rocksdb::BlockContents*, unsigned int, rocksdb::Slice const&, rocksdb::CompressionType, rocksdb::ImmutableCFOptions const&) /hom
e/pingcap/workspace/rocksdb/table/format.cc:439
    #3 0x7f2f50e1bc1b in ?? ??:0
    #4 0x7f2f50e1c0c7 in rocksdb::UncompressBlockContents(char const*, unsigned long, rocksdb::BlockContents*, unsigned int, rocksdb::Slice const&, rocksdb::ImmutableCFOptions const&) /home/pingcap/workspace/rocksdb/table/format.cc:
546
    #5 0x7f2f50e1c0c7 in ?? ??:0
    #6 0x7f2f50e1cd33 in rocksdb::ReadBlockContents(rocksdb::RandomAccessFileReader*, rocksdb::Footer const&, rocksdb::ReadOptions const&, rocksdb::BlockHandle const&, rocksdb::BlockContents*, rocksdb::ImmutableCFOptions const&, boo
l, rocksdb::Slice const&, rocksdb::PersistentCacheOptions const&) /home/pingcap/workspace/rocksdb/table/format.cc:394
    #7 0x7f2f50e1cd33 in ?? ??:0
    #8 0x7f2f50e04765 in rocksdb::(anonymous namespace)::ReadBlockFromFile(rocksdb::RandomAccessFileReader*, rocksdb::Footer const&, rocksdb::ReadOptions const&, rocksdb::BlockHandle const&, std::unique_ptr<rocksdb::Block, std::defa
ult_delete<rocksdb::Block> >*, rocksdb::ImmutableCFOptions const&, bool, rocksdb::Slice const&, rocksdb::PersistentCacheOptions const&, unsigned long, unsigned long) [clone .constprop.266] /home/pingcap/workspace/rocksdb/table/block
_based_table_reader.cc:85
    #9 0x7f2f50e04765 in ?? ??:0
    #10 0x7f2f50e06734 in rocksdb::BlockBasedTable::MaybeLoadDataBlockToCache(rocksdb::BlockBasedTable::Rep*, rocksdb::ReadOptions const&, rocksdb::BlockHandle const&, rocksdb::Slice, rocksdb::BlockBasedTable::CachableEntry<rocksdb:
:Block>*, bool) /home/pingcap/workspace/rocksdb/table/block_based_table_reader.cc:1366
    #11 0x7f2f50e06734 in ?? ??:0
    #12 0x7f2f50e069eb in rocksdb::BlockBasedTable::NewDataBlockIterator(rocksdb::BlockBasedTable::Rep*, rocksdb::ReadOptions const&, rocksdb::BlockHandle const&, rocksdb::BlockIter*, bool, rocksdb::Status) /home/pingcap/workspace/r
ocksdb/table/block_based_table_reader.cc:1280
    #13 0x7f2f50e069eb in ?? ??:0
    #14 0x7f2f50e06f68 in rocksdb::BlockBasedTable::NewDataBlockIterator(rocksdb::BlockBasedTable::Rep*, rocksdb::ReadOptions const&, rocksdb::Slice const&, rocksdb::BlockIter*, bool) /home/pingcap/workspace/rocksdb/table/block_base
d_table_reader.cc:1260
    #15 0x7f2f50e06f68 in ?? ??:0
    #16 0x7f2f50e0f0cf in rocksdb::BlockBasedTable::Get(rocksdb::ReadOptions const&, rocksdb::Slice const&, rocksdb::GetContext*, bool) /home/pingcap/workspace/rocksdb/table/block_based_table_reader.cc:1652
    #17 0x7f2f50e0f0cf in ?? ??:0
    #18 0x7f2f50d66487 in rocksdb::TableCache::Get(rocksdb::ReadOptions const&, rocksdb::InternalKeyComparator const&, rocksdb::FileDescriptor const&, rocksdb::Slice const&, rocksdb::GetContext*, rocksdb::HistogramImpl*, bool, int)
/home/pingcap/workspace/rocksdb/db/table_cache.cc:379
    #19 0x7f2f50d66487 in ?? ??:0
    #20 0x7f2f50d83d3e in rocksdb::Version::Get(rocksdb::ReadOptions const&, rocksdb::LookupKey const&, rocksdb::PinnableSlice*, rocksdb::Status*, rocksdb::MergeContext*, rocksdb::RangeDelAggregator*, bool*, bool*, unsigned long*) /
home/pingcap/workspace/rocksdb/db/version_set.cc:1006
    #21 0x7f2f50d83d3e in ?? ??:0
    #22 0x7f2f50cdd254 in rocksdb::DBImpl::GetImpl(rocksdb::ReadOptions const&, rocksdb::ColumnFamilyHandle*, rocksdb::Slice const&, rocksdb::PinnableSlice*, bool*) /home/pingcap/workspace/rocksdb/db/db_impl.cc:975
    #23 0x7f2f50cdd254 in ?? ??:0
    #24 0x7f2f50cdd8c1 in rocksdb::DBImpl::Get(rocksdb::ReadOptions const&, rocksdb::ColumnFamilyHandle*, rocksdb::Slice const&, rocksdb::PinnableSlice*) /home/pingcap/workspace/rocksdb/db/db_impl.cc:902
    #25 0x7f2f50cdd8c1 in ?? ??:0
    #26 0x5644c9006850 in crocksdb_get_pinned /home/pingcap/workspace/rust-rocksdb/librocksdb_sys/crocksdb/c.cc:2881
    #27 0x5644c9006850 in ?? ??:0
Indirect leak of 4096 byte(s) in 32 object(s) allocated from:
    #0 0x5644c8fa249f in operator new[](unsigned long) /checkout/src/compiler-rt/lib/lsan/lsan_interceptors.cc:191 (discriminator 2)
    #1 0x5644c8fa249f in ?? ??:0
    #2 0x7f2f50c83775 in rocksdb::LRUHandleTable::Resize() /home/pingcap/workspace/rocksdb/cache/lru_cache.cc:83
    #3 0x7f2f50c83775 in ?? ??:0
    #4 0x7f2f50c83939 in rocksdb::LRUCacheShard::LRUCacheShard() /home/pingcap/workspace/rocksdb/cache/lru_cache.cc:105
    #5 0x7f2f50c83939 in ?? ??:0
    #6 0x7f2f50c84097 in rocksdb::LRUCache::LRUCache(unsigned long, int, bool, double) /home/pingcap/workspace/rocksdb/cache/lru_cache.cc:444 (discriminator 7)
    #7 0x7f2f50c84097 in ?? ??:0
    #8 0x7f2f50c8422f in void __gnu_cxx::new_allocator<rocksdb::LRUCache>::construct<rocksdb::LRUCache, unsigned long&, int&, bool&, double&>(rocksdb::LRUCache*, unsigned long&, int&, bool&, double&) /usr/include/c++/5/ext/new_alloc
ator.h:120
    #9 0x7f2f50c8422f in void std::allocator_traits<std::allocator<rocksdb::LRUCache> >::construct<rocksdb::LRUCache, unsigned long&, int&, bool&, double&>(std::allocator<rocksdb::LRUCache>&, rocksdb::LRUCache*, unsigned long&, int&
, bool&, double&) /usr/include/c++/5/bits/alloc_traits.h:530
    #10 0x7f2f50c8422f in std::_Sp_counted_ptr_inplace<rocksdb::LRUCache, std::allocator<rocksdb::LRUCache>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<unsigned long&, int&, bool&, double&>(std::allocator<rocksdb::LRUCache
>, unsigned long&, int&, bool&, double&) /usr/include/c++/5/bits/shared_ptr_base.h:522
    #11 0x7f2f50c8422f in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<rocksdb::LRUCache, std::allocator<rocksdb::LRUCache>, unsigned long&, int&, bool&, double&>(std::_Sp_make_shared_tag, rocksdb::LRUCache*, std:
:allocator<rocksdb::LRUCache> const&, unsigned long&, int&, bool&, double&) /usr/include/c++/5/bits/shared_ptr_base.h:617
    #12 0x7f2f50c8422f in std::__shared_ptr<rocksdb::LRUCache, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<rocksdb::LRUCache>, unsigned long&, int&, bool&, double&>(std::_Sp_make_shared_tag, std::allocator<rocksdb::LRUC
ache> const&, unsigned long&, int&, bool&, double&) /usr/include/c++/5/bits/shared_ptr_base.h:1097
    #13 0x7f2f50c8422f in std::shared_ptr<rocksdb::LRUCache>::shared_ptr<std::allocator<rocksdb::LRUCache>, unsigned long&, int&, bool&, double&>(std::_Sp_make_shared_tag, std::allocator<rocksdb::LRUCache> const&, unsigned long&, in
t&, bool&, double&) /usr/include/c++/5/bits/shared_ptr.h:319
    #14 0x7f2f50c8422f in std::shared_ptr<rocksdb::LRUCache> std::allocate_shared<rocksdb::LRUCache, std::allocator<rocksdb::LRUCache>, unsigned long&, int&, bool&, double&>(std::allocator<rocksdb::LRUCache> const&, unsigned long&,
int&, bool&, double&) /usr/include/c++/5/bits/shared_ptr.h:620
    #15 0x7f2f50c8422f in std::shared_ptr<rocksdb::LRUCache> std::make_shared<rocksdb::LRUCache, unsigned long&, int&, bool&, double&>(unsigned long&, int&, bool&, double&) /usr/include/c++/5/bits/shared_ptr.h:636
    #16 0x7f2f50c8422f in rocksdb::NewLRUCache(unsigned long, int, bool, double) /home/pingcap/workspace/rocksdb/cache/lru_cache.cc:489
    #17 0x7f2f50c8422f in ?? ??:0
    #18 0x5644c90059e3 in crocksdb_cache_create_lru /home/pingcap/workspace/rust-rocksdb/librocksdb_sys/crocksdb/c.cc:2487
    #19 0x5644c90059e3 in ?? ??:0
    #20 0x5644c8fff058 in rocksdb::rocksdb_options::{{impl}}::set_lru_cache /home/pingcap/workspace/rust-rocksdb/src/rocksdb_options.rs:74
    #21 0x5644c8fff058 in ?? ??:0
    #22 0x5644c8f5fc97 in test::test_rocksdb_options::test_get_block_cache_usage /home/pingcap/workspace/rust-rocksdb/tests/test_rocksdb_options.rs:259
    #23 0x5644c8f5fc97 in ?? ??:0
    #24 0x5644c8f79901 in test::run_test::{{closure}} /checkout/src/libtest/lib.rs:1452
    #25 0x5644c8f79901 in core::ops::function::FnOnce::call_once<closure,(())> /checkout/src/libcore/ops/function.rs:143
    #26 0x5644c8f79901 in test::{{impl}}::call_box<(),closure> /checkout/src/libtest/lib.rs:140
    #27 0x5644c8f79901 in ?? ??:0
    #28 0x5644c9044b9c in panic_unwind::__rust_maybe_catch_panic /checkout/src/libpanic_unwind/lib.rs:98
    #29 0x5644c9044b9c in ?? ??:0
    #30 0x5644c8f692dc in std::panicking::try<(),std::panic::AssertUnwindSafe<closure>> /checkout/src/libstd/panicking.rs:433
    #31 0x5644c8f692dc in std::panic::catch_unwind<std::panic::AssertUnwindSafe<closure>,()> /checkout/src/libstd/panic.rs:361
    #32 0x5644c8f692dc in test::run_test::run_test_inner::{{closure}} /checkout/src/libtest/lib.rs:1391
。。。。
Indirect leak of 6408 byte(s) in 1 object(s) allocated from:
    #0 0x5644c8fa249f in operator new[](unsigned long) /checkout/src/compiler-rt/lib/lsan/lsan_interceptors.cc:191 (discriminator 2)
    #1 0x5644c8fa249f in ?? ??:0
    #2 0x7f2f50c84073 in rocksdb::LRUCache::LRUCache(unsigned long, int, bool, double) /home/pingcap/workspace/rocksdb/cache/lru_cache.cc:444 (discriminator 4)
    #3 0x7f2f50c84073 in ?? ??:0
    #4 0x7f2f50c8422f in void __gnu_cxx::new_allocator<rocksdb::LRUCache>::construct<rocksdb::LRUCache, unsigned long&, int&, bool&, double&>(rocksdb::LRUCache*, unsigned long&, int&, bool&, double&) /usr/include/c++/5/ext/new_alloc
ator.h:120
    #5 0x7f2f50c8422f in void std::allocator_traits<std::allocator<rocksdb::LRUCache> >::construct<rocksdb::LRUCache, unsigned long&, int&, bool&, double&>(std::allocator<rocksdb::LRUCache>&, rocksdb::LRUCache*, unsigned long&, int&
, bool&, double&) /usr/include/c++/5/bits/alloc_traits.h:530
    #6 0x7f2f50c8422f in std::_Sp_counted_ptr_inplace<rocksdb::LRUCache, std::allocator<rocksdb::LRUCache>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<unsigned long&, int&, bool&, double&>(std::allocator<rocksdb::LRUCache>
, unsigned long&, int&, bool&, double&) /usr/include/c++/5/bits/shared_ptr_base.h:522
    #7 0x7f2f50c8422f in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<rocksdb::LRUCache, std::allocator<rocksdb::LRUCache>, unsigned long&, int&, bool&, double&>(std::_Sp_make_shared_tag, rocksdb::LRUCache*, std::
allocator<rocksdb::LRUCache> const&, unsigned long&, int&, bool&, double&) /usr/include/c++/5/bits/shared_ptr_base.h:617
    #8 0x7f2f50c8422f in std::__shared_ptr<rocksdb::LRUCache, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<rocksdb::LRUCache>, unsigned long&, int&, bool&, double&>(std::_Sp_make_shared_tag, std::allocator<rocksdb::LRUCa
che> const&, unsigned long&, int&, bool&, double&) /usr/include/c++/5/bits/shared_ptr_base.h:1097
    #9 0x7f2f50c8422f in std::shared_ptr<rocksdb::LRUCache>::shared_ptr<std::allocator<rocksdb::LRUCache>, unsigned long&, int&, bool&, double&>(std::_Sp_make_shared_tag, std::allocator<rocksdb::LRUCache> const&, unsigned long&, int
&, bool&, double&) /usr/include/c++/5/bits/shared_ptr.h:319
    #10 0x7f2f50c8422f in std::shared_ptr<rocksdb::LRUCache> std::allocate_shared<rocksdb::LRUCache, std::allocator<rocksdb::LRUCache>, unsigned long&, int&, bool&, double&>(std::allocator<rocksdb::LRUCache> const&, unsigned long&,
int&, bool&, double&) /usr/include/c++/5/bits/shared_ptr.h:620
    #11 0x7f2f50c8422f in std::shared_ptr<rocksdb::LRUCache> std::make_shared<rocksdb::LRUCache, unsigned long&, int&, bool&, double&>(unsigned long&, int&, bool&, double&) /usr/include/c++/5/bits/shared_ptr.h:636
    #12 0x7f2f50c8422f in rocksdb::NewLRUCache(unsigned long, int, bool, double) /home/pingcap/workspace/rocksdb/cache/lru_cache.cc:489
    #13 0x7f2f50c8422f in ?? ??:0
    #14 0x5644c90059e3 in crocksdb_cache_create_lru /home/pingcap/workspace/rust-rocksdb/librocksdb_sys/crocksdb/c.cc:2487
    #15 0x5644c90059e3 in ?? ??:0
    #16 0x5644c8fff058 in rocksdb::rocksdb_options::{{impl}}::set_lru_cache /home/pingcap/workspace/rust-rocksdb/src/rocksdb_options.rs:74
    #17 0x5644c8fff058 in ?? ??:0
    #18 0x5644c8f5fc97 in test::test_rocksdb_options::test_get_block_cache_usage /home/pingcap/workspace/rust-rocksdb/tests/test_rocksdb_options.rs:259
    #19 0x5644c8f5fc97 in ?? ??:0
    #20 0x5644c8f79901 in test::run_test::{{closure}} /checkout/src/libtest/lib.rs:1452
    #21 0x5644c8f79901 in core::ops::function::FnOnce::call_once<closure,(())> /checkout/src/libcore/ops/function.rs:143
    #22 0x5644c8f79901 in test::{{impl}}::call_box<(),closure> /checkout/src/libtest/lib.rs:140
    #23 0x5644c8f79901 in ?? ??:0
    #24 0x5644c9044b9c in panic_unwind::__rust_maybe_catch_panic /checkout/src/libpanic_unwind/lib.rs:98
    #25 0x5644c9044b9c in ?? ??:0
    #26 0x5644c8f692dc in std::panicking::try<(),std::panic::AssertUnwindSafe<closure>> /checkout/src/libstd/panicking.rs:433
    #27 0x5644c8f692dc in std::panic::catch_unwind<std::panic::AssertUnwindSafe<closure>,()> /checkout/src/libstd/panic.rs:361
    #28 0x5644c8f692dc in test::run_test::run_test_inner::{{closure}} /checkout/src/libtest/lib.rs:1391
    #29 0x5644c8f692dc in std::sys_common::backtrace::__rust_begin_short_backtrace<closure,()> /checkout/src/libstd/sys_common/backtrace.rs:136
    #30 0x5644c8f692dc in ?? ??:0
。。。。。

@andelf
Copy link
Author

andelf commented Jun 27, 2017

This is a memory leak in LRUCache. fixed by #78.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants