morganstanley / binlog

A high performance C++ log library, producing structured binary logs
http://opensource.morganstanley.com/binlog/
Apache License 2.0
608 stars 72 forks source link

Memory Leak when calling std::exit #159

Open andrewkcorcoran opened 1 year ago

andrewkcorcoran commented 1 year ago

Getting the below ASAN error on e94cccc when calling std::exit

==88696==Running thread 88690 was not suspended. False leaks are possible.
[  DEATH   ]
=================================================================
==88695==ERROR: LeakSanitizer: detected memory leaks
[  DEATH   ]
Direct leak of 8192 byte(s) in 1 object(s) allocated from:
    #0 0x80456f7 in operator new[](unsigned long) (/build/source/snip/test/snip_unittests+0x80456f7)
    #1 0x7fb01fc811ab in std::basic_filebuf<char, std::char_traits<char> >::_M_allocate_internal_buffer() (/usr/lib64/libstdc++.so.6+0xb71ab)
[  DEATH   ]
Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x8045587 in operator new(unsigned long) (/build/source/snip/test/snip_unittests+0x8045587)
    #1 0x87392cd in __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<binlog::Session::Channel, std::allocator<binlog::Session::Channel>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*) /include/c++/11/ext/new_allocator.h:127:27
    #2 0x873910d in std::allocator<std::_Sp_counted_ptr_inplace<binlog::Session::Channel, std::allocator<binlog::Session::Channel>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long) /include/c++/11/bits/allocator.h:197:32
    #3 0x873910d in std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<binlog::Session::Channel, std::allocator<binlog::Session::Channel>, (__gnu_cxx::_Lock_policy)2> > >::allocate(std::allocator<std::_Sp_counted_ptr_inplace<binlog::Session::Channel, std::allocator<binlog::Session::Channel>, (__gnu_cxx::_Lock_policy)2> >&, unsigned long) /include/c++/11/bits/alloc_traits.h:460:20
    #4 0x87386da in std::__allocated_ptr<std::allocator<std::_Sp_counted_ptr_inplace<binlog::Session::Channel, std::allocator<binlog::Session::Channel>, (__gnu_cxx::_Lock_policy)2> > > std::__allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<binlog::Session::Channel, std::allocator<binlog::Session::Channel>, (__gnu_cxx::_Lock_policy)2> > >(std::allocator<std::_Sp_counted_ptr_inplace<binlog::Session::Channel, std::allocator<binlog::Session::Channel>, (__gnu_cxx::_Lock_policy)2> >&) /include/c++/11/bits/allocated_ptr.h:97:21
    #5 0x8738028 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<binlog::Session::Channel, std::allocator<binlog::Session::Channel>, binlog::Session&, unsigned long&, binlog::WriterProp>(binlog::Session::Channel*&, std::_Sp_alloc_shared_tag<std::allocator<binlog::Session::Channel> >, binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/shared_ptr_base.h:648:19
    #6 0x8737d0e in std::__shared_ptr<binlog::Session::Channel, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<binlog::Session::Channel>, binlog::Session&, unsigned long&, binlog::WriterProp>(std::_Sp_alloc_shared_tag<std::allocator<binlog::Session::Channel> >, binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/shared_ptr_base.h:1342:14
    #7 0x87378f2 in std::shared_ptr<binlog::Session::Channel>::shared_ptr<std::allocator<binlog::Session::Channel>, binlog::Session&, unsigned long&, binlog::WriterProp>(std::_Sp_alloc_shared_tag<std::allocator<binlog::Session::Channel> >, binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/shared_ptr.h:409:4
    #8 0x87373ad in std::shared_ptr<binlog::Session::Channel> std::allocate_shared<binlog::Session::Channel, std::allocator<binlog::Session::Channel>, binlog::Session&, unsigned long&, binlog::WriterProp>(std::allocator<binlog::Session::Channel> const&, binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/shared_ptr.h:862:14
    #9 0x873288d in std::shared_ptr<binlog::Session::Channel> std::make_shared<binlog::Session::Channel, binlog::Session&, unsigned long&, binlog::WriterProp>(binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/shared_ptr.h:878:14
    #10 0x87319b1 in binlog::Session::createChannel(unsigned long, binlog::WriterProp) /build/_deps/binlog-src/include/binlog/Session.hpp:260:23
    #11 0x8727725 in binlog::SessionWriter::SessionWriter(binlog::Session&, unsigned long, unsigned long, std::string) /build/_deps/binlog-src/include/binlog/SessionWriter.hpp:125:21
    #12 0x871d6ac in binlog::default_thread_local_writer() /build/_deps/binlog-src/include/binlog/default_session.hpp:57:37
    #13 0xc92a893 in utils::Threading::SetName(std::string const&) /build/../../source/utils/src/threading.cpp:121:5
    #14 0xc8ebe1a in void utils::Threading::RunThread<void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool>(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&) /build/../../source/utils/include/utils/threading_ipp.hpp:43:9
    #15 0xc8f1832 in void std::__invoke_impl<void, void (*)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string, std::shared_ptr<utils::IExceptionHandler>, void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool>(std::__invoke_other, void (*&&)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string&&, std::shared_ptr<utils::IExceptionHandler>&&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&) /include/c++/11/bits/invoke.h:61:14
    #16 0xc8f0cd3 in std::__invoke_result<void (*)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string, std::shared_ptr<utils::IExceptionHandler>, void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool>::type std::__invoke<void (*)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string, std::shared_ptr<utils::IExceptionHandler>, void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool>(void (*&&)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string&&, std::shared_ptr<utils::IExceptionHandler>&&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&) /include/c++/11/bits/invoke.h:96:14
    #17 0xc8f0935 in void std::thread::_Invoker<std::tuple<void (*)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string, std::shared_ptr<utils::IExceptionHandler>, void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool> >::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul>) /include/c++/11/bits/std_thread.h:253:13
    #18 0xc8f03eb in std::thread::_Invoker<std::tuple<void (*)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string, std::shared_ptr<utils::IExceptionHandler>, void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool> >::operator()() /include/c++/11/bits/std_thread.h:260:11
    #19 0xc8ee39e in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string, std::shared_ptr<utils::IExceptionHandler>, void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool> > >::_M_run() /include/c++/11/bits/std_thread.h:211:13
    #20 0x7fb02036fb73 in execute_native_thread_routine thread48.o
[  DEATH   ]
Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x804585f in operator new(unsigned long, std::nothrow_t const&) (/build/source/snip/test/snip_unittests+0x804585f)
    #1 0x7fb01fc26f1d in __cxa_thread_atexit (/usr/lib64/libstdc++.so.6+0x5cf1d)
[  DEATH   ]
Indirect leak of 1048632 byte(s) in 1 object(s) allocated from:
    #0 0x80456f7 in operator new[](unsigned long) (/build/source/snip/test/snip_unittests+0x80456f7)
    #1 0x873a649 in binlog::Session::Channel::Channel(binlog::Session&, unsigned long, binlog::WriterProp) /build/_deps/binlog-src/include/binlog/Session.hpp:212:11
    #2 0x873a1fc in decltype(new ((void*)(0))binlog::Session::Channel(std::declval<binlog::Session&>(), std::declval<unsigned long&>(), std::declval<binlog::WriterProp>())) std::construct_at<binlog::Session::Channel, binlog::Session&, unsigned long&, binlog::WriterProp>(binlog::Session::Channel*, binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/stl_construct.h:97:39
    #3 0x8739612 in void std::allocator_traits<std::allocator<binlog::Session::Channel> >::construct<binlog::Session::Channel, binlog::Session&, unsigned long&, binlog::WriterProp>(std::allocator<binlog::Session::Channel>&, binlog::Session::Channel*, binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/alloc_traits.h:514:4
    #4 0x8738c93 in std::_Sp_counted_ptr_inplace<binlog::Session::Channel, std::allocator<binlog::Session::Channel>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<binlog::Session&, unsigned long&, binlog::WriterProp>(std::allocator<binlog::Session::Channel>, binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/shared_ptr_base.h:519:4
    #5 0x8738280 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<binlog::Session::Channel, std::allocator<binlog::Session::Channel>, binlog::Session&, unsigned long&, binlog::WriterProp>(binlog::Session::Channel*&, std::_Sp_alloc_shared_tag<std::allocator<binlog::Session::Channel> >, binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/shared_ptr_base.h:651:6
    #6 0x8737d0e in std::__shared_ptr<binlog::Session::Channel, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<binlog::Session::Channel>, binlog::Session&, unsigned long&, binlog::WriterProp>(std::_Sp_alloc_shared_tag<std::allocator<binlog::Session::Channel> >, binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/shared_ptr_base.h:1342:14
    #7 0x87378f2 in std::shared_ptr<binlog::Session::Channel>::shared_ptr<std::allocator<binlog::Session::Channel>, binlog::Session&, unsigned long&, binlog::WriterProp>(std::_Sp_alloc_shared_tag<std::allocator<binlog::Session::Channel> >, binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/shared_ptr.h:409:4
    #8 0x87373ad in std::shared_ptr<binlog::Session::Channel> std::allocate_shared<binlog::Session::Channel, std::allocator<binlog::Session::Channel>, binlog::Session&, unsigned long&, binlog::WriterProp>(std::allocator<binlog::Session::Channel> const&, binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/shared_ptr.h:862:14
    #9 0x873288d in std::shared_ptr<binlog::Session::Channel> std::make_shared<binlog::Session::Channel, binlog::Session&, unsigned long&, binlog::WriterProp>(binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/shared_ptr.h:878:14
    #10 0x87319b1 in binlog::Session::createChannel(unsigned long, binlog::WriterProp) /build/_deps/binlog-src/include/binlog/Session.hpp:260:23
    #11 0x8727725 in binlog::SessionWriter::SessionWriter(binlog::Session&, unsigned long, unsigned long, std::string) /build/_deps/binlog-src/include/binlog/SessionWriter.hpp:125:21
    #12 0x871d6ac in binlog::default_thread_local_writer() /build/_deps/binlog-src/include/binlog/default_session.hpp:57:37
    #13 0xc92a893 in utils::Threading::SetName(std::string const&) /build/../../source/utils/src/threading.cpp:121:5
    #14 0xc8ebe1a in void utils::Threading::RunThread<void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool>(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&) /build/../../source/utils/include/utils/threading_ipp.hpp:43:9
    #15 0xc8f1832 in void std::__invoke_impl<void, void (*)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string, std::shared_ptr<utils::IExceptionHandler>, void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool>(std::__invoke_other, void (*&&)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string&&, std::shared_ptr<utils::IExceptionHandler>&&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&) /include/c++/11/bits/invoke.h:61:14
    #16 0xc8f0cd3 in std::__invoke_result<void (*)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string, std::shared_ptr<utils::IExceptionHandler>, void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool>::type std::__invoke<void (*)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string, std::shared_ptr<utils::IExceptionHandler>, void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool>(void (*&&)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string&&, std::shared_ptr<utils::IExceptionHandler>&&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&) /include/c++/11/bits/invoke.h:96:14
    #17 0xc8f0935 in void std::thread::_Invoker<std::tuple<void (*)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string, std::shared_ptr<utils::IExceptionHandler>, void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool> >::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul>) /include/c++/11/bits/std_thread.h:253:13
    #18 0xc8f03eb in std::thread::_Invoker<std::tuple<void (*)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string, std::shared_ptr<utils::IExceptionHandler>, void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool> >::operator()() /include/c++/11/bits/std_thread.h:260:11
    #19 0xc8ee39e in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string, std::shared_ptr<utils::IExceptionHandler>, void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool> > >::_M_run() /include/c++/11/bits/std_thread.h:211:13
    #20 0x7fb02036fb73 in execute_native_thread_routine thread48.o
[  DEATH   ]
Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x804585f in operator new(unsigned long, std::nothrow_t const&) (/build/source/snip/test/snip_unittests+0x804585f)
    #1 0x7fb01fc26f1d in __cxa_thread_atexit (/usr/lib64/libstdc++.so.6+0x5cf1d)
[  DEATH   ]
Indirect leak of 1048632 byte(s) in 1 object(s) allocated from:
    #0 0x80456f7 in operator new[](unsigned long) (/build/source/snip/test/snip_unittests+0x80456f7)
    #1 0x873a649 in binlog::Session::Channel::Channel(binlog::Session&, unsigned long, binlog::WriterProp) /build/_deps/binlog-src/include/binlog/Session.hpp:212:11
    #2 0x873a1fc in decltype(new ((void*)(0))binlog::Session::Channel(std::declval<binlog::Session&>(), std::declval<unsigned long&>(), std::declval<binlog::WriterProp>())) std::construct_at<binlog::Session::Channel, binlog::Session&, unsigned long&, binlog::WriterProp>(binlog::Session::Channel*, binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/stl_construct.h:97:39
    #3 0x8739612 in void std::allocator_traits<std::allocator<binlog::Session::Channel> >::construct<binlog::Session::Channel, binlog::Session&, unsigned long&, binlog::WriterProp>(std::allocator<binlog::Session::Channel>&, binlog::Session::Channel*, binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/alloc_traits.h:514:4
    #4 0x8738c93 in std::_Sp_counted_ptr_inplace<binlog::Session::Channel, std::allocator<binlog::Session::Channel>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<binlog::Session&, unsigned long&, binlog::WriterProp>(std::allocator<binlog::Session::Channel>, binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/shared_ptr_base.h:519:4
    #5 0x8738280 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<binlog::Session::Channel, std::allocator<binlog::Session::Channel>, binlog::Session&, unsigned long&, binlog::WriterProp>(binlog::Session::Channel*&, std::_Sp_alloc_shared_tag<std::allocator<binlog::Session::Channel> >, binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/shared_ptr_base.h:651:6
    #6 0x8737d0e in std::__shared_ptr<binlog::Session::Channel, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<binlog::Session::Channel>, binlog::Session&, unsigned long&, binlog::WriterProp>(std::_Sp_alloc_shared_tag<std::allocator<binlog::Session::Channel> >, binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/shared_ptr_base.h:1342:14
    #7 0x87378f2 in std::shared_ptr<binlog::Session::Channel>::shared_ptr<std::allocator<binlog::Session::Channel>, binlog::Session&, unsigned long&, binlog::WriterProp>(std::_Sp_alloc_shared_tag<std::allocator<binlog::Session::Channel> >, binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/shared_ptr.h:409:4
    #8 0x87373ad in std::shared_ptr<binlog::Session::Channel> std::allocate_shared<binlog::Session::Channel, std::allocator<binlog::Session::Channel>, binlog::Session&, unsigned long&, binlog::WriterProp>(std::allocator<binlog::Session::Channel> const&, binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/shared_ptr.h:862:14
    #9 0x873288d in std::shared_ptr<binlog::Session::Channel> std::make_shared<binlog::Session::Channel, binlog::Session&, unsigned long&, binlog::WriterProp>(binlog::Session&, unsigned long&, binlog::WriterProp&&) /include/c++/11/bits/shared_ptr.h:878:14
    #10 0x87319b1 in binlog::Session::createChannel(unsigned long, binlog::WriterProp) /build/_deps/binlog-src/include/binlog/Session.hpp:260:23
    #11 0x8727725 in binlog::SessionWriter::SessionWriter(binlog::Session&, unsigned long, unsigned long, std::string) /build/_deps/binlog-src/include/binlog/SessionWriter.hpp:125:21
    #12 0x871d6ac in binlog::default_thread_local_writer() /build/_deps/binlog-src/include/binlog/default_session.hpp:57:37
    #13 0xc92a893 in utils::Threading::SetName(std::string const&) /build/../../source/utils/src/threading.cpp:121:5
    #14 0xc8ebe1a in void utils::Threading::RunThread<void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool>(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&) /build/../../source/utils/include/utils/threading_ipp.hpp:43:9
    #15 0xc8f1832 in void std::__invoke_impl<void, void (*)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string, std::shared_ptr<utils::IExceptionHandler>, void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool>(std::__invoke_other, void (*&&)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string&&, std::shared_ptr<utils::IExceptionHandler>&&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&) /include/c++/11/bits/invoke.h:61:14
    #16 0xc8f0cd3 in std::__invoke_result<void (*)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string, std::shared_ptr<utils::IExceptionHandler>, void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool>::type std::__invoke<void (*)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string, std::shared_ptr<utils::IExceptionHandler>, void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool>(void (*&&)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string&&, std::shared_ptr<utils::IExceptionHandler>&&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&) /include/c++/11/bits/invoke.h:96:14
    #17 0xc8f0935 in void std::thread::_Invoker<std::tuple<void (*)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string, std::shared_ptr<utils::IExceptionHandler>, void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool> >::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul>) /include/c++/11/bits/std_thread.h:253:13
    #18 0xc8f03eb in std::thread::_Invoker<std::tuple<void (*)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string, std::shared_ptr<utils::IExceptionHandler>, void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool> >::operator()() /include/c++/11/bits/std_thread.h:260:11
    #19 0xc8ee39e in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(std::string const&, std::shared_ptr<utils::IExceptionHandler> const&, void (utils::BinlogConsumeThread::*&&)(std::string const&, bool), utils::BinlogConsumeThread*&&, std::string&&, bool&&), std::string, std::shared_ptr<utils::IExceptionHandler>, void (utils::BinlogConsumeThread::*)(std::string const&, bool), utils::BinlogConsumeThread*, std::string, bool> > >::_M_run() /include/c++/11/bits/std_thread.h:211:13
    #20 0x7fb02036fb73 in execute_native_thread_routine thread48.o
[  DEATH   ]
SUMMARY: AddressSanitizer: 1056896 byte(s) leaked in 4 allocation(s).
erenon commented 1 year ago

Can you provide a repro? Simply adding std::exit to test/integration/Logging.cpp doesn't trigger it:

  binlog::consume(std::cout);

  std::exit(0);

  return 0;
andrewkcorcoran commented 1 year ago

I think the above is all we will have to go on. The issue was 100% reproducible for one particular build / test but I couldn't reproduce with a minimal example either and unfortunately I no longer have access to that setup anymore. It's certainly possible this was a bug in our code but the error trace above does point pretty strongly towards binlog.