Skip to content

LeakSanitizer detects memory leak if CDBWrapper ctor fails #22592

@Crypt-iQ

Description

@Crypt-iQ

While running the functional tests under LSAN and 8 parallel jobs, CDBWrapper ctor would regularly throw via HandleError because of low disk space. This would make LSAN error because the destructor for CDBWrapper was never called and so the options.block_cache and some other parameters wouldn't be destructed.

LSAN output (I deleted the file, but managed to take a picture of it, so log is kind of truncated):

==1204791==ERROR:  LeakSanitizer: detected memory leaks

Direct leak of 3520 byte(s) in 1 object(s) allocated from:
       #0 0x55f632912679 in operator new(unsigned long)
       #1 0x55f6342936d6 in leveldb::NewLRUCache(unsigned long)
       #2 0x55f6335f66f8 in GetOptions(unsigned long)
       #3 0x55f6335f4ec7 in CDBWrapper::CDBWrapper(boost::filesystem::path const&, unsigned long, bool, bool, bool)
       #4 0x55f6332e32cf in std::_MakeUniq<CDBWrapper>::__single_object std::make_unique<CoinsViews ...truncated...
       #5 0x55f6332d2781 in CCoinsViewDB::CCoinsViewDB(boost::filesystem::path, unsigned long, bool, bool)
       #6 0x55f6333ec6e2 in CoinsViews::CoinsViews(std::__cxx11::basic_string<char, std::char_traits<char>, ...truncated...
       #7 0x55f63346a111 in std::_MakeUniq<CoinsViews>::__single_object std::make_unique<CoinsViews, ...truncated...
       #8 0x55f6333ed379 in CChainState::InitCoinsDB(unsigned long, bool, bool, std::__cxx11::basic_string ...truncated...
       #9 0x55f6329699e0 in AppInitMain(NodeContext&, interfaces::BlockAndHeaderTipInfo*)
       #10 0x55f63291868e in AppInit(NodeContext&, int, char**)
       #11 0x55f632915e2f in main
       #12 0x7f86b6f7fb24 in __libc_start_main

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions