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

Minor fix for init files and cleaned up spec file. Please pull #5

Merged
merged 2 commits into from Dec 16, 2011
Merged

Minor fix for init files and cleaned up spec file. Please pull #5

merged 2 commits into from Dec 16, 2011

Conversation

homac
Copy link
Contributor

@homac homac commented Dec 15, 2011

No description provided.

Don't use runlevel 4 in init scripts. AFAIK, no distribution is using it
and at least the Open Build Service complains about it.

Signed-off-by: Holger Macht <hmacht@suse.de>
…ibutions

Clean up and fix the spec file. This includes cleaning up of build and
installed system dependencies, LSB compliance fixes, splitting up into
several sub-packages (lib*) and so on. It now builds fine for the
following distributions in the Open Build Service and should be
considered as a starting point for further fixes:

 - CentOS 6
 - Fedora 15
 - RedHat Enterprise Linux 6
 - openSUSE 11.4
 - openSUSE 12.1
 - openSUSE Factory
 - SUSE Linux Enterprise 11 (SP1 and SP2)

Signed-off-by: Holger Macht <hmacht@suse.de>
liewegas added a commit that referenced this pull request Dec 16, 2011
Minor fix for init files and cleaned up spec file. Please pull
@liewegas liewegas merged commit 92cb2a2 into ceph:master Dec 16, 2011
liewegas pushed a commit that referenced this pull request Nov 18, 2012
Before the mon, and lockdep, in particular.

#0  __pthread_mutex_lock (mutex=0x30) at pthread_mutex_lock.c:50
#1  0x0000000000816092 in ceph::log::Log::submit_entry (this=0x0, e=0x2f4a270) at log/Log.cc:138
#2  0x00000000007ee0f8 in handle_fatal_signal (signum=11) at global/signal_handler.cc:100
#3  <signal handler called>
#4  0x00000000008e1300 in lockdep_will_lock (name=0x959aa7 "SignalHandler::lock", id=17) at common/lockdep.cc:163
#5  0x00000000008867fc in Mutex::_will_lock (this=0x2f20428) at ./common/Mutex.h:56
#6  0x0000000000886605 in Mutex::Lock (this=0x2f20428, no_lockdep=false) at common/Mutex.cc:81
#7  0x00000000007eeb95 in SignalHandler::entry (this=0x2f20300) at global/signal_handler.cc:198
#8  0x00000000008b0bd1 in Thread::_entry_func (arg=0x2f20300) at common/Thread.cc:43
#9  0x00007f36fefd6b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#10 0x00007f36fd80b6dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#11 0x0000000000000000 in ?? ()

#0  0x00007f36fefd7e75 in pthread_join (threadid=139874129766144, thread_return=0x0) at pthread_join.c:89
#1  0x00000000008b11ec in Thread::join (this=0x2f20300, prval=0x0) at common/Thread.cc:130
#2  0x00000000007eeae7 in SignalHandler::shutdown (this=0x2f20300) at global/signal_handler.cc:186
#3  0x00000000007ee9cf in SignalHandler::~SignalHandler (this=0x2f20300, __in_chrg=<optimized out>) at global/signal_handler.cc:175
#4  0x00000000007eea58 in SignalHandler::~SignalHandler (this=0x2f20300, __in_chrg=<optimized out>) at global/signal_handler.cc:176
#5  0x00000000007ee643 in shutdown_async_signal_handler () at global/signal_handler.cc:324
#6  0x00000000006de9d2 in main (argc=7, argv=0x7fffbfb8a1e8) at ceph_mon.cc:439

Signed-off-by: Sage Weil <sage@inktank.com>
dalgaaf added a commit to dalgaaf/ceph that referenced this pull request May 13, 2013
CID 727984 (ceph#5 of 5): Resource leak (RESOURCE_LEAK)
  leaked_storage: Variable "cb_args" going out of scope leaks the storage
  it points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
dalgaaf added a commit to dalgaaf/ceph that referenced this pull request May 14, 2013
CID 727984 (ceph#5 of 5): Resource leak (RESOURCE_LEAK)
  leaked_storage: Variable "cb_args" going out of scope leaks the storage
  it points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
dalgaaf added a commit to dalgaaf/ceph that referenced this pull request May 14, 2013
CID 727984 (ceph#5 of 5): Resource leak (RESOURCE_LEAK)
  leaked_storage: Variable "cb_args" going out of scope leaks the storage
  it points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
dalgaaf added a commit to dalgaaf/ceph that referenced this pull request Jul 26, 2013
Fixes for:

CID 1054838 (ceph#14 of 14): Resource leak (RESOURCE_LEAK)
  leaked_storage: Variable "rop" going out of scope leaks the
  storage it points to.

CID 1054836 (ceph#5 of 5): Resource leak (RESOURCE_LEAK)
  leaked_storage: Variable "rop" going out of scope leaks the
  storage it points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
dalgaaf added a commit to dalgaaf/ceph that referenced this pull request Jul 26, 2013
Fixes for:

CID 1054838 (ceph#14 of 14): Resource leak (RESOURCE_LEAK)
  leaked_storage: Variable "rop" going out of scope leaks the
  storage it points to.

CID 1054836 (ceph#5 of 5): Resource leak (RESOURCE_LEAK)
  leaked_storage: Variable "rop" going out of scope leaks the
  storage it points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
dalgaaf added a commit that referenced this pull request Mar 1, 2014
CID 1160833 (#3 of 3): Resource leak (RESOURCE_LEAK)
 leaked_storage: Variable "ioctx" going out of scope leaks the storage
 it points to

CID 1160835 (#3 of 3): Resource leak (RESOURCE_LEAK)
 leaked_storage: Variable "ioctx" going out of scope leaks the storage
 it points to.

CID 1188156 (#5 of 5): Resource leak (RESOURCE_LEAK)
 leaked_storage: Variable "ioctx" going out of scope leaks the storage
 it points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
dalgaaf added a commit that referenced this pull request Mar 13, 2014
CID 966624 (#5 of 5): Resource leak (RESOURCE_LEAK)
 17. leaked_storage: Variable "cmount" going out of scope leaks the
 storage it points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
liewegas added a commit that referenced this pull request Sep 15, 2014
The C_CancelOp path assumes op->session != NULL.  Cancel that op before
we clear it.  This fixes a crash like

#0  pthread_rwlock_wrlock () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S:39
#1  0x00007fc82690a4b1 in RWLock::get_write (this=0x18, lockdep=<optimized out>) at ./common/RWLock.h:88
#2  0x00007fc8268f4d79 in Objecter::op_cancel (this=0x1f61830, s=0x0, tid=0, r=-110) at osdc/Objecter.cc:1850
#3  0x00007fc8268ba449 in Context::complete (this=0x1f68c20, r=<optimized out>) at ./include/Context.h:64
#4  0x00007fc8269769aa in RWTimer::timer_thread (this=0x1f61950) at common/Timer.cc:268
#5  0x00007fc82697a85d in RWTimerThread::entry (this=<optimized out>) at common/Timer.cc:200
#6  0x00007fc82651ce9a in start_thread (arg=0x7fc7e3fff700) at pthread_create.c:308

Signed-off-by: Sage Weil <sage@redhat.com>
liewegas added a commit that referenced this pull request Nov 7, 2015
os/osd: disable extra iterator validation
chamdoo pushed a commit to chamdoo/ceph that referenced this pull request Nov 13, 2015
…ocks.

Summary:
SizeBeingCompacted was called without any lock protection. This causes
crashes, especially when running db_bench with value_size=128K.
The fix is to compute SizeUnderCompaction while holding the mutex and
passing in these values into the call to Finalize.

(gdb) where
ceph#4  leveldb::VersionSet::SizeBeingCompacted (this=this@entry=0x7f0b490931c0, level=level@entry=4) at db/version_set.cc:1827
ceph#5  0x000000000043a3c8 in leveldb::VersionSet::Finalize (this=this@entry=0x7f0b490931c0, v=v@entry=0x7f0b3b86b480) at db/version_set.cc:1420
ceph#6  0x00000000004418d1 in leveldb::VersionSet::LogAndApply (this=0x7f0b490931c0, edit=0x7f0b3dc8c200, mu=0x7f0b490835b0, new_descriptor_log=<optimized out>) at db/version_set.cc:1016
ceph#7  0x00000000004222b2 in leveldb::DBImpl::InstallCompactionResults (this=this@entry=0x7f0b49083400, compact=compact@entry=0x7f0b2b8330f0) at db/db_impl.cc:1473
ceph#8  0x0000000000426027 in leveldb::DBImpl::DoCompactionWork (this=this@entry=0x7f0b49083400, compact=compact@entry=0x7f0b2b8330f0) at db/db_impl.cc:1757
ceph#9  0x0000000000426690 in leveldb::DBImpl::BackgroundCompaction (this=this@entry=0x7f0b49083400, madeProgress=madeProgress@entry=0x7f0b41bf2d1e, deletion_state=...) at db/db_impl.cc:1268
ceph#10 0x0000000000428f42 in leveldb::DBImpl::BackgroundCall (this=0x7f0b49083400) at db/db_impl.cc:1170
ceph#11 0x000000000045348e in BGThread (this=0x7f0b49023100) at util/env_posix.cc:941
ceph#12 leveldb::(anonymous namespace)::PosixEnv::BGThreadWrapper (arg=0x7f0b49023100) at util/env_posix.cc:874
ceph#13 0x00007f0b4a7cf10d in start_thread (arg=0x7f0b41bf3700) at pthread_create.c:301
ceph#14 0x00007f0b49b4b11d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Test Plan:
make check

I am running db_bench with a value size of 128K to see if the segfault is fixed.

Reviewers: MarkCallaghan, sheki, emayanke

Reviewed By: sheki

CC: leveldb

Differential Revision: https://reviews.facebook.net/D9279
chamdoo pushed a commit to chamdoo/ceph that referenced this pull request Nov 13, 2015
chamdoo pushed a commit to chamdoo/ceph that referenced this pull request Nov 13, 2015
Summary:
Now this gives us the real deal stack trace:

    Assertion failed: (false), function GetProperty, file db/db_impl.cc, line 4072.
    Received signal 6 (Abort trap: 6)
    #0   0x7fff57ce39b9
    ceph#1   abort (in libsystem_c.dylib) + 125
    ceph#2   basename (in libsystem_c.dylib) + 0
    ceph#3   rocksdb::DBImpl::GetProperty(rocksdb::ColumnFamilyHandle*, rocksdb::Slice const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) (in db_test) (db_impl.cc:4072)
    ceph#4   rocksdb::_Test_Empty::_Run() (in db_test) (testharness.h:68)
    ceph#5   rocksdb::_Test_Empty::_RunIt() (in db_test) (db_test.cc:1005)
    ceph#6   rocksdb::test::RunAllTests() (in db_test) (testharness.cc:60)
    ceph#7   main (in db_test) (db_test.cc:6697)
    ceph#8   start (in libdyld.dylib) + 1

Test Plan: added artificial assert, saw great stack trace

Reviewers: haobo, dhruba, ljin

Reviewed By: haobo

CC: leveldb

Differential Revision: https://reviews.facebook.net/D18309
mathslinux added a commit to mathslinux/ceph that referenced this pull request Jan 15, 2016
…-user-cannot-determin-existing-user

rgw: admin ops create user API can not determine existing user
XinzeChi pushed a commit to XinzeChi/ceph that referenced this pull request Jan 29, 2016
add ceph license serial number

Reviewed-by: Haomai Wang <haomai@xsky.com>
runsisi added a commit to runsisi/ceph that referenced this pull request Oct 24, 2016
…er instance

the caller needs to check the nullity of the parameter before calling
PK11_FreeSymKey or PK11_FreeSlot, otherwise if CryptoAESKeyHandler::init
failed, we will hit a segfault as follows:
  #0  0x00007f76844f5a95 in PK11_FreeSymKey () from /lib64/libnss3.so
  ceph#1  0x00007f76586b6e49 in CryptoAESKeyHandler::~CryptoAESKeyHandler() () from /lib64/librados.so.2
  ceph#2  0x00007f76586b5eea in CryptoAES::get_key_handler(ceph::buffer::ptr const&, std::string&) () from /lib64/librados.so.2
  ceph#3  0x00007f76586b4b9c in CryptoKey::_set_secret(int, ceph::buffer::ptr const&) () from /lib64/librados.so.2
  ceph#4  0x00007f76586b4e95 in CryptoKey::decode(ceph::buffer::list::iterator&) () from /lib64/librados.so.2
  ceph#5  0x00007f76586b7ee6 in KeyRing::set_modifier(char const*, char const*, EntityName&, std::map<std::string, ceph::buffer::list, std::less<std::string>, std::allocator<std::pair<std::string const, ceph::buffer::list> > >&) () from /lib64/librados.so.2
  ceph#6  0x00007f76586b8882 in KeyRing::decode_plaintext(ceph::buffer::list::iterator&) () from /lib64/librados.so.2
  ceph#7  0x00007f76586b9803 in KeyRing::decode(ceph::buffer::list::iterator&) () from /lib64/librados.so.2
  ceph#8  0x00007f76586b9a1f in KeyRing::load(CephContext*, std::string const&) () from /lib64/librados.so.2
  ceph#9  0x00007f76586ba04b in KeyRing::from_ceph_context(CephContext*) () from /lib64/librados.so.2
  ceph#10 0x00007f765852d0cd in MonClient::init() () from /lib64/librados.so.2
  ceph#11 0x00007f76583c15f5 in librados::RadosClient::connect() () from /lib64/librados.so.2
  ceph#12 0x00007f765838cb1c in rados_connect () from /lib64/librados.so.2
  ...

Signed-off-by: runsisi <runsisi@zte.com.cn>
runsisi pushed a commit to runsisi/ceph that referenced this pull request Oct 26, 2016
we have to shutdown the hunting timer and reset cur_con at the same place,
or the hunting timer may set cur_con before it get shutdown, which results
segfault as follows:

  #0  0x00007fb09ffca989 in raise () from /lib64/libc.so.6
  ceph#1  0x00007fb09ffcc098 in abort () from /lib64/libc.so.6
  ceph#2  0x00007fb08ea52677 in ceph::__ceph_assert_fail(char const*, char const*, int, char const*) () from /lib64/librados.so.2
  ceph#3  0x00007fb08e93144c in ceph::log::SubsystemMap::should_gather(unsigned int, int) [clone .part.120] () from /lib64/librados.so.2
  ceph#4  0x00007fb08e97eb15 in RefCountedObject::put() () from /lib64/librados.so.2
  ceph#5  0x00007fb08eae3f9e in MonClient::~MonClient() () from /lib64/librados.so.2
  ceph#6  0x00007fb08e97c2d5 in librados::RadosClient::~RadosClient() () from /lib64/librados.so.2
  ceph#7  0x00007fb08e97c319 in librados::RadosClient::~RadosClient() () from /lib64/librados.so.2
  ceph#8  0x00007fb08e94684a in rados_shutdown () from /lib64/librados.so.2
  ceph#9  0x00007fb098074210 in __pyx_pw_5rados_5Rados_7shutdown () from /usr/lib64/python2.7/site-packages/rados.so
  ...

Signed-off-by: runsisi <runsisi@zte.com.cn>
tchaikov pushed a commit that referenced this pull request Oct 28, 2016
…er instance

the caller needs to check the nullity of the parameter before calling
PK11_FreeSymKey or PK11_FreeSlot, otherwise if CryptoAESKeyHandler::init
failed, we will hit a segfault as follows:
  #0  0x00007f76844f5a95 in PK11_FreeSymKey () from /lib64/libnss3.so
  #1  0x00007f76586b6e49 in CryptoAESKeyHandler::~CryptoAESKeyHandler() () from /lib64/librados.so.2
  #2  0x00007f76586b5eea in CryptoAES::get_key_handler(ceph::buffer::ptr const&, std::string&) () from /lib64/librados.so.2
  #3  0x00007f76586b4b9c in CryptoKey::_set_secret(int, ceph::buffer::ptr const&) () from /lib64/librados.so.2
  #4  0x00007f76586b4e95 in CryptoKey::decode(ceph::buffer::list::iterator&) () from /lib64/librados.so.2
  #5  0x00007f76586b7ee6 in KeyRing::set_modifier(char const*, char const*, EntityName&, std::map<std::string, ceph::buffer::list, std::less<std::string>, std::allocator<std::pair<std::string const, ceph::buffer::list> > >&) () from /lib64/librados.so.2
  #6  0x00007f76586b8882 in KeyRing::decode_plaintext(ceph::buffer::list::iterator&) () from /lib64/librados.so.2
  #7  0x00007f76586b9803 in KeyRing::decode(ceph::buffer::list::iterator&) () from /lib64/librados.so.2
  #8  0x00007f76586b9a1f in KeyRing::load(CephContext*, std::string const&) () from /lib64/librados.so.2
  #9  0x00007f76586ba04b in KeyRing::from_ceph_context(CephContext*) () from /lib64/librados.so.2
  #10 0x00007f765852d0cd in MonClient::init() () from /lib64/librados.so.2
  #11 0x00007f76583c15f5 in librados::RadosClient::connect() () from /lib64/librados.so.2
  #12 0x00007f765838cb1c in rados_connect () from /lib64/librados.so.2
  ...

Signed-off-by: runsisi <runsisi@zte.com.cn>
tchaikov added a commit that referenced this pull request Mar 27, 2024
LeakSanitizer reports
```
==688591==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 45 byte(s) in 1 object(s) allocated from:
    #0 0x55f8dd9969dd in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_fastbmap_allocator+0x1f89dd) (BuildId: cac39eac8ef1e8774f9dd48e6e3f677fdd864776)
    #1 0x55f8dd99c730 in __gnu_cxx::new_allocator<char>::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/ext/new_allocator.h:127:27
    #2 0x55f8dd99c690 in std::allocator<char>::allocate(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/allocator.h:185:32
    #3 0x55f8dd99c690 in std::allocator_traits<std::allocator<char> >::allocate(std::allocator<char>&, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/alloc_traits.h:464:20
    #4 0x55f8dd99c393 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.tcc:153:14
    #5 0x55f8dda96a6c in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.tcc:307:21
    #6 0x55f8dda96852 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.tcc:395:8
    #7 0x7f4a751ab6f0 in
    MallocExtension::Initialize() (/lib/x86_64-linux-gnu/libtcmalloc.so.4+0x2a6f0) (BuildId:
    eeef3d1257388a806e122398dbce3157ee568ef4)
```

this is a global object allocated by the allocator, so we can suppress this report.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
tchaikov added a commit that referenced this pull request Mar 29, 2024
before this change, we increment the refcount when constructing
`cct` instrusive_ptr, but nobody owns this smart pointer. also,
`CephContext` 's constructor set its refcount to 1. so, when the
test finishes, the refcount is 1, and this leads to a leakage of
the `CephContext` instance. and LeakSanitizer points this out:
```
Indirect leak of 10880000 byte(s) in 1 object(s) allocated from:
    #0 0x558d341d837d in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_ipaddr+0x19b37d) (BuildId: 1b7e7e5abfc2b58ce2334712e4c00b2441c25870)
    #1 0x7fd74c957559 in __gnu_cxx::new_allocator<ceph::logging::ConcreteEntry>::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/ext/new_allocator.h:127:27
    #2 0x7fd74c956933 in std::allocator<ceph::logging::ConcreteEntry>::allocate(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/allocator.h:185:32
    #3 0x7fd74c956933 in boost::circular_buffer<ceph::logging::ConcreteEntry, std::allocator<ceph::logging::ConcreteEntry> >::allocate(unsigned long) /opt/ceph/include/boost/circular_buffer/base.hpp:2396:39
    #4 0x7fd74c956690 in boost::circular_buffer<ceph::logging::ConcreteEntry, std::allocator<ceph::logging::ConcreteEntry> >::initialize_buffer(unsigned long) /opt/ceph/include/boost/circular_buffer/base.hpp:2494:18
    #5 0x7fd74c950562 in boost::circular_buffer<ceph::logging::ConcreteEntry, std::allocator<ceph::logging::ConcreteEntry> >::circular_buffer(unsigned long, std::allocator<ceph::logging::ConcreteEntry> const&) /opt/ceph/include/boost/circ
ular_buffer/base.hpp:1039:9
    #6 0x7fd74c9435b4 in ceph::logging::Log::Log(ceph::logging::SubsystemMap const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/log/Log.cc:53:5
    #7 0x7fd74bc1891d in ceph::common::CephContext::CephContext(unsigned int, ceph::common::CephContext::create_options const&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/common/ceph_context.cc:729:16
    #8 0x7fd74bc178eb in ceph::common::CephContext::CephContext(unsigned int, code_environment_t, int) /home/jenkins-build/build/workspace/ceph-pull-requests/src/common/ceph_context.cc:697:5
    #9 0x558d341f97e9 in pick_address_filtering_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/test_ipaddr.cc:774:47
    #10 0x558d3430c4f6 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    #11 0x558d342c3fc2 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    #12 0x558d342749dc in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2680:5
    #13 0x558d34276a12 in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2858:11
    #14 0x558d3427804b in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3012:28
    #15 0x558d342954d8 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5723:44
    #16 0x558d34314d26 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    #17 0x558d342ca932 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    #18 0x558d34294862 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5306:10
    #19 0x558d34218d80 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #20 0x558d34218d11 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googlemock/src/gmock_main.cc:70:10
    #21 0x7fd749331d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
```

so, in this change, we do not increase the refcount when creating cct.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
tchaikov added a commit that referenced this pull request Mar 30, 2024
in BlueFS.test_shared_alloc, we keep the return value of
`fs.get_perf_counters()`, and deference it after umounting the fs,
but the `PerfCounters*` pointer returned from `fs.get_perf_counters()`
is destroyed in `BlueFS::_shutdown_logger()` which is in turn called
by `BlueFS::umount()`. so ASan points this out:
```
==1662613==ERROR: AddressSanitizer: heap-use-after-free on address 0x6110000b2d80 at pc 0x7f0eefc30644 bp 0x7ffcdbab6430 sp 0x7ffcdbab6428
READ of size 8 at 0x6110000b2d80 thread T0
    #0 0x7f0eefc30643 in ceph::common::PerfCounters::get(int) const /home/jenkins-build/build/workspace/ceph-pull-requests/src/common/perf_counters.cc:246:8
    #1 0x557595ddfc15 in BlueFS_test_shared_alloc_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/objectstore/test_bluefs.cc:1182:3
    #2 0x557595eeef66 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    #3 0x557595ea8b22 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    #4 0x557595e5974c in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2680:5
    #5 0x557595e5b782 in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2858:11
    #6 0x557595e5cdbb in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3012:28
    #7 0x557595e7a248 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5723:44
    #8 0x557595ef7816 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    #9 0x557595eaf5c2 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    #10 0x557595e795d2 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5306:10
    #11 0x557595e05370 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #12 0x557595dfc1f5 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/objectstore/test_bluefs.cc:1603:10
    #13 0x7f0eed083d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #14 0x7f0eed083e3f in __libc_start_main csu/../csu/libc-start.c:392:3
    #15 0x557595cd46a4 in _start (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_bluefs+0x2856a4) (BuildId: 5439261504ca3d7549fe9bcda1d17ef6d4d9b644)

0x6110000b2d80 is located 0 bytes inside of 208-byte region [0x6110000b2d80,0x6110000b2e50)
freed by thread T0 here:
    #0 0x557595d92b1d in operator delete(void*) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_bluefs+0x343b1d) (BuildId: 5439261504ca3d7549fe9bcda1d17ef6d4d9b644)
    #1 0x557595f31c43 in BlueFS::_shutdown_logger() /home/jenkins-build/build/workspace/ceph-pull-requests/src/os/bluestore/BlueFS.cc:462:3
    #2 0x557595f54ab5 in BlueFS::umount(bool) /home/jenkins-build/build/workspace/ceph-pull-requests/src/os/bluestore/BlueFS.cc:1076:3
    #3 0x557595ddfbd7 in BlueFS_test_shared_alloc_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/objectstore/test_bluefs.cc:1180:6
    #4 0x557595eeef66 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    #5 0x557595ea8b22 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    #6 0x557595e5974c in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2680:5
    #7 0x557595e5b782 in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2858:11
    #8 0x557595e5cdbb in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3012:28
    #9 0x557595e7a248 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5723:44
    #10 0x557595ef7816 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    #11 0x557595eaf5c2 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    #12 0x557595e795d2 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5306:10
    #13 0x557595e05370 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #14 0x557595dfc1f5 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/objectstore/test_bluefs.cc:1603:10
    #15 0x7f0eed083d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

previously allocated by thread T0 here:
    #0 0x557595d922bd in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_bluefs+0x3432bd) (BuildId: 5439261504ca3d7549fe9bcda1d17ef6d4d9b644)
    #1 0x7f0eefc33180 in ceph::common::PerfCountersBuilder::PerfCountersBuilder(ceph::common::CephContext*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int) /home/jenkins-build/build/workspace/ceph-pull-requests/src/common/perf_counters.cc:537:21
    #2 0x557595f30ac9 in BlueFS::_init_logger() /home/jenkins-build/build/workspace/ceph-pull-requests/src/os/bluestore/BlueFS.cc:221:23
    #3 0x557595f42bc6 in BlueFS::mount() /home/jenkins-build/build/workspace/ceph-pull-requests/src/os/bluestore/BlueFS.cc:977:3
    #4 0x557595ddd339 in BlueFS_test_shared_alloc_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/objectstore/test_bluefs.cc:1139:3
    #5 0x557595eeef66 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    #6 0x557595ea8b22 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    #7 0x557595e5974c in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2680:5
    #8 0x557595e5b782 in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2858:11
    #9 0x557595e5cdbb in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3012:28
    #10 0x557595e7a248 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5723:44
    #11 0x557595ef7816 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    #12 0x557595eaf5c2 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    #13 0x557595e795d2 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5306:10
    #14 0x557595e05370 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #15 0x557595dfc1f5 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/objectstore/test_bluefs.cc:1603:10
    #16 0x7f0eed083d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
```

in this change, instead of keeping `logger` across the `umount()` and
`mount()` calls, we get another instance of `logger`, query it for
the perf counter that we are interested, and compare the value
to see if it is unchanged.

this should address the ASan warning above.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
tchaikov added a commit that referenced this pull request Mar 31, 2024
before this change, we allocate an instance of `RocksDBStore` with
`new`, but we never free it. and LeanSanitizer points this out:

```
Direct leak of 952 byte(s) in 1 object(s) allocated from:
    #0 0x55f31440bc2d in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_rocksdb_option+0xaebc2d) (BuildId: 81b849dbc41cbc6b05d5e603d9ba8a002dab2d24)
    #1 0x55f3144132fd in RocksDBOption_simple_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/objectstore/TestRocksdbOptionParse.cc:17:22
    #2 0x55f3144ecf26 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    #3 0x55f3144a4312 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    #4 0x55f314453ccc in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2680:5
    #5 0x55f314455d02 in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2858:11
    #6 0x55f31445733b in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3012:28
    #7 0x55f3144747c8 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5723:44
    #8 0x55f3144f5576 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    #9 0x55f3144ab1a2 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    #10 0x55f314473b52 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5306:10
    #11 0x55f31440f690 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #12 0x55f31440e4c3 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/unit.cc:45:10
    #13 0x7f0d32551d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
```

in this change, we manage the life cycle of `RocksDBStore` using
a smart pointer. this should address the leak.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
tchaikov added a commit that referenced this pull request Apr 3, 2024
we allocate a hitset without freeing it in this test, and LeakSanitizer
points this out
```
Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x557a0841a9dd in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_hitset+0x1ae9dd) (BuildId: ad9be2b52b3d6fb1a567b262c3becaab6373e88d)
    #1 0x557a0843b98e in ExplicitHashHitSetTest::ExplicitHashHitSetTest() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/osd/hitset.cc:128:46
    #2 0x557a0843b918 in ExplicitHashHitSetTest_Construct_Test::ExplicitHashHitSetTest_Construct_Test() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/osd/hitset.cc:133:1
    #3 0x557a0843b8cb in testing::internal::TestFactoryImpl<ExplicitHashHitSetTest_Construct_Test>::CreateTest() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/internal/gtest-internal.h:472:44
    #4 0x557a08532406 in testing::Test* testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    #5 0x557a084eb892 in testing::Test* testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    #6 0x557a0849dd55 in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2848:22
    #7 0x557a0849f3bb in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0x557a084bc848 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0x557a0853a6d6 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0x557a084f1222 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0x557a084bbbd2 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0x557a08441c10 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0x557a08441ba1 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0x7faa493d6d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
```

in this change, we just free it in the dtor. this should address
the warning from the sanitizer.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
Svelar added a commit that referenced this pull request Apr 12, 2024
When sanitizer is enabled, unittest_mds_quiesce_agent fails as following

```
[==========] Running 5 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 5 tests from QuiesceAgentTest
[ RUN      ] QuiesceAgentTest.ThreadManagement
[       OK ] QuiesceAgentTest.ThreadManagement (3 ms)
[ RUN      ] QuiesceAgentTest.DbUpdates
[       OK ] QuiesceAgentTest.DbUpdates (1 ms)
[ RUN      ] QuiesceAgentTest.QuiesceProtocol
[       OK ] QuiesceAgentTest.QuiesceProtocol (3 ms)
[ RUN      ] QuiesceAgentTest.DuplicateQuiesceRequest
[       OK ] QuiesceAgentTest.DuplicateQuiesceRequest (2 ms)
[ RUN      ] QuiesceAgentTest.TimeoutBeforeComplete
[       OK ] QuiesceAgentTest.TimeoutBeforeComplete (2 ms)
[----------] 5 tests from QuiesceAgentTest (11 ms total)

[----------] Global test environment tear-down
[==========] 5 tests from 1 test suite ran. (11 ms total)
[  PASSED  ] 5 tests.

=================================================================
==3975692==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0xaaaadd81c7c8 in operator new(unsigned long) (/root/ceph/build/bin/unittest_mds_quiesce_agent+0x1fc7c8) (BuildId: 7d45344ba1e43661d9de484f0a5d129377c4d4ae)
    #1 0xaaaadd8878d8 in QuiesceAgent::agent_thread_main() /root/ceph/src/mds/QuiesceAgent.cc:136:68
    #2 0xaaaadd86de38 in QuiesceAgent::AgentThread::entry() /root/ceph/src/mds/QuiesceAgent.h:244:24
    #3 0xffff83d6b554 in Thread::entry_wrapper() /root/ceph/src/common/Thread.cc:87:10
    #4 0xffff83d6b314 in Thread::_entry_func(void*) /root/ceph/src/common/Thread.cc:74:29
    #5 0xffff8154d5c4 in start_thread nptl/./nptl/pthread_create.c:442:8
    #6 0xffff815b5ed8  misc/../sysdeps/unix/sysv/linux/aarch64/clone.S:79

Indirect leak of 120 byte(s) in 1 object(s) allocated from:
    #0 0xaaaadd81c7c8 in operator new(unsigned long) (/root/ceph/build/bin/unittest_mds_quiesce_agent+0x1fc7c8) (BuildId: 7d45344ba1e43661d9de484f0a5d129377c4d4ae)
    #1 0xaaaadd8af4f4 in __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<QuiesceAgent::TrackedRoot, std::allocator<QuiesceAgent::TrackedRoot>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/ext/new_allocator.h:127:27
    #2 0xaaaadd8af3d8 in std::allocator<std::_Sp_counted_ptr_inplace<QuiesceAgent::TrackedRoot, std::allocator<QuiesceAgent::TrackedRoot>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/allocator.h:185:32
    #3 0xaaaadd8af3d8 in std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<QuiesceAgent::TrackedRoot, std::allocator<QuiesceAgent::TrackedRoot>, (__gnu_cxx::_Lock_policy)2> > >::allocate(std::allocator<std::_Sp_counted_ptr_inplace<QuiesceAgent::TrackedRoot, std::allocator<QuiesceAgent::TrackedRoot>, (__gnu_cxx::_Lock_policy)2> >&, unsigned long) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/alloc_traits.h:464:20
    #4 0xaaaadd8aef00 in std::__allocated_ptr<std::allocator<std::_Sp_counted_ptr_inplace<QuiesceAgent::TrackedRoot, std::allocator<QuiesceAgent::TrackedRoot>, (__gnu_cxx::_Lock_policy)2> > > std::__allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<QuiesceAgent::TrackedRoot, std::allocator<QuiesceAgent::TrackedRoot>, (__gnu_cxx::_Lock_policy)2> > >(std::allocator<std::_Sp_counted_ptr_inplace<QuiesceAgent::TrackedRoot, std::allocator<QuiesceAgent::TrackedRoot>, (__gnu_cxx::_Lock_policy)2> >&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/allocated_ptr.h:98:21
    #5 0xaaaadd8aec14 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<QuiesceAgent::TrackedRoot, std::allocator<QuiesceAgent::TrackedRoot>, QuiesceState&, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >&>(QuiesceAgent::TrackedRoot*&, std::_Sp_alloc_shared_tag<std::allocator<QuiesceAgent::TrackedRoot> >, QuiesceState&, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/shared_ptr_base.h:648:19
    #6 0xaaaadd8ae988 in std::__shared_ptr<QuiesceAgent::TrackedRoot, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<QuiesceAgent::TrackedRoot>, QuiesceState&, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >&>(std::_Sp_alloc_shared_tag<std::allocator<QuiesceAgent::TrackedRoot> >, QuiesceState&, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/shared_ptr_base.h:1342:14
    #7 0xaaaadd8ae70c in std::shared_ptr<QuiesceAgent::TrackedRoot>::shared_ptr<std::allocator<QuiesceAgent::TrackedRoot>, QuiesceState&, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >&>(std::_Sp_alloc_shared_tag<std::allocator<QuiesceAgent::TrackedRoot> >, QuiesceState&, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/shared_ptr.h:409:4
    #8 0xaaaadd8ae484 in std::shared_ptr<QuiesceAgent::TrackedRoot> std::allocate_shared<QuiesceAgent::TrackedRoot, std::allocator<QuiesceAgent::TrackedRoot>, QuiesceState&, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >&>(std::allocator<QuiesceAgent::TrackedRoot> const&, QuiesceState&, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/shared_ptr.h:862:14
    #9 0xaaaadd88ff0c in std::shared_ptr<QuiesceAgent::TrackedRoot> std::make_shared<QuiesceAgent::TrackedRoot, QuiesceState&, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >&>(QuiesceState&, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/shared_ptr.h:878:14
    #10 0xaaaadd884a6c in QuiesceAgent::db_update(QuiesceMap&) /root/ceph/src/mds/QuiesceAgent.cc:60:26
    #11 0xaaaadd84a840 in QuiesceAgentTest::update(QuiesceDbVersion, std::initializer_list<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, QuiesceMap::RootInfo> >) /root/ceph/src/test/mds/TestQuiesceAgent.cc:156:18
    #12 0xaaaadd84985c in QuiesceAgentTest::update(unsigned long, std::initializer_list<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, QuiesceMap::RootInfo> >) /root/ceph/src/test/mds/TestQuiesceAgent.cc:165:14
    #13 0xaaaadd8288a8 in QuiesceAgentTest_DbUpdates_Test::TestBody() /root/ceph/src/test/mds/TestQuiesceAgent.cc:213:16
    #14 0xaaaadd977230 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #15 0xaaaadd924590 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #16 0xaaaadd8d4a40 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #17 0xaaaadd8d6984 in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #18 0xaaaadd8d7f84 in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #19 0xaaaadd8f3d48 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #20 0xaaaadd981130 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #21 0xaaaadd92bb64 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #22 0xaaaadd8f31c0 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #23 0xaaaadd820710 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #24 0xaaaadd81ed3c in main /root/ceph/src/test/unit.cc:45:10
    #25 0xffff814f73f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #26 0xffff814f74c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #27 0xaaaadd76e6ac in _start (/root/ceph/build/bin/unittest_mds_quiesce_agent+0x14e6ac) (BuildId: 7d45344ba1e43661d9de484f0a5d129377c4d4ae)

SUMMARY: AddressSanitizer: 184 byte(s) leaked in 2 allocation(s).
```

quiesce_requests Context should be freed.

Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
ifed01 pushed a commit that referenced this pull request Apr 12, 2024
When sanitizer is enabled, unittest_bluestore_types fails as following
```
[ RUN      ] sb_info_space_efficient_map_t.basic
=================================================================
==143714==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xffff99f8b7f4 at pc 0xaaaab50bde18 bp 0xffffebefcdb0 sp 0xffffebefcda8
READ of size 8 at 0xffff99f8b7f4 thread T0
    #0 0xaaaab50bde14 in sb_info_t::get_sbid() const /root/ceph/src/os/bluestore/bluestore_types.h:1337:30
    #1 0xaaaab50a5908 in sb_info_space_efficient_map_t::find(unsigned long) /root/ceph/src/os/bluestore/bluestore_types.h:1385:10
    #2 0xaaaab50bd638 in sb_info_space_efficient_map_t::_add(long) /root/ceph/src/os/bluestore/bluestore_types.h:1424:15
    #3 0xaaaab50a52bc in sb_info_space_efficient_map_t::add_maybe_stray(unsigned long) /root/ceph/src/os/bluestore/bluestore_types.h:1358:12
    #4 0xaaaab4fec03c in sb_info_space_efficient_map_t_basic_Test::TestBody() /root/ceph/src/test/objectstore/test_bluestore_types.cc:113:11
    #5 0xaaaab51e9a40 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #6 0xaaaab5197040 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #7 0xaaaab51488a4 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #8 0xaaaab514a7e8 in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #9 0xaaaab514bde8 in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #10 0xaaaab5167bac in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #11 0xaaaab51f3940 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #12 0xaaaab519e5d8 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #13 0xaaaab5167024 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #14 0xaaaab50b4d6c in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #15 0xaaaab50a1080 in main /root/ceph/src/test/objectstore/test_bluestore_types.cc:2847:10
    #16 0xffff9d6c73f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #17 0xffff9d6c74c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #18 0xaaaab4f3812c in _start (/root/ceph/build/bin/unittest_bluestore_types+0xe4812c) (BuildId: cb75399658026f83a4e89012de8fb02f08f6d239)

0xffff99f8b7f4 is located 0 bytes to the right of 20-byte region [0xffff99f8b7e0,0xffff99f8b7f4)
allocated by thread T0 here:
    #0 0xaaaab4fe636c in operator new[](unsigned long) (/root/ceph/build/bin/unittest_bluestore_types+0xef636c) (BuildId: cb75399658026f83a4e89012de8fb02f08f6d239)
    #1 0xaaaab50c0d2c in mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t>::allocate(unsigned long, void*) /root/ceph/src/include/mempool.h:375:33
    #2 0xaaaab50c0c0c in std::allocator_traits<mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t> >::allocate(mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t>&, unsigned long) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/alloc_traits.h:318:20
    #3 0xaaaab50c044c in std::_Vector_base<sb_info_t, mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t> >::_M_allocate(unsigned long) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/stl_vector.h:346:20
    #4 0xaaaab50bf954 in void std::vector<sb_info_t, mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t> >::_M_realloc_insert<long&>(__gnu_cxx::__normal_iterator<sb_info_t*, std::vector<sb_info_t, mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t> > >, long&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/vector.tcc:440:33
    #5 0xaaaab50be0d8 in sb_info_t& std::vector<sb_info_t, mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t> >::emplace_back<long&>(long&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/vector.tcc:121:4
    #6 0xaaaab50bd760 in sb_info_space_efficient_map_t::_add(long) /root/ceph/src/os/bluestore/bluestore_types.h:1429:24
    #7 0xaaaab50a5e78 in sb_info_space_efficient_map_t::add_or_adopt(unsigned long) /root/ceph/src/os/bluestore/bluestore_types.h:1361:15
    #8 0xaaaab4feb07c in sb_info_space_efficient_map_t_basic_Test::TestBody() /root/ceph/src/test/objectstore/test_bluestore_types.cc:103:11
    #9 0xaaaab51e9a40 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaab5197040 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaab51488a4 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #12 0xaaaab514a7e8 in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #13 0xaaaab514bde8 in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #14 0xaaaab5167bac in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #15 0xaaaab51f3940 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #16 0xaaaab519e5d8 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #17 0xaaaab5167024 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #18 0xaaaab50b4d6c in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #19 0xaaaab50a1080 in main /root/ceph/src/test/objectstore/test_bluestore_types.cc:2847:10
    #20 0xffff9d6c73f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #21 0xffff9d6c74c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #22 0xaaaab4f3812c in _start (/root/ceph/build/bin/unittest_bluestore_types+0xe4812c) (BuildId: cb75399658026f83a4e89012de8fb02f08f6d239)

SUMMARY: AddressSanitizer: heap-buffer-overflow /root/ceph/src/os/bluestore/bluestore_types.h:1337:30 in sb_info_t::get_sbid() const
Shadow bytes around the buggy address:
  0x200ff33f16a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f16b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f16c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f16d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f16e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x200ff33f16f0: fa fa fa fa fa fa fa fa fa fa fa fa 00 00[04]fa
  0x200ff33f1700: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f1710: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f1720: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f1730: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f1740: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==143714==ABORTING
```

'it' might be invalid, so before using 'it', need to figure validity out

Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
cbodley pushed a commit that referenced this pull request Apr 12, 2024
When sanitizer is enabled, unittest__rgw_crypto shows

```
=================================================================
==136464==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 75023 byte(s) in 22 object(s) allocated from:
    #0 0xaaaabf7fb86c in operator new[](unsigned long) (/root/ceph/build/bin/unittest_rgw_crypto+0x48b86c) (BuildId: 8023dc30820215da92d6d4883620bedd8ac1190d)
    #1 0xaaaabf81db48 in TestRGWCrypto_verify_Encrypt_Decrypt_Test::TestBody() /root/ceph/src/test/rgw/test_rgw_crypto.cc:780:24
    #2 0xaaaabf9018ac in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #3 0xaaaabf8b08a4 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #4 0xaaaabf861f88 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #5 0xaaaabf863ecc in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #6 0xaaaabf8654cc in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #7 0xaaaabf881290 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #8 0xaaaabf90b7ac in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #9 0xaaaabf8b7ac0 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #10 0xaaaabf880708 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #11 0xaaaabf823d70 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #12 0xaaaabf81f390 in main /root/ceph/src/test/rgw/test_rgw_crypto.cc:822:10
    #13 0xffff878673f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #14 0xffff878674c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #15 0xaaaabf74d62c in _start (/root/ceph/build/bin/unittest_rgw_crypto+0x3dd62c) (BuildId: 8023dc30820215da92d6d4883620bedd8ac1190d)

SUMMARY: AddressSanitizer: 75023 byte(s) leaked in 22 allocation(s).
```

test_in should be freed to address the warning.

Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
Svelar added a commit that referenced this pull request Apr 16, 2024
When sanitizer is enabled, unittest_osdscrub shows

```
=================================================================
==1633952==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 28 byte(s) in 1 object(s) allocated from:
    #0 0xaaaab4e108e0 in malloc (/root/ceph/build/bin/unittest_osdscrub+0x1ed08e0) (BuildId: b3cfa2137be96d75535beecf0f2500cec10c7550)
    #1 0xffffa8cac2f8 in __res_context_send resolv/./resolv/res_send.c:334:9
    #2 0xffffa8ca9c54 in __res_context_query resolv/./resolv/res_query.c:216:6
    #3 0xffffa8caa4a8 in __res_context_querydomain resolv/./resolv/res_query.c:625:9
    #4 0xffffa8caa4a8 in __res_context_search resolv/./resolv/res_query.c:381:9
    #5 0xffffa8caaa20 in context_search_common resolv/./resolv/res_query.c:550:16
    #6 0xffffa8caaa20 in res_nsearch resolv/./resolv/res_query.c:563:10
    #7 0xffffabbf1f64 in ceph::ResolvHWrapper::res_nsearch(__res_state*, char const*, int, int, unsigned char*, int) /root/ceph/src/common/dns_resolve.cc:37:10
    #8 0xffffabbf6574 in ceph::DNSResolver::resolve_srv_hosts(ceph::common::CephContext*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, ceph::DNSResolver::SRV_Protocol, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, ceph::DNSResolver::Record, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, ceph::DNSResolver::Record> > >*) /root/ceph/src/common/dns_resolve.cc:295:19
    #9 0xffffac8edaf0 in MonMap::init_with_dns_srv(ceph::common::CephContext*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, std::ostream&) /root/ceph/src/mon/MonMap.cc:935:36
    #10 0xffffac8eeec8 in MonMap::build_initial(ceph::common::CephContext*, bool, std::ostream&) /root/ceph/src/mon/MonMap.cc:1014:20
    #11 0xffffac85beb0 in MonClient::build_initial_monmap() /root/ceph/src/mon/MonClient.cc:93:18
    #12 0xaaaab4e50d98 in TestOSDScrub_scrub_time_permit_Test::TestBody() /root/ceph/src/test/osd/TestOSDScrub.cc:73:6
    #13 0xaaaab4f655b0 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #14 0xaaaab4f16264 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #15 0xaaaab4ec6ca8 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #16 0xaaaab4ec8bec in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #17 0xaaaab4eca1ec in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #18 0xaaaab4ee5fb0 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #19 0xaaaab4f6f4c4 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #20 0xaaaab4f1d4bc in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #21 0xaaaab4ee5428 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #22 0xaaaab4e4b790 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #23 0xaaaab4e49dbc in main /root/ceph/src/test/unit.cc:45:10
    #24 0xffffa8bc73f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #25 0xffffa8bc74c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #26 0xaaaab4d9972c in _start (/root/ceph/build/bin/unittest_osdscrub+0x1e5972c) (BuildId: b3cfa2137be96d75535beecf0f2500cec10c7550)

-----------------------------------------------------
Suppressions used:
  count      bytes template
      1         45 ^MallocExtension::Initialize
-----------------------------------------------------

SUMMARY: AddressSanitizer: 28 byte(s) leaked in 1 allocation(s).
```

1. 'res_ninit/res_nquery' memory should be freed.

Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
ifed01 pushed a commit that referenced this pull request Apr 16, 2024
When sanitizer is enabled, unittest_bluestore_types fails as following
```
[ RUN      ] sb_info_space_efficient_map_t.basic
=================================================================
==143714==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xffff99f8b7f4 at pc 0xaaaab50bde18 bp 0xffffebefcdb0 sp 0xffffebefcda8
READ of size 8 at 0xffff99f8b7f4 thread T0
    #0 0xaaaab50bde14 in sb_info_t::get_sbid() const /root/ceph/src/os/bluestore/bluestore_types.h:1337:30
    #1 0xaaaab50a5908 in sb_info_space_efficient_map_t::find(unsigned long) /root/ceph/src/os/bluestore/bluestore_types.h:1385:10
    #2 0xaaaab50bd638 in sb_info_space_efficient_map_t::_add(long) /root/ceph/src/os/bluestore/bluestore_types.h:1424:15
    #3 0xaaaab50a52bc in sb_info_space_efficient_map_t::add_maybe_stray(unsigned long) /root/ceph/src/os/bluestore/bluestore_types.h:1358:12
    #4 0xaaaab4fec03c in sb_info_space_efficient_map_t_basic_Test::TestBody() /root/ceph/src/test/objectstore/test_bluestore_types.cc:113:11
    #5 0xaaaab51e9a40 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #6 0xaaaab5197040 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #7 0xaaaab51488a4 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #8 0xaaaab514a7e8 in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #9 0xaaaab514bde8 in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #10 0xaaaab5167bac in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #11 0xaaaab51f3940 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #12 0xaaaab519e5d8 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #13 0xaaaab5167024 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #14 0xaaaab50b4d6c in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #15 0xaaaab50a1080 in main /root/ceph/src/test/objectstore/test_bluestore_types.cc:2847:10
    #16 0xffff9d6c73f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #17 0xffff9d6c74c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #18 0xaaaab4f3812c in _start (/root/ceph/build/bin/unittest_bluestore_types+0xe4812c) (BuildId: cb75399658026f83a4e89012de8fb02f08f6d239)

0xffff99f8b7f4 is located 0 bytes to the right of 20-byte region [0xffff99f8b7e0,0xffff99f8b7f4)
allocated by thread T0 here:
    #0 0xaaaab4fe636c in operator new[](unsigned long) (/root/ceph/build/bin/unittest_bluestore_types+0xef636c) (BuildId: cb75399658026f83a4e89012de8fb02f08f6d239)
    #1 0xaaaab50c0d2c in mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t>::allocate(unsigned long, void*) /root/ceph/src/include/mempool.h:375:33
    #2 0xaaaab50c0c0c in std::allocator_traits<mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t> >::allocate(mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t>&, unsigned long) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/alloc_traits.h:318:20
    #3 0xaaaab50c044c in std::_Vector_base<sb_info_t, mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t> >::_M_allocate(unsigned long) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/stl_vector.h:346:20
    #4 0xaaaab50bf954 in void std::vector<sb_info_t, mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t> >::_M_realloc_insert<long&>(__gnu_cxx::__normal_iterator<sb_info_t*, std::vector<sb_info_t, mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t> > >, long&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/vector.tcc:440:33
    #5 0xaaaab50be0d8 in sb_info_t& std::vector<sb_info_t, mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t> >::emplace_back<long&>(long&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/vector.tcc:121:4
    #6 0xaaaab50bd760 in sb_info_space_efficient_map_t::_add(long) /root/ceph/src/os/bluestore/bluestore_types.h:1429:24
    #7 0xaaaab50a5e78 in sb_info_space_efficient_map_t::add_or_adopt(unsigned long) /root/ceph/src/os/bluestore/bluestore_types.h:1361:15
    #8 0xaaaab4feb07c in sb_info_space_efficient_map_t_basic_Test::TestBody() /root/ceph/src/test/objectstore/test_bluestore_types.cc:103:11
    #9 0xaaaab51e9a40 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaab5197040 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaab51488a4 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #12 0xaaaab514a7e8 in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #13 0xaaaab514bde8 in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #14 0xaaaab5167bac in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #15 0xaaaab51f3940 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #16 0xaaaab519e5d8 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #17 0xaaaab5167024 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #18 0xaaaab50b4d6c in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #19 0xaaaab50a1080 in main /root/ceph/src/test/objectstore/test_bluestore_types.cc:2847:10
    #20 0xffff9d6c73f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #21 0xffff9d6c74c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #22 0xaaaab4f3812c in _start (/root/ceph/build/bin/unittest_bluestore_types+0xe4812c) (BuildId: cb75399658026f83a4e89012de8fb02f08f6d239)

SUMMARY: AddressSanitizer: heap-buffer-overflow /root/ceph/src/os/bluestore/bluestore_types.h:1337:30 in sb_info_t::get_sbid() const
Shadow bytes around the buggy address:
  0x200ff33f16a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f16b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f16c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f16d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f16e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x200ff33f16f0: fa fa fa fa fa fa fa fa fa fa fa fa 00 00[04]fa
  0x200ff33f1700: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f1710: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f1720: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f1730: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f1740: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==143714==ABORTING
```

'it' might be invalid, so before using 'it', need to figure validity out

Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
(cherry picked from commit e1c9294)
yuriw pushed a commit to yuriw/ceph that referenced this pull request Apr 17, 2024
before this change, we allocate coefficients table with
`malloc()` in `ErasureCodeIsaDefault::prepare()`, but free them using
`delete`. this is identified by LeakSanitizer, and it reports

```
==3135332==ERROR: AddressSanitizer: alloc-dealloc-mismatch (malloc vs operator delete) on 0x60700002a870
    #0 0x5627c6ef721d in operator delete(void*) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_erasure_code_plugin_isa+0x1ca21d) (BuildId: 7922906370e5183d67f55211a868c0b0e22b4a2c)
    #1 0x7fbbe38e858f in ErasureCodeIsaTableCache::~ErasureCodeIsaTableCache() /home/jenkins-build/build/workspace/ceph-pull-requests/src/erasure-code/isa/ErasureCodeIsaTableCache.cc:65:13
    ceph#2 0x7fbbe390be40 in ErasureCodePluginIsa::~ErasureCodePluginIsa() /home/jenkins-build/build/workspace/ceph-pull-requests/src/erasure-code/isa/ErasureCodePluginIsa.h:24:7
    ceph#3 0x7fbbe390be68 in ErasureCodePluginIsa::~ErasureCodePluginIsa() /home/jenkins-build/build/workspace/ceph-pull-requests/src/erasure-code/isa/ErasureCodePluginIsa.h:24:7
    ceph#4 0x5627c7063b52 in ceph::ErasureCodePluginRegistry::~ErasureCodePluginRegistry() /home/jenkins-build/build/workspace/ceph-pull-requests/src/erasure-code/ErasureCodePlugin.cc:49:5
    ceph#5 0x7fbbeccb6494 in __run_exit_handlers stdlib/./stdlib/exit.c:113:8
    ceph#6 0x7fbbeccb660f in exit stdlib/./stdlib/exit.c:143:3
    ceph#7 0x7fbbecc9ad96 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:74:3
    ceph#8 0x7fbbecc9ae3f in __libc_start_main csu/../csu/libc-start.c:392:3
    ceph#9 0x5627c6e38da4 in _start (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_erasure_code_plugin_isa+0x10bda4) (BuildId: 7922906370e5183d67f55211a868c0b0e22b4a2c)
```

so, in this change, we use `new []` and `delete []` to allocate and free
them, to be more consistent, and to silence this warning.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
cbodley pushed a commit that referenced this pull request Apr 18, 2024
…ntrusive_ptr get

When sanitizer is on, unittest_rgw_iam_policy shows

```
=================================================================
==2957634==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 9936 byte(s) in 1 object(s) allocated from:
    #0 0xaaaae4496248 in operator new(unsigned long) (/root/ceph-19.0.0/build/bin/unittest_bluestore_types+0xef6248) (BuildId: f63b15ff165fbd81074275a31e37535a1938809e)
    #1 0xaaaae46b8624 in BlueStore::OnodeCacheShard::create(ceph::common::CephContext*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, ceph::common::PerfCounters*) /root/ceph-19.0.0/src/os/bluestore/BlueStore.cc:1187:7
    #2 0xaaaae44fa8a0 in Blob_put_ref_Test::TestBody() /root/ceph-19.0.0/src/test/objectstore/test_bluestore_types.cc:883:38
    #3 0xaaaae4699aa8 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaae46470a8 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaae45f890c in testing::Test::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaae45fa850 in testing::TestInfo::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaae45fbe50 in testing::TestSuite::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaae4617c14 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaae46a39a8 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaae464e640 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaae461708c in testing::UnitTest::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaae4564dd4 in RUN_ALL_TESTS() /root/ceph-19.0.0/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaae4551080 in main /root/ceph-19.0.0/src/test/objectstore/test_bluestore_types.cc:2847:10
    #14 0xffff998b73f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff998b74c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaae43e812c in _start (/root/ceph-19.0.0/build/bin/unittest_bluestore_types+0xe4812c) (BuildId: f63b15ff165fbd81074275a31e37535a1938809e)

Direct leak of 9936 byte(s) in 1 object(s) allocated from:
    #0 0xaaaae4496248 in operator new(unsigned long) (/root/ceph-19.0.0/build/bin/unittest_bluestore_types+0xef6248) (BuildId: f63b15ff165fbd81074275a31e37535a1938809e)
    #1 0xaaaae46b8624 in BlueStore::OnodeCacheShard::create(ceph::common::CephContext*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, ceph::common::PerfCounters*) /root/ceph-19.0.0/src/os/bluestore/BlueStore.cc:1187:7
    #2 0xaaaae458ad68 in ExtentMapFixture::ExtentMapFixture() /root/ceph-19.0.0/src/test/objectstore/test_bluestore_types.cc:1307:10
    #3 0xaaaae4595414 in ExtentMapFixture_pollock_Test::ExtentMapFixture_pollock_Test() /root/ceph-19.0.0/src/test/objectstore/test_bluestore_types.cc:1572:1
    #4 0xaaaae4595304 in testing::internal::TestFactoryImpl<ExtentMapFixture_pollock_Test>::CreateTest() /root/ceph-19.0.0/src/googletest/googletest/include/gtest/internal/gtest-internal.h:472:44
    #5 0xaaaae469a054 in testing::Test* testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2605:10
    #6 0xaaaae4647fcc in testing::Test* testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2641:14
    #7 0xaaaae45fa82c in testing::TestInfo::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2848:22
    #8 0xaaaae45fbe50 in testing::TestSuite::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:3012:28
    #9 0xaaaae4617c14 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:5723:44
    #10 0xaaaae46a39a8 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2605:10
    #11 0xaaaae464e640 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2641:14
    #12 0xaaaae461708c in testing::UnitTest::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:5306:10
    #13 0xaaaae4564dd4 in RUN_ALL_TESTS() /root/ceph-19.0.0/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #14 0xaaaae4551080 in main /root/ceph-19.0.0/src/test/objectstore/test_bluestore_types.cc:2847:10
    #15 0xffff998b73f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #16 0xffff998b74c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #17 0xaaaae43e812c in _start (/root/ceph-19.0.0/build/bin/unittest_bluestore_types+0xe4812c) (BuildId: f63b15ff165fbd81074275a31e37535a1938809e)

Direct leak of 9936 byte(s) in 1 object(s) allocated from:
    #0 0xaaaae4496248 in operator new(unsigned long) (/root/ceph-19.0.0/build/bin/unittest_bluestore_types+0xef6248) (BuildId: f63b15ff165fbd81074275a31e37535a1938809e)
    #1 0xaaaae46b8624 in BlueStore::OnodeCacheShard::create(ceph::common::CephContext*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, ceph::common::PerfCounters*) /root/ceph-19.0.0/src/os/bluestore/BlueStore.cc:1187:7
    #2 0xaaaae45102ac in ExtentMap_has_any_lextents_Test::TestBody() /root/ceph-19.0.0/src/test/objectstore/test_bluestore_types.cc:1154:36
    #3 0xaaaae4699aa8 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaae46470a8 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaae45f890c in testing::Test::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaae45fa850 in testing::TestInfo::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaae45fbe50 in testing::TestSuite::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaae4617c14 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaae46a39a8 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaae464e640 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaae461708c in testing::UnitTest::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaae4564dd4 in RUN_ALL_TESTS() /root/ceph-19.0.0/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaae4551080 in main /root/ceph-19.0.0/src/test/objectstore/test_bluestore_types.cc:2847:10
    #14 0xffff998b73f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff998b74c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaae43e812c in _start (/root/ceph-19.0.0/build/bin/unittest_bluestore_types+0xe4812c) (BuildId: f63b15ff165fbd81074275a31e37535a1938809e)

...
...
...
Indirect leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0xaaaacf905688 in operator new(unsigned long) (/root/ceph/build/bin/unittest_rgw_iam_policy+0x25f5688) (BuildId: c8dd019430a8d0162485760a78979347f29d225f)
    #1 0xffff7f0b7ca8 in ceph::common::CephContext::CephContext(unsigned int, ceph::common::CephContext::create_options const&) /root/ceph/src/common/ceph_context.cc:781:24
    #2 0xffff7f0b514c in ceph::common::CephContext::CephContext(unsigned int, code_environment_t, int) /root/ceph/src/common/ceph_context.cc:697:5
    #3 0xaaaacf997dcc in ManagedPolicyTest::ManagedPolicyTest() /root/ceph/src/test/rgw/test_rgw_iam_policy.cc:788:33
    #4 0xaaaacf998294 in ManagedPolicyTest_IAMReadOnlyAccess_Test::ManagedPolicyTest_IAMReadOnlyAccess_Test() /root/ceph/src/test/rgw/test_rgw_iam_policy.cc:802:1
    #5 0xaaaacf998230 in testing::internal::TestFactoryImpl<ManagedPolicyTest_IAMReadOnlyAccess_Test>::CreateTest() /root/ceph/src/googletest/googletest/include/gtest/internal/gtest-internal.h:472:44
    #6 0xaaaacfb1a2d4 in testing::Test* testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #7 0xaaaacfaced5c in testing::Test* testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #8 0xaaaacfa83274 in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2848:22
    #9 0xaaaacfa84898 in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #10 0xaaaacfaa065c in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #11 0xaaaacfb23b9c in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #12 0xaaaacfad4968 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #13 0xaaaacfa9fad4 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #14 0xaaaacfa23588 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #15 0xaaaacfa23504 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #16 0xffff7c5a73f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #17 0xffff7c5a74c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #18 0xaaaacf85756c in _start (/root/ceph/build/bin/unittest_rgw_iam_policy+0x254756c) (BuildId: c8dd019430a8d0162485760a78979347f29d225f)

Indirect leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0xaaaacf905688 in operator new(unsigned long) (/root/ceph/build/bin/unittest_rgw_iam_policy+0x25f5688) (BuildId: c8dd019430a8d0162485760a78979347f29d225f)
    #1 0xffff7f0b7ca8 in ceph::common::CephContext::CephContext(unsigned int, ceph::common::CephContext::create_options const&) /root/ceph/src/common/ceph_context.cc:781:24
    #2 0xffff7f0b514c in ceph::common::CephContext::CephContext(unsigned int, code_environment_t, int) /root/ceph/src/common/ceph_context.cc:697:5
    #3 0xaaaacf997dcc in ManagedPolicyTest::ManagedPolicyTest() /root/ceph/src/test/rgw/test_rgw_iam_policy.cc:788:33
    #4 0xaaaacf997d08 in ManagedPolicyTest_IAMFullAccess_Test::ManagedPolicyTest_IAMFullAccess_Test() /root/ceph/src/test/rgw/test_rgw_iam_policy.cc:791:1
    #5 0xaaaacf997ca4 in testing::internal::TestFactoryImpl<ManagedPolicyTest_IAMFullAccess_Test>::CreateTest() /root/ceph/src/googletest/googletest/include/gtest/internal/gtest-internal.h:472:44
    #6 0xaaaacfb1a2d4 in testing::Test* testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #7 0xaaaacfaced5c in testing::Test* testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #8 0xaaaacfa83274 in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2848:22
    #9 0xaaaacfa84898 in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #10 0xaaaacfaa065c in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #11 0xaaaacfb23b9c in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #12 0xaaaacfad4968 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #13 0xaaaacfa9fad4 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #14 0xaaaacfa23588 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #15 0xaaaacfa23504 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #16 0xffff7c5a73f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #17 0xffff7c5a74c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #18 0xaaaacf85756c in _start (/root/ceph/build/bin/unittest_rgw_iam_policy+0x254756c) (BuildId: c8dd019430a8d0162485760a78979347f29d225f)

SUMMARY: AddressSanitizer: 67625436 byte(s) leaked in 21960 allocation(s).
```

To avoid memory not free, use reset for not increasing RC and keep code uniformity as above codes.

Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
Svelar added a commit that referenced this pull request Apr 22, 2024
When sanitizer is enabled, result shows as following

```
=================================================================
==207167==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5148fcc in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1664:7
    #2 0xaaaac50ff7dc in PITest_past_intervals_ec_Test::TestBody() /root/ceph/src/test/osd/types.cc:1707:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5148fcc in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1664:7
    #2 0xaaaac510ac3c in PITest_past_intervals_ec_no_subsets_Test::TestBody() /root/ceph/src/test/osd/types.cc:1799:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5148fcc in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1664:7
    #2 0xaaaac50fce54 in PITest_past_intervals_rep_Test::TestBody() /root/ceph/src/test/osd/types.cc:1683:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5149264 in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1673:7
    #2 0xaaaac5107e3c in PITest_past_intervals_rep_no_subsets_Test::TestBody() /root/ceph/src/test/osd/types.cc:1776:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5148fcc in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1664:7
    #2 0xaaaac5107e3c in PITest_past_intervals_rep_no_subsets_Test::TestBody() /root/ceph/src/test/osd/types.cc:1776:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5149264 in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1673:7
    #2 0xaaaac51054d0 in PITest_past_intervals_ec_down_Test::TestBody() /root/ceph/src/test/osd/types.cc:1753:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5148fcc in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1664:7
    #2 0xaaaac51054d0 in PITest_past_intervals_ec_down_Test::TestBody() /root/ceph/src/test/osd/types.cc:1753:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5149264 in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1673:7
    #2 0xaaaac510248c in PITest_past_intervals_rep_down_Test::TestBody() /root/ceph/src/test/osd/types.cc:1729:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5149264 in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1673:7
    #2 0xaaaac51109b0 in PITest_past_intervals_rep_lost_Test::TestBody() /root/ceph/src/test/osd/types.cc:1846:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5148fcc in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1664:7
    #2 0xaaaac51109b0 in PITest_past_intervals_rep_lost_Test::TestBody() /root/ceph/src/test/osd/types.cc:1846:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5149264 in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1673:7
    #2 0xaaaac510dc88 in PITest_past_intervals_ec_no_subsets2_Test::TestBody() /root/ceph/src/test/osd/types.cc:1822:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5148fcc in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1664:7
    #2 0xaaaac510dc88 in PITest_past_intervals_ec_no_subsets2_Test::TestBody() /root/ceph/src/test/osd/types.cc:1822:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5149264 in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1673:7
    #2 0xaaaac510ac3c in PITest_past_intervals_ec_no_subsets_Test::TestBody() /root/ceph/src/test/osd/types.cc:1799:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5149264 in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1673:7
    #2 0xaaaac50fce54 in PITest_past_intervals_rep_Test::TestBody() /root/ceph/src/test/osd/types.cc:1683:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5149264 in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1673:7
    #2 0xaaaac5113760 in PITest_past_intervals_ec_lost_Test::TestBody() /root/ceph/src/test/osd/types.cc:1870:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5148fcc in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1664:7
    #2 0xaaaac5113760 in PITest_past_intervals_ec_lost_Test::TestBody() /root/ceph/src/test/osd/types.cc:1870:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5149264 in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1673:7
    #2 0xaaaac50ff7dc in PITest_past_intervals_ec_Test::TestBody() /root/ceph/src/test/osd/types.cc:1707:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5148fcc in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1664:7
    #2 0xaaaac510248c in PITest_past_intervals_rep_down_Test::TestBody() /root/ceph/src/test/osd/types.cc:1729:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

SUMMARY: AddressSanitizer: 288 byte(s) leaked in 18 allocation(s).
```

PriorSet::pcontdec should be freed

Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
awojno-bloomberg pushed a commit to awojno-bloomberg/ceph that referenced this pull request Apr 23, 2024
…sive_ptr<CephContext>

before this change, we increment the refcount when constructing
`cct` instrusive_ptr, but nobody owns this smart pointer. also,
`CephContext` 's constructor set its refcount to 1. so, when the
test finishes, the refcount is 1, and this leads to a leakage of
the `CephContext` instance. and LeakSanitizer points this out:

```
Indirect leak of 10880000 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac359c7c8 in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests-arm64/build/bin/unittest_rgw_iam_policy+0x211c7c8) (BuildId: 060fadb10da261b52fd5757c7b1e9812d34542f1)
    ceph#1 0xffff96f764e4 in __gnu_cxx::new_allocator<ceph::logging::ConcreteEntry>::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/ext/new_allocator.h:127:27
    ceph#2 0xffff96f757cc in std::allocator<ceph::logging::ConcreteEntry>::allocate(unsigned long) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/allocator.h:185:32
    ceph#3 0xffff96f757cc in boost::circular_buffer<ceph::logging::ConcreteEntry, std::allocator<ceph::logging::ConcreteEntry> >::allocate(unsigned long) /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/build/boost/include/boost/circular_buffer/base.hpp:2396:39
    ceph#4 0xffff96f75500 in boost::circular_buffer<ceph::logging::ConcreteEntry, std::allocator<ceph::logging::ConcreteEntry> >::initialize_buffer(unsigned long) /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/build/boost/include/boost/circular_buffer/base.hpp:2494:18
    ceph#5 0xffff96f6ec4c in boost::circular_buffer<ceph::logging::ConcreteEntry, std::allocator<ceph::logging::ConcreteEntry> >::circular_buffer(unsigned long, std::allocator<ceph::logging::ConcreteEntry> const&) /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/build/boost/include/boost/circular_buffer/base.hpp:1039:9
    ceph#6 0xffff96f63528 in ceph::logging::Log::Log(ceph::logging::SubsystemMap const*) /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/src/log/Log.cc:53:5
    ceph#7 0xffff96045300 in ceph::common::CephContext::CephContext(unsigned int, ceph::common::CephContext::create_options const&) /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/src/common/ceph_context.cc:729:16
    ceph#8 0xffff960446ec in ceph::common::CephContext::CephContext(unsigned int, code_environment_t, int) /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/src/common/ceph_context.cc:697:5
    ceph#9 0xaaaac3629238 in IPPolicyTest::IPPolicyTest() /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/src/test/rgw/test_rgw_iam_policy.cc:864:15
    ceph#10 0xaaaac3628da0 in IPPolicyTest_MaskedIPOperations_Test::IPPolicyTest_MaskedIPOperations_Test() /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/src/test/rgw/test_rgw_iam_policy.cc:869:1
    ceph#11 0xaaaac3628d3c in testing::internal::TestFactoryImpl<IPPolicyTest_MaskedIPOperations_Test>::CreateTest() /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/src/googletest/googletest/include/gtest/internal/gtest-internal.h:472:44
```

so, in this change, we do not increase the refcount when creating cct.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
awojno-bloomberg pushed a commit to awojno-bloomberg/ceph that referenced this pull request Apr 23, 2024
before this change, we create a new cct instance with `new`, but
we never free this instance after done with it. and LeakSanitizer
points this out:

```
Indirect leak of 10880000 byte(s) in 1 object(s) allocated from:
    #0 0x561afe148fed in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_config_map+0x1c2fed) (BuildId: 3ce9eeed38cee335628fa74fdd08cd215b15019e)
    ceph#1 0x7f37dc9ac189 in __gnu_cxx::new_allocator<ceph::logging::ConcreteEntry>::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/ext/new_allocator.h:127:27
    ceph#2 0x7f37dc9ab563 in std::allocator<ceph::logging::ConcreteEntry>::allocate(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/allocator.h:185:32
    ceph#3 0x7f37dc9ab563 in boost::circular_buffer<ceph::logging::ConcreteEntry, std::allocator<ceph::logging::ConcreteEntry> >::allocate(unsigned long) /opt/ceph/include/boost/circular_buffer/base.hpp:2396:39
    ceph#4 0x7f37dc9ab2c0 in boost::circular_buffer<ceph::logging::ConcreteEntry, std::allocator<ceph::logging::ConcreteEntry> >::initialize_buffer(unsigned long) /opt/ceph/include/boost/circular_buffer/base.hpp:2494:18
    ceph#5 0x7f37dc9a5192 in boost::circular_buffer<ceph::logging::ConcreteEntry, std::allocator<ceph::logging::ConcreteEntry> >::circular_buffer(unsigned long, std::allocator<ceph::logging::ConcreteEntry> const&) /opt/ceph/include/boost/circular_buffer/base.hpp:1039:9
    ceph#6 0x7f37dc9981e4 in ceph::logging::Log::Log(ceph::logging::SubsystemMap const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/log/Log.cc:53:5
    ceph#7 0x7f37dbc6e96d in ceph::common::CephContext::CephContext(unsigned int, ceph::common::CephContext::create_options const&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/common/ceph_context.cc:729:16
    ceph#8 0x7f37dbc6d93b in ceph::common::CephContext::CephContext(unsigned int, code_environment_t, int) /home/jenkins-build/build/workspace/ceph-pull-requests/src/common/ceph_context.cc:697:5
    ceph#9 0x561afe14e983 in ConfigMap_add_option_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_config_map.cc:58:18
    ceph#10 0x561afe2689b6 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#11 0x561afe221262 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#12 0x561afe1d1f7c in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2680:5
    ceph#13 0x561afe1d3fb2 in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2858:11
    ceph#14 0x561afe1d55eb in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3012:28
    ceph#15 0x561afe1f2a78 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5723:44
    ceph#16 0x561afe2711e6 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#17 0x561afe227bd2 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#18 0x561afe1f1e02 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5306:10
    ceph#19 0x561afe176ec0 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2486:46
    ceph#20 0x561afe176e51 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googlemock/src/gmock_main.cc:70:10
    ceph#21 0x7f37d9397d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
```

so in this change, we manage the `CephContext` pointer with a smart
pointer. because the size of CephContext could be large, we don't create
it on stack.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
awojno-bloomberg pushed a commit to awojno-bloomberg/ceph that referenced this pull request Apr 23, 2024
before this change, we create a new CrushWrapper instance with `new`, but
we never free this instance after done with it. and LeakSanitizer
points this out:

```
Direct leak of 544 byte(s) in 1 object(s) allocated from:
    #0 0x561afe148fed in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_config_map+0x1c2fed) (BuildId: 3ce9eeed38cee335628fa74fdd08cd215b15019e)
    ceph#1 0x561afe151cbd in ConfigMap_result_sections_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_config_map.cc:93:16
    ceph#2 0x561afe2689b6 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#3 0x561afe221262 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#4 0x561afe1d1f7c in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2680:5
    ceph#5 0x561afe1d3fb2 in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2858:11
    ceph#6 0x561afe1d55eb in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3012:28
    ceph#7 0x561afe1f2a78 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5723:44
    ceph#8 0x561afe2711e6 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#9 0x561afe227bd2 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#10 0x561afe1f1e02 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5306:10
    ceph#11 0x561afe176ec0 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2486:46
    ceph#12 0x561afe176e51 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googlemock/src/gmock_main.cc:70:10
    ceph#13 0x7f37d9397d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
```

so in this change, we manage the `CrushWrapper` pointer with a smart
pointer. because the size of `CrushWrapper` is relatively large, we
don't create it on stack.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
awojno-bloomberg pushed a commit to awojno-bloomberg/ceph that referenced this pull request Apr 23, 2024
LeakSanitizer reports
```
==688591==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 45 byte(s) in 1 object(s) allocated from:
    #0 0x55f8dd9969dd in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_fastbmap_allocator+0x1f89dd) (BuildId: cac39eac8ef1e8774f9dd48e6e3f677fdd864776)
    ceph#1 0x55f8dd99c730 in __gnu_cxx::new_allocator<char>::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/ext/new_allocator.h:127:27
    ceph#2 0x55f8dd99c690 in std::allocator<char>::allocate(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/allocator.h:185:32
    ceph#3 0x55f8dd99c690 in std::allocator_traits<std::allocator<char> >::allocate(std::allocator<char>&, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/alloc_traits.h:464:20
    ceph#4 0x55f8dd99c393 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.tcc:153:14
    ceph#5 0x55f8dda96a6c in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.tcc:307:21
    ceph#6 0x55f8dda96852 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.tcc:395:8
    ceph#7 0x7f4a751ab6f0 in
    MallocExtension::Initialize() (/lib/x86_64-linux-gnu/libtcmalloc.so.4+0x2a6f0) (BuildId:
    eeef3d1257388a806e122398dbce3157ee568ef4)
```

this is a global object allocated by the allocator, so we can suppress this report.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
awojno-bloomberg pushed a commit to awojno-bloomberg/ceph that referenced this pull request Apr 23, 2024
before this change, we increment the refcount when constructing
`cct` instrusive_ptr, but nobody owns this smart pointer. also,
`CephContext` 's constructor set its refcount to 1. so, when the
test finishes, the refcount is 1, and this leads to a leakage of
the `CephContext` instance. and LeakSanitizer points this out:
```
Indirect leak of 10880000 byte(s) in 1 object(s) allocated from:
    #0 0x558d341d837d in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_ipaddr+0x19b37d) (BuildId: 1b7e7e5abfc2b58ce2334712e4c00b2441c25870)
    ceph#1 0x7fd74c957559 in __gnu_cxx::new_allocator<ceph::logging::ConcreteEntry>::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/ext/new_allocator.h:127:27
    ceph#2 0x7fd74c956933 in std::allocator<ceph::logging::ConcreteEntry>::allocate(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/allocator.h:185:32
    ceph#3 0x7fd74c956933 in boost::circular_buffer<ceph::logging::ConcreteEntry, std::allocator<ceph::logging::ConcreteEntry> >::allocate(unsigned long) /opt/ceph/include/boost/circular_buffer/base.hpp:2396:39
    ceph#4 0x7fd74c956690 in boost::circular_buffer<ceph::logging::ConcreteEntry, std::allocator<ceph::logging::ConcreteEntry> >::initialize_buffer(unsigned long) /opt/ceph/include/boost/circular_buffer/base.hpp:2494:18
    ceph#5 0x7fd74c950562 in boost::circular_buffer<ceph::logging::ConcreteEntry, std::allocator<ceph::logging::ConcreteEntry> >::circular_buffer(unsigned long, std::allocator<ceph::logging::ConcreteEntry> const&) /opt/ceph/include/boost/circ
ular_buffer/base.hpp:1039:9
    ceph#6 0x7fd74c9435b4 in ceph::logging::Log::Log(ceph::logging::SubsystemMap const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/log/Log.cc:53:5
    ceph#7 0x7fd74bc1891d in ceph::common::CephContext::CephContext(unsigned int, ceph::common::CephContext::create_options const&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/common/ceph_context.cc:729:16
    ceph#8 0x7fd74bc178eb in ceph::common::CephContext::CephContext(unsigned int, code_environment_t, int) /home/jenkins-build/build/workspace/ceph-pull-requests/src/common/ceph_context.cc:697:5
    ceph#9 0x558d341f97e9 in pick_address_filtering_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/test_ipaddr.cc:774:47
    ceph#10 0x558d3430c4f6 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#11 0x558d342c3fc2 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#12 0x558d342749dc in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2680:5
    ceph#13 0x558d34276a12 in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2858:11
    ceph#14 0x558d3427804b in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3012:28
    ceph#15 0x558d342954d8 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5723:44
    ceph#16 0x558d34314d26 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#17 0x558d342ca932 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#18 0x558d34294862 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5306:10
    ceph#19 0x558d34218d80 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2486:46
    ceph#20 0x558d34218d11 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googlemock/src/gmock_main.cc:70:10
    ceph#21 0x7fd749331d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
```

so, in this change, we do not increase the refcount when creating cct.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
awojno-bloomberg pushed a commit to awojno-bloomberg/ceph that referenced this pull request Apr 23, 2024
in BlueFS.test_shared_alloc, we keep the return value of
`fs.get_perf_counters()`, and deference it after umounting the fs,
but the `PerfCounters*` pointer returned from `fs.get_perf_counters()`
is destroyed in `BlueFS::_shutdown_logger()` which is in turn called
by `BlueFS::umount()`. so ASan points this out:
```
==1662613==ERROR: AddressSanitizer: heap-use-after-free on address 0x6110000b2d80 at pc 0x7f0eefc30644 bp 0x7ffcdbab6430 sp 0x7ffcdbab6428
READ of size 8 at 0x6110000b2d80 thread T0
    #0 0x7f0eefc30643 in ceph::common::PerfCounters::get(int) const /home/jenkins-build/build/workspace/ceph-pull-requests/src/common/perf_counters.cc:246:8
    ceph#1 0x557595ddfc15 in BlueFS_test_shared_alloc_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/objectstore/test_bluefs.cc:1182:3
    ceph#2 0x557595eeef66 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#3 0x557595ea8b22 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#4 0x557595e5974c in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2680:5
    ceph#5 0x557595e5b782 in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2858:11
    ceph#6 0x557595e5cdbb in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3012:28
    ceph#7 0x557595e7a248 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5723:44
    ceph#8 0x557595ef7816 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#9 0x557595eaf5c2 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#10 0x557595e795d2 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5306:10
    ceph#11 0x557595e05370 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2486:46
    ceph#12 0x557595dfc1f5 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/objectstore/test_bluefs.cc:1603:10
    ceph#13 0x7f0eed083d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    ceph#14 0x7f0eed083e3f in __libc_start_main csu/../csu/libc-start.c:392:3
    ceph#15 0x557595cd46a4 in _start (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_bluefs+0x2856a4) (BuildId: 5439261504ca3d7549fe9bcda1d17ef6d4d9b644)

0x6110000b2d80 is located 0 bytes inside of 208-byte region [0x6110000b2d80,0x6110000b2e50)
freed by thread T0 here:
    #0 0x557595d92b1d in operator delete(void*) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_bluefs+0x343b1d) (BuildId: 5439261504ca3d7549fe9bcda1d17ef6d4d9b644)
    ceph#1 0x557595f31c43 in BlueFS::_shutdown_logger() /home/jenkins-build/build/workspace/ceph-pull-requests/src/os/bluestore/BlueFS.cc:462:3
    ceph#2 0x557595f54ab5 in BlueFS::umount(bool) /home/jenkins-build/build/workspace/ceph-pull-requests/src/os/bluestore/BlueFS.cc:1076:3
    ceph#3 0x557595ddfbd7 in BlueFS_test_shared_alloc_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/objectstore/test_bluefs.cc:1180:6
    ceph#4 0x557595eeef66 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#5 0x557595ea8b22 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#6 0x557595e5974c in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2680:5
    ceph#7 0x557595e5b782 in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2858:11
    ceph#8 0x557595e5cdbb in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3012:28
    ceph#9 0x557595e7a248 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5723:44
    ceph#10 0x557595ef7816 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#11 0x557595eaf5c2 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#12 0x557595e795d2 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5306:10
    ceph#13 0x557595e05370 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2486:46
    ceph#14 0x557595dfc1f5 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/objectstore/test_bluefs.cc:1603:10
    ceph#15 0x7f0eed083d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

previously allocated by thread T0 here:
    #0 0x557595d922bd in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_bluefs+0x3432bd) (BuildId: 5439261504ca3d7549fe9bcda1d17ef6d4d9b644)
    ceph#1 0x7f0eefc33180 in ceph::common::PerfCountersBuilder::PerfCountersBuilder(ceph::common::CephContext*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int) /home/jenkins-build/build/workspace/ceph-pull-requests/src/common/perf_counters.cc:537:21
    ceph#2 0x557595f30ac9 in BlueFS::_init_logger() /home/jenkins-build/build/workspace/ceph-pull-requests/src/os/bluestore/BlueFS.cc:221:23
    ceph#3 0x557595f42bc6 in BlueFS::mount() /home/jenkins-build/build/workspace/ceph-pull-requests/src/os/bluestore/BlueFS.cc:977:3
    ceph#4 0x557595ddd339 in BlueFS_test_shared_alloc_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/objectstore/test_bluefs.cc:1139:3
    ceph#5 0x557595eeef66 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#6 0x557595ea8b22 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#7 0x557595e5974c in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2680:5
    ceph#8 0x557595e5b782 in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2858:11
    ceph#9 0x557595e5cdbb in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3012:28
    ceph#10 0x557595e7a248 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5723:44
    ceph#11 0x557595ef7816 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#12 0x557595eaf5c2 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#13 0x557595e795d2 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5306:10
    ceph#14 0x557595e05370 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2486:46
    ceph#15 0x557595dfc1f5 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/objectstore/test_bluefs.cc:1603:10
    ceph#16 0x7f0eed083d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
```

in this change, instead of keeping `logger` across the `umount()` and
`mount()` calls, we get another instance of `logger`, query it for
the perf counter that we are interested, and compare the value
to see if it is unchanged.

this should address the ASan warning above.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
awojno-bloomberg pushed a commit to awojno-bloomberg/ceph that referenced this pull request Apr 23, 2024
before this change, we allocate an instance of `RocksDBStore` with
`new`, but we never free it. and LeanSanitizer points this out:

```
Direct leak of 952 byte(s) in 1 object(s) allocated from:
    #0 0x55f31440bc2d in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_rocksdb_option+0xaebc2d) (BuildId: 81b849dbc41cbc6b05d5e603d9ba8a002dab2d24)
    ceph#1 0x55f3144132fd in RocksDBOption_simple_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/objectstore/TestRocksdbOptionParse.cc:17:22
    ceph#2 0x55f3144ecf26 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#3 0x55f3144a4312 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#4 0x55f314453ccc in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2680:5
    ceph#5 0x55f314455d02 in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2858:11
    ceph#6 0x55f31445733b in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3012:28
    ceph#7 0x55f3144747c8 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5723:44
    ceph#8 0x55f3144f5576 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#9 0x55f3144ab1a2 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#10 0x55f314473b52 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5306:10
    ceph#11 0x55f31440f690 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2486:46
    ceph#12 0x55f31440e4c3 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/unit.cc:45:10
    ceph#13 0x7f0d32551d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
```

in this change, we manage the life cycle of `RocksDBStore` using
a smart pointer. this should address the leak.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
awojno-bloomberg pushed a commit to awojno-bloomberg/ceph that referenced this pull request Apr 23, 2024
we allocate a hitset without freeing it in this test, and LeakSanitizer
points this out
```
Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x557a0841a9dd in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_hitset+0x1ae9dd) (BuildId: ad9be2b52b3d6fb1a567b262c3becaab6373e88d)
    ceph#1 0x557a0843b98e in ExplicitHashHitSetTest::ExplicitHashHitSetTest() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/osd/hitset.cc:128:46
    ceph#2 0x557a0843b918 in ExplicitHashHitSetTest_Construct_Test::ExplicitHashHitSetTest_Construct_Test() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/osd/hitset.cc:133:1
    ceph#3 0x557a0843b8cb in testing::internal::TestFactoryImpl<ExplicitHashHitSetTest_Construct_Test>::CreateTest() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/internal/gtest-internal.h:472:44
    ceph#4 0x557a08532406 in testing::Test* testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#5 0x557a084eb892 in testing::Test* testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#6 0x557a0849dd55 in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2848:22
    ceph#7 0x557a0849f3bb in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3012:28
    ceph#8 0x557a084bc848 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5723:44
    ceph#9 0x557a0853a6d6 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#10 0x557a084f1222 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#11 0x557a084bbbd2 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5306:10
    ceph#12 0x557a08441c10 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2486:46
    ceph#13 0x557a08441ba1 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googlemock/src/gmock_main.cc:70:10
    ceph#14 0x7faa493d6d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
```

in this change, we just free it in the dtor. this should address
the warning from the sanitizer.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
awojno-bloomberg pushed a commit to awojno-bloomberg/ceph that referenced this pull request Apr 23, 2024
When sanitizer is enabled, unittest_mds_quiesce_agent fails as following

```
[==========] Running 5 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 5 tests from QuiesceAgentTest
[ RUN      ] QuiesceAgentTest.ThreadManagement
[       OK ] QuiesceAgentTest.ThreadManagement (3 ms)
[ RUN      ] QuiesceAgentTest.DbUpdates
[       OK ] QuiesceAgentTest.DbUpdates (1 ms)
[ RUN      ] QuiesceAgentTest.QuiesceProtocol
[       OK ] QuiesceAgentTest.QuiesceProtocol (3 ms)
[ RUN      ] QuiesceAgentTest.DuplicateQuiesceRequest
[       OK ] QuiesceAgentTest.DuplicateQuiesceRequest (2 ms)
[ RUN      ] QuiesceAgentTest.TimeoutBeforeComplete
[       OK ] QuiesceAgentTest.TimeoutBeforeComplete (2 ms)
[----------] 5 tests from QuiesceAgentTest (11 ms total)

[----------] Global test environment tear-down
[==========] 5 tests from 1 test suite ran. (11 ms total)
[  PASSED  ] 5 tests.

=================================================================
==3975692==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0xaaaadd81c7c8 in operator new(unsigned long) (/root/ceph/build/bin/unittest_mds_quiesce_agent+0x1fc7c8) (BuildId: 7d45344ba1e43661d9de484f0a5d129377c4d4ae)
    ceph#1 0xaaaadd8878d8 in QuiesceAgent::agent_thread_main() /root/ceph/src/mds/QuiesceAgent.cc:136:68
    ceph#2 0xaaaadd86de38 in QuiesceAgent::AgentThread::entry() /root/ceph/src/mds/QuiesceAgent.h:244:24
    ceph#3 0xffff83d6b554 in Thread::entry_wrapper() /root/ceph/src/common/Thread.cc:87:10
    ceph#4 0xffff83d6b314 in Thread::_entry_func(void*) /root/ceph/src/common/Thread.cc:74:29
    ceph#5 0xffff8154d5c4 in start_thread nptl/./nptl/pthread_create.c:442:8
    ceph#6 0xffff815b5ed8  misc/../sysdeps/unix/sysv/linux/aarch64/clone.S:79

Indirect leak of 120 byte(s) in 1 object(s) allocated from:
    #0 0xaaaadd81c7c8 in operator new(unsigned long) (/root/ceph/build/bin/unittest_mds_quiesce_agent+0x1fc7c8) (BuildId: 7d45344ba1e43661d9de484f0a5d129377c4d4ae)
    ceph#1 0xaaaadd8af4f4 in __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<QuiesceAgent::TrackedRoot, std::allocator<QuiesceAgent::TrackedRoot>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/ext/new_allocator.h:127:27
    ceph#2 0xaaaadd8af3d8 in std::allocator<std::_Sp_counted_ptr_inplace<QuiesceAgent::TrackedRoot, std::allocator<QuiesceAgent::TrackedRoot>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/allocator.h:185:32
    ceph#3 0xaaaadd8af3d8 in std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<QuiesceAgent::TrackedRoot, std::allocator<QuiesceAgent::TrackedRoot>, (__gnu_cxx::_Lock_policy)2> > >::allocate(std::allocator<std::_Sp_counted_ptr_inplace<QuiesceAgent::TrackedRoot, std::allocator<QuiesceAgent::TrackedRoot>, (__gnu_cxx::_Lock_policy)2> >&, unsigned long) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/alloc_traits.h:464:20
    ceph#4 0xaaaadd8aef00 in std::__allocated_ptr<std::allocator<std::_Sp_counted_ptr_inplace<QuiesceAgent::TrackedRoot, std::allocator<QuiesceAgent::TrackedRoot>, (__gnu_cxx::_Lock_policy)2> > > std::__allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<QuiesceAgent::TrackedRoot, std::allocator<QuiesceAgent::TrackedRoot>, (__gnu_cxx::_Lock_policy)2> > >(std::allocator<std::_Sp_counted_ptr_inplace<QuiesceAgent::TrackedRoot, std::allocator<QuiesceAgent::TrackedRoot>, (__gnu_cxx::_Lock_policy)2> >&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/allocated_ptr.h:98:21
    ceph#5 0xaaaadd8aec14 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<QuiesceAgent::TrackedRoot, std::allocator<QuiesceAgent::TrackedRoot>, QuiesceState&, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >&>(QuiesceAgent::TrackedRoot*&, std::_Sp_alloc_shared_tag<std::allocator<QuiesceAgent::TrackedRoot> >, QuiesceState&, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/shared_ptr_base.h:648:19
    ceph#6 0xaaaadd8ae988 in std::__shared_ptr<QuiesceAgent::TrackedRoot, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<QuiesceAgent::TrackedRoot>, QuiesceState&, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >&>(std::_Sp_alloc_shared_tag<std::allocator<QuiesceAgent::TrackedRoot> >, QuiesceState&, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/shared_ptr_base.h:1342:14
    ceph#7 0xaaaadd8ae70c in std::shared_ptr<QuiesceAgent::TrackedRoot>::shared_ptr<std::allocator<QuiesceAgent::TrackedRoot>, QuiesceState&, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >&>(std::_Sp_alloc_shared_tag<std::allocator<QuiesceAgent::TrackedRoot> >, QuiesceState&, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/shared_ptr.h:409:4
    ceph#8 0xaaaadd8ae484 in std::shared_ptr<QuiesceAgent::TrackedRoot> std::allocate_shared<QuiesceAgent::TrackedRoot, std::allocator<QuiesceAgent::TrackedRoot>, QuiesceState&, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >&>(std::allocator<QuiesceAgent::TrackedRoot> const&, QuiesceState&, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/shared_ptr.h:862:14
    ceph#9 0xaaaadd88ff0c in std::shared_ptr<QuiesceAgent::TrackedRoot> std::make_shared<QuiesceAgent::TrackedRoot, QuiesceState&, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >&>(QuiesceState&, std::chrono::duration<unsigned long, std::ratio<1l, 1000000000l> >&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/shared_ptr.h:878:14
    ceph#10 0xaaaadd884a6c in QuiesceAgent::db_update(QuiesceMap&) /root/ceph/src/mds/QuiesceAgent.cc:60:26
    ceph#11 0xaaaadd84a840 in QuiesceAgentTest::update(QuiesceDbVersion, std::initializer_list<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, QuiesceMap::RootInfo> >) /root/ceph/src/test/mds/TestQuiesceAgent.cc:156:18
    ceph#12 0xaaaadd84985c in QuiesceAgentTest::update(unsigned long, std::initializer_list<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, QuiesceMap::RootInfo> >) /root/ceph/src/test/mds/TestQuiesceAgent.cc:165:14
    ceph#13 0xaaaadd8288a8 in QuiesceAgentTest_DbUpdates_Test::TestBody() /root/ceph/src/test/mds/TestQuiesceAgent.cc:213:16
    ceph#14 0xaaaadd977230 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#15 0xaaaadd924590 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#16 0xaaaadd8d4a40 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    ceph#17 0xaaaadd8d6984 in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    ceph#18 0xaaaadd8d7f84 in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    ceph#19 0xaaaadd8f3d48 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    ceph#20 0xaaaadd981130 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#21 0xaaaadd92bb64 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#22 0xaaaadd8f31c0 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    ceph#23 0xaaaadd820710 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    ceph#24 0xaaaadd81ed3c in main /root/ceph/src/test/unit.cc:45:10
    ceph#25 0xffff814f73f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    ceph#26 0xffff814f74c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    ceph#27 0xaaaadd76e6ac in _start (/root/ceph/build/bin/unittest_mds_quiesce_agent+0x14e6ac) (BuildId: 7d45344ba1e43661d9de484f0a5d129377c4d4ae)

SUMMARY: AddressSanitizer: 184 byte(s) leaked in 2 allocation(s).
```

quiesce_requests Context should be freed.

Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
awojno-bloomberg pushed a commit to awojno-bloomberg/ceph that referenced this pull request Apr 23, 2024
When sanitizer is enabled, unittest_bluestore_types fails as following
```
[ RUN      ] sb_info_space_efficient_map_t.basic
=================================================================
==143714==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xffff99f8b7f4 at pc 0xaaaab50bde18 bp 0xffffebefcdb0 sp 0xffffebefcda8
READ of size 8 at 0xffff99f8b7f4 thread T0
    #0 0xaaaab50bde14 in sb_info_t::get_sbid() const /root/ceph/src/os/bluestore/bluestore_types.h:1337:30
    ceph#1 0xaaaab50a5908 in sb_info_space_efficient_map_t::find(unsigned long) /root/ceph/src/os/bluestore/bluestore_types.h:1385:10
    ceph#2 0xaaaab50bd638 in sb_info_space_efficient_map_t::_add(long) /root/ceph/src/os/bluestore/bluestore_types.h:1424:15
    ceph#3 0xaaaab50a52bc in sb_info_space_efficient_map_t::add_maybe_stray(unsigned long) /root/ceph/src/os/bluestore/bluestore_types.h:1358:12
    ceph#4 0xaaaab4fec03c in sb_info_space_efficient_map_t_basic_Test::TestBody() /root/ceph/src/test/objectstore/test_bluestore_types.cc:113:11
    ceph#5 0xaaaab51e9a40 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#6 0xaaaab5197040 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#7 0xaaaab51488a4 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    ceph#8 0xaaaab514a7e8 in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    ceph#9 0xaaaab514bde8 in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    ceph#10 0xaaaab5167bac in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    ceph#11 0xaaaab51f3940 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#12 0xaaaab519e5d8 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#13 0xaaaab5167024 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    ceph#14 0xaaaab50b4d6c in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    ceph#15 0xaaaab50a1080 in main /root/ceph/src/test/objectstore/test_bluestore_types.cc:2847:10
    ceph#16 0xffff9d6c73f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    ceph#17 0xffff9d6c74c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    ceph#18 0xaaaab4f3812c in _start (/root/ceph/build/bin/unittest_bluestore_types+0xe4812c) (BuildId: cb75399658026f83a4e89012de8fb02f08f6d239)

0xffff99f8b7f4 is located 0 bytes to the right of 20-byte region [0xffff99f8b7e0,0xffff99f8b7f4)
allocated by thread T0 here:
    #0 0xaaaab4fe636c in operator new[](unsigned long) (/root/ceph/build/bin/unittest_bluestore_types+0xef636c) (BuildId: cb75399658026f83a4e89012de8fb02f08f6d239)
    ceph#1 0xaaaab50c0d2c in mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t>::allocate(unsigned long, void*) /root/ceph/src/include/mempool.h:375:33
    ceph#2 0xaaaab50c0c0c in std::allocator_traits<mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t> >::allocate(mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t>&, unsigned long) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/alloc_traits.h:318:20
    ceph#3 0xaaaab50c044c in std::_Vector_base<sb_info_t, mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t> >::_M_allocate(unsigned long) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/stl_vector.h:346:20
    ceph#4 0xaaaab50bf954 in void std::vector<sb_info_t, mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t> >::_M_realloc_insert<long&>(__gnu_cxx::__normal_iterator<sb_info_t*, std::vector<sb_info_t, mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t> > >, long&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/vector.tcc:440:33
    ceph#5 0xaaaab50be0d8 in sb_info_t& std::vector<sb_info_t, mempool::pool_allocator<(mempool::pool_index_t)11, sb_info_t> >::emplace_back<long&>(long&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/vector.tcc:121:4
    ceph#6 0xaaaab50bd760 in sb_info_space_efficient_map_t::_add(long) /root/ceph/src/os/bluestore/bluestore_types.h:1429:24
    ceph#7 0xaaaab50a5e78 in sb_info_space_efficient_map_t::add_or_adopt(unsigned long) /root/ceph/src/os/bluestore/bluestore_types.h:1361:15
    ceph#8 0xaaaab4feb07c in sb_info_space_efficient_map_t_basic_Test::TestBody() /root/ceph/src/test/objectstore/test_bluestore_types.cc:103:11
    ceph#9 0xaaaab51e9a40 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#10 0xaaaab5197040 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#11 0xaaaab51488a4 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    ceph#12 0xaaaab514a7e8 in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    ceph#13 0xaaaab514bde8 in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    ceph#14 0xaaaab5167bac in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    ceph#15 0xaaaab51f3940 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#16 0xaaaab519e5d8 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#17 0xaaaab5167024 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    ceph#18 0xaaaab50b4d6c in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    ceph#19 0xaaaab50a1080 in main /root/ceph/src/test/objectstore/test_bluestore_types.cc:2847:10
    ceph#20 0xffff9d6c73f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    ceph#21 0xffff9d6c74c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    ceph#22 0xaaaab4f3812c in _start (/root/ceph/build/bin/unittest_bluestore_types+0xe4812c) (BuildId: cb75399658026f83a4e89012de8fb02f08f6d239)

SUMMARY: AddressSanitizer: heap-buffer-overflow /root/ceph/src/os/bluestore/bluestore_types.h:1337:30 in sb_info_t::get_sbid() const
Shadow bytes around the buggy address:
  0x200ff33f16a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f16b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f16c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f16d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f16e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x200ff33f16f0: fa fa fa fa fa fa fa fa fa fa fa fa 00 00[04]fa
  0x200ff33f1700: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f1710: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f1720: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f1730: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x200ff33f1740: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==143714==ABORTING
```

'it' might be invalid, so before using 'it', need to figure validity out

Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
awojno-bloomberg pushed a commit to awojno-bloomberg/ceph that referenced this pull request Apr 23, 2024
When sanitizer is enabled, unittest__rgw_crypto shows

```
=================================================================
==136464==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 75023 byte(s) in 22 object(s) allocated from:
    #0 0xaaaabf7fb86c in operator new[](unsigned long) (/root/ceph/build/bin/unittest_rgw_crypto+0x48b86c) (BuildId: 8023dc30820215da92d6d4883620bedd8ac1190d)
    ceph#1 0xaaaabf81db48 in TestRGWCrypto_verify_Encrypt_Decrypt_Test::TestBody() /root/ceph/src/test/rgw/test_rgw_crypto.cc:780:24
    ceph#2 0xaaaabf9018ac in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#3 0xaaaabf8b08a4 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#4 0xaaaabf861f88 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    ceph#5 0xaaaabf863ecc in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    ceph#6 0xaaaabf8654cc in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    ceph#7 0xaaaabf881290 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    ceph#8 0xaaaabf90b7ac in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#9 0xaaaabf8b7ac0 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#10 0xaaaabf880708 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    ceph#11 0xaaaabf823d70 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    ceph#12 0xaaaabf81f390 in main /root/ceph/src/test/rgw/test_rgw_crypto.cc:822:10
    ceph#13 0xffff878673f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    ceph#14 0xffff878674c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    ceph#15 0xaaaabf74d62c in _start (/root/ceph/build/bin/unittest_rgw_crypto+0x3dd62c) (BuildId: 8023dc30820215da92d6d4883620bedd8ac1190d)

SUMMARY: AddressSanitizer: 75023 byte(s) leaked in 22 allocation(s).
```

test_in should be freed to address the warning.

Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
awojno-bloomberg pushed a commit to awojno-bloomberg/ceph that referenced this pull request Apr 23, 2024
When sanitizer is enabled, unittest_osdscrub shows

```
=================================================================
==1633952==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 28 byte(s) in 1 object(s) allocated from:
    #0 0xaaaab4e108e0 in malloc (/root/ceph/build/bin/unittest_osdscrub+0x1ed08e0) (BuildId: b3cfa2137be96d75535beecf0f2500cec10c7550)
    ceph#1 0xffffa8cac2f8 in __res_context_send resolv/./resolv/res_send.c:334:9
    ceph#2 0xffffa8ca9c54 in __res_context_query resolv/./resolv/res_query.c:216:6
    ceph#3 0xffffa8caa4a8 in __res_context_querydomain resolv/./resolv/res_query.c:625:9
    ceph#4 0xffffa8caa4a8 in __res_context_search resolv/./resolv/res_query.c:381:9
    ceph#5 0xffffa8caaa20 in context_search_common resolv/./resolv/res_query.c:550:16
    ceph#6 0xffffa8caaa20 in res_nsearch resolv/./resolv/res_query.c:563:10
    ceph#7 0xffffabbf1f64 in ceph::ResolvHWrapper::res_nsearch(__res_state*, char const*, int, int, unsigned char*, int) /root/ceph/src/common/dns_resolve.cc:37:10
    ceph#8 0xffffabbf6574 in ceph::DNSResolver::resolve_srv_hosts(ceph::common::CephContext*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, ceph::DNSResolver::SRV_Protocol, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, ceph::DNSResolver::Record, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, ceph::DNSResolver::Record> > >*) /root/ceph/src/common/dns_resolve.cc:295:19
    ceph#9 0xffffac8edaf0 in MonMap::init_with_dns_srv(ceph::common::CephContext*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, std::ostream&) /root/ceph/src/mon/MonMap.cc:935:36
    ceph#10 0xffffac8eeec8 in MonMap::build_initial(ceph::common::CephContext*, bool, std::ostream&) /root/ceph/src/mon/MonMap.cc:1014:20
    ceph#11 0xffffac85beb0 in MonClient::build_initial_monmap() /root/ceph/src/mon/MonClient.cc:93:18
    ceph#12 0xaaaab4e50d98 in TestOSDScrub_scrub_time_permit_Test::TestBody() /root/ceph/src/test/osd/TestOSDScrub.cc:73:6
    ceph#13 0xaaaab4f655b0 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#14 0xaaaab4f16264 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#15 0xaaaab4ec6ca8 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    ceph#16 0xaaaab4ec8bec in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    ceph#17 0xaaaab4eca1ec in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    ceph#18 0xaaaab4ee5fb0 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    ceph#19 0xaaaab4f6f4c4 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#20 0xaaaab4f1d4bc in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#21 0xaaaab4ee5428 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    ceph#22 0xaaaab4e4b790 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    ceph#23 0xaaaab4e49dbc in main /root/ceph/src/test/unit.cc:45:10
    ceph#24 0xffffa8bc73f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    ceph#25 0xffffa8bc74c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    ceph#26 0xaaaab4d9972c in _start (/root/ceph/build/bin/unittest_osdscrub+0x1e5972c) (BuildId: b3cfa2137be96d75535beecf0f2500cec10c7550)

-----------------------------------------------------
Suppressions used:
  count      bytes template
      1         45 ^MallocExtension::Initialize
-----------------------------------------------------

SUMMARY: AddressSanitizer: 28 byte(s) leaked in 1 allocation(s).
```

1. 'res_ninit/res_nquery' memory should be freed.

Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
awojno-bloomberg pushed a commit to awojno-bloomberg/ceph that referenced this pull request Apr 23, 2024
…ntrusive_ptr get

When sanitizer is on, unittest_rgw_iam_policy shows

```
=================================================================
==2957634==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 9936 byte(s) in 1 object(s) allocated from:
    #0 0xaaaae4496248 in operator new(unsigned long) (/root/ceph-19.0.0/build/bin/unittest_bluestore_types+0xef6248) (BuildId: f63b15ff165fbd81074275a31e37535a1938809e)
    ceph#1 0xaaaae46b8624 in BlueStore::OnodeCacheShard::create(ceph::common::CephContext*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, ceph::common::PerfCounters*) /root/ceph-19.0.0/src/os/bluestore/BlueStore.cc:1187:7
    ceph#2 0xaaaae44fa8a0 in Blob_put_ref_Test::TestBody() /root/ceph-19.0.0/src/test/objectstore/test_bluestore_types.cc:883:38
    ceph#3 0xaaaae4699aa8 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#4 0xaaaae46470a8 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#5 0xaaaae45f890c in testing::Test::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2680:5
    ceph#6 0xaaaae45fa850 in testing::TestInfo::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2858:11
    ceph#7 0xaaaae45fbe50 in testing::TestSuite::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:3012:28
    ceph#8 0xaaaae4617c14 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:5723:44
    ceph#9 0xaaaae46a39a8 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#10 0xaaaae464e640 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#11 0xaaaae461708c in testing::UnitTest::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:5306:10
    ceph#12 0xaaaae4564dd4 in RUN_ALL_TESTS() /root/ceph-19.0.0/src/googletest/googletest/include/gtest/gtest.h:2486:46
    ceph#13 0xaaaae4551080 in main /root/ceph-19.0.0/src/test/objectstore/test_bluestore_types.cc:2847:10
    ceph#14 0xffff998b73f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    ceph#15 0xffff998b74c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    ceph#16 0xaaaae43e812c in _start (/root/ceph-19.0.0/build/bin/unittest_bluestore_types+0xe4812c) (BuildId: f63b15ff165fbd81074275a31e37535a1938809e)

Direct leak of 9936 byte(s) in 1 object(s) allocated from:
    #0 0xaaaae4496248 in operator new(unsigned long) (/root/ceph-19.0.0/build/bin/unittest_bluestore_types+0xef6248) (BuildId: f63b15ff165fbd81074275a31e37535a1938809e)
    ceph#1 0xaaaae46b8624 in BlueStore::OnodeCacheShard::create(ceph::common::CephContext*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, ceph::common::PerfCounters*) /root/ceph-19.0.0/src/os/bluestore/BlueStore.cc:1187:7
    ceph#2 0xaaaae458ad68 in ExtentMapFixture::ExtentMapFixture() /root/ceph-19.0.0/src/test/objectstore/test_bluestore_types.cc:1307:10
    ceph#3 0xaaaae4595414 in ExtentMapFixture_pollock_Test::ExtentMapFixture_pollock_Test() /root/ceph-19.0.0/src/test/objectstore/test_bluestore_types.cc:1572:1
    ceph#4 0xaaaae4595304 in testing::internal::TestFactoryImpl<ExtentMapFixture_pollock_Test>::CreateTest() /root/ceph-19.0.0/src/googletest/googletest/include/gtest/internal/gtest-internal.h:472:44
    ceph#5 0xaaaae469a054 in testing::Test* testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#6 0xaaaae4647fcc in testing::Test* testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#7 0xaaaae45fa82c in testing::TestInfo::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2848:22
    ceph#8 0xaaaae45fbe50 in testing::TestSuite::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:3012:28
    ceph#9 0xaaaae4617c14 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:5723:44
    ceph#10 0xaaaae46a39a8 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#11 0xaaaae464e640 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#12 0xaaaae461708c in testing::UnitTest::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:5306:10
    ceph#13 0xaaaae4564dd4 in RUN_ALL_TESTS() /root/ceph-19.0.0/src/googletest/googletest/include/gtest/gtest.h:2486:46
    ceph#14 0xaaaae4551080 in main /root/ceph-19.0.0/src/test/objectstore/test_bluestore_types.cc:2847:10
    ceph#15 0xffff998b73f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    ceph#16 0xffff998b74c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    ceph#17 0xaaaae43e812c in _start (/root/ceph-19.0.0/build/bin/unittest_bluestore_types+0xe4812c) (BuildId: f63b15ff165fbd81074275a31e37535a1938809e)

Direct leak of 9936 byte(s) in 1 object(s) allocated from:
    #0 0xaaaae4496248 in operator new(unsigned long) (/root/ceph-19.0.0/build/bin/unittest_bluestore_types+0xef6248) (BuildId: f63b15ff165fbd81074275a31e37535a1938809e)
    ceph#1 0xaaaae46b8624 in BlueStore::OnodeCacheShard::create(ceph::common::CephContext*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, ceph::common::PerfCounters*) /root/ceph-19.0.0/src/os/bluestore/BlueStore.cc:1187:7
    ceph#2 0xaaaae45102ac in ExtentMap_has_any_lextents_Test::TestBody() /root/ceph-19.0.0/src/test/objectstore/test_bluestore_types.cc:1154:36
    ceph#3 0xaaaae4699aa8 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#4 0xaaaae46470a8 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#5 0xaaaae45f890c in testing::Test::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2680:5
    ceph#6 0xaaaae45fa850 in testing::TestInfo::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2858:11
    ceph#7 0xaaaae45fbe50 in testing::TestSuite::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:3012:28
    ceph#8 0xaaaae4617c14 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:5723:44
    ceph#9 0xaaaae46a39a8 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#10 0xaaaae464e640 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#11 0xaaaae461708c in testing::UnitTest::Run() /root/ceph-19.0.0/src/googletest/googletest/src/gtest.cc:5306:10
    ceph#12 0xaaaae4564dd4 in RUN_ALL_TESTS() /root/ceph-19.0.0/src/googletest/googletest/include/gtest/gtest.h:2486:46
    ceph#13 0xaaaae4551080 in main /root/ceph-19.0.0/src/test/objectstore/test_bluestore_types.cc:2847:10
    ceph#14 0xffff998b73f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    ceph#15 0xffff998b74c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    ceph#16 0xaaaae43e812c in _start (/root/ceph-19.0.0/build/bin/unittest_bluestore_types+0xe4812c) (BuildId: f63b15ff165fbd81074275a31e37535a1938809e)

...
...
...
Indirect leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0xaaaacf905688 in operator new(unsigned long) (/root/ceph/build/bin/unittest_rgw_iam_policy+0x25f5688) (BuildId: c8dd019430a8d0162485760a78979347f29d225f)
    ceph#1 0xffff7f0b7ca8 in ceph::common::CephContext::CephContext(unsigned int, ceph::common::CephContext::create_options const&) /root/ceph/src/common/ceph_context.cc:781:24
    ceph#2 0xffff7f0b514c in ceph::common::CephContext::CephContext(unsigned int, code_environment_t, int) /root/ceph/src/common/ceph_context.cc:697:5
    ceph#3 0xaaaacf997dcc in ManagedPolicyTest::ManagedPolicyTest() /root/ceph/src/test/rgw/test_rgw_iam_policy.cc:788:33
    ceph#4 0xaaaacf998294 in ManagedPolicyTest_IAMReadOnlyAccess_Test::ManagedPolicyTest_IAMReadOnlyAccess_Test() /root/ceph/src/test/rgw/test_rgw_iam_policy.cc:802:1
    ceph#5 0xaaaacf998230 in testing::internal::TestFactoryImpl<ManagedPolicyTest_IAMReadOnlyAccess_Test>::CreateTest() /root/ceph/src/googletest/googletest/include/gtest/internal/gtest-internal.h:472:44
    ceph#6 0xaaaacfb1a2d4 in testing::Test* testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#7 0xaaaacfaced5c in testing::Test* testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#8 0xaaaacfa83274 in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2848:22
    ceph#9 0xaaaacfa84898 in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    ceph#10 0xaaaacfaa065c in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    ceph#11 0xaaaacfb23b9c in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#12 0xaaaacfad4968 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#13 0xaaaacfa9fad4 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    ceph#14 0xaaaacfa23588 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    ceph#15 0xaaaacfa23504 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    ceph#16 0xffff7c5a73f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    ceph#17 0xffff7c5a74c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    ceph#18 0xaaaacf85756c in _start (/root/ceph/build/bin/unittest_rgw_iam_policy+0x254756c) (BuildId: c8dd019430a8d0162485760a78979347f29d225f)

Indirect leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0xaaaacf905688 in operator new(unsigned long) (/root/ceph/build/bin/unittest_rgw_iam_policy+0x25f5688) (BuildId: c8dd019430a8d0162485760a78979347f29d225f)
    ceph#1 0xffff7f0b7ca8 in ceph::common::CephContext::CephContext(unsigned int, ceph::common::CephContext::create_options const&) /root/ceph/src/common/ceph_context.cc:781:24
    ceph#2 0xffff7f0b514c in ceph::common::CephContext::CephContext(unsigned int, code_environment_t, int) /root/ceph/src/common/ceph_context.cc:697:5
    ceph#3 0xaaaacf997dcc in ManagedPolicyTest::ManagedPolicyTest() /root/ceph/src/test/rgw/test_rgw_iam_policy.cc:788:33
    ceph#4 0xaaaacf997d08 in ManagedPolicyTest_IAMFullAccess_Test::ManagedPolicyTest_IAMFullAccess_Test() /root/ceph/src/test/rgw/test_rgw_iam_policy.cc:791:1
    ceph#5 0xaaaacf997ca4 in testing::internal::TestFactoryImpl<ManagedPolicyTest_IAMFullAccess_Test>::CreateTest() /root/ceph/src/googletest/googletest/include/gtest/internal/gtest-internal.h:472:44
    ceph#6 0xaaaacfb1a2d4 in testing::Test* testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#7 0xaaaacfaced5c in testing::Test* testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#8 0xaaaacfa83274 in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2848:22
    ceph#9 0xaaaacfa84898 in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    ceph#10 0xaaaacfaa065c in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    ceph#11 0xaaaacfb23b9c in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    ceph#12 0xaaaacfad4968 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    ceph#13 0xaaaacfa9fad4 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    ceph#14 0xaaaacfa23588 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    ceph#15 0xaaaacfa23504 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    ceph#16 0xffff7c5a73f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    ceph#17 0xffff7c5a74c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    ceph#18 0xaaaacf85756c in _start (/root/ceph/build/bin/unittest_rgw_iam_policy+0x254756c) (BuildId: c8dd019430a8d0162485760a78979347f29d225f)

SUMMARY: AddressSanitizer: 67625436 byte(s) leaked in 21960 allocation(s).
```

To avoid memory not free, use reset for not increasing RC and keep code uniformity as above codes.

Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
awojno-bloomberg pushed a commit to awojno-bloomberg/ceph that referenced this pull request Apr 23, 2024
When sanitizer is enabled, result shows as following

```
=================================================================
==207167==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5148fcc in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1664:7
    #2 0xaaaac50ff7dc in PITest_past_intervals_ec_Test::TestBody() /root/ceph/src/test/osd/types.cc:1707:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5148fcc in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1664:7
    #2 0xaaaac510ac3c in PITest_past_intervals_ec_no_subsets_Test::TestBody() /root/ceph/src/test/osd/types.cc:1799:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5148fcc in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1664:7
    #2 0xaaaac50fce54 in PITest_past_intervals_rep_Test::TestBody() /root/ceph/src/test/osd/types.cc:1683:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5149264 in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1673:7
    #2 0xaaaac5107e3c in PITest_past_intervals_rep_no_subsets_Test::TestBody() /root/ceph/src/test/osd/types.cc:1776:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5148fcc in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1664:7
    #2 0xaaaac5107e3c in PITest_past_intervals_rep_no_subsets_Test::TestBody() /root/ceph/src/test/osd/types.cc:1776:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5149264 in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1673:7
    #2 0xaaaac51054d0 in PITest_past_intervals_ec_down_Test::TestBody() /root/ceph/src/test/osd/types.cc:1753:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5148fcc in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1664:7
    #2 0xaaaac51054d0 in PITest_past_intervals_ec_down_Test::TestBody() /root/ceph/src/test/osd/types.cc:1753:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5149264 in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1673:7
    #2 0xaaaac510248c in PITest_past_intervals_rep_down_Test::TestBody() /root/ceph/src/test/osd/types.cc:1729:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5149264 in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1673:7
    #2 0xaaaac51109b0 in PITest_past_intervals_rep_lost_Test::TestBody() /root/ceph/src/test/osd/types.cc:1846:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5148fcc in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1664:7
    #2 0xaaaac51109b0 in PITest_past_intervals_rep_lost_Test::TestBody() /root/ceph/src/test/osd/types.cc:1846:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5149264 in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1673:7
    #2 0xaaaac510dc88 in PITest_past_intervals_ec_no_subsets2_Test::TestBody() /root/ceph/src/test/osd/types.cc:1822:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5148fcc in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1664:7
    #2 0xaaaac510dc88 in PITest_past_intervals_ec_no_subsets2_Test::TestBody() /root/ceph/src/test/osd/types.cc:1822:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5149264 in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1673:7
    #2 0xaaaac510ac3c in PITest_past_intervals_ec_no_subsets_Test::TestBody() /root/ceph/src/test/osd/types.cc:1799:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5149264 in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1673:7
    #2 0xaaaac50fce54 in PITest_past_intervals_rep_Test::TestBody() /root/ceph/src/test/osd/types.cc:1683:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5149264 in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1673:7
    #2 0xaaaac5113760 in PITest_past_intervals_ec_lost_Test::TestBody() /root/ceph/src/test/osd/types.cc:1870:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5148fcc in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1664:7
    #2 0xaaaac5113760 in PITest_past_intervals_ec_lost_Test::TestBody() /root/ceph/src/test/osd/types.cc:1870:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5149264 in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1673:7
    #2 0xaaaac50ff7dc in PITest_past_intervals_ec_Test::TestBody() /root/ceph/src/test/osd/types.cc:1707:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac50a2c48 in operator new(unsigned long) (/root/ceph/build/bin/unittest_osd_types+0x242c48) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)
    #1 0xaaaac5148fcc in PITest::run(bool, std::__cxx11::list<PastIntervals::pg_interval_t, std::allocator<PastIntervals::pg_interval_t> >, unsigned int, unsigned int, std::vector<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> >, std::allocator<std::pair<int, std::pair<PastIntervals::osd_state_t, unsigned int> > > >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::set<pg_shard_t, std::less<pg_shard_t>, std::allocator<pg_shard_t> >, std::set<int, std::less<int>, std::allocator<int> >, std::map<int, unsigned int, std::less<int>, std::allocator<std::pair<int const, unsigned int> > >, bool) /root/ceph/src/test/osd/types.cc:1664:7
    #2 0xaaaac510248c in PITest_past_intervals_rep_down_Test::TestBody() /root/ceph/src/test/osd/types.cc:1729:3
    #3 0xaaaac531ee18 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #4 0xaaaac52d27bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #5 0xaaaac5285848 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #6 0xaaaac528778c in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #7 0xaaaac5288d8c in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #8 0xaaaac52a4b50 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #9 0xaaaac5326548 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #10 0xaaaac52d9500 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #11 0xaaaac52a3fc8 in testing::UnitTest::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:5306:10
    #12 0xaaaac5226f84 in RUN_ALL_TESTS() /root/ceph/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #13 0xaaaac5226f00 in main /root/ceph/src/googletest/googlemock/src/gmock_main.cc:70:10
    #14 0xffff930273f8 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0xffff930274c8 in __libc_start_main csu/../csu/libc-start.c:392:3
    #16 0xaaaac4ff4b2c in _start (/root/ceph/build/bin/unittest_osd_types+0x194b2c) (BuildId: 54d356bd0f2daa8bb228f480da3ed4fd9ac8f632)

SUMMARY: AddressSanitizer: 288 byte(s) leaked in 18 allocation(s).
```

PriorSet::pcontdec should be freed

Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
tchaikov added a commit that referenced this pull request Apr 28, 2024
in TestErasureCodeLrc.cc, we create a `CrushWrapper` without
destroying and freeing it. and ASan points this out:
```
Indirect leak of 72000 byte(s) in 1000 object(s) allocated from:
    #0 0x559e00acc2bd in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_erasure_code_lrc+0x1ed2bd) (BuildId: 1cd93d0f231006242239eb0d81a8d677e36aeba2)
    #1 0x559e00b2bb76 in __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/ext/new_allocator.h:127:27
    #2 0x559e00b2bb00 in std::allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >::allocate(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/allocator.h:185:32
    #3 0x559e00b2bb00 in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > > >::allocate(std::allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >&, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/alloc_traits.h:464:20
    #4 0x559e00b2b9d1 in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >::_M_get_node() /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:561:16
    #5 0x559e00b2aae4 in std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> >* std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >::_M_create_node<std::piecewise_construct_t const&, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>, std::tuple<> >(std::piecewise_construct_t const&, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>&&, std::tuple<>&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:611:23
    #6 0x559e00b29520 in std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >::_M_emplace_hint_unique<std::piecewise_construct_t const&, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>, std::tuple<> >(std::_Rb_tree_const_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> >, std::piecewise_construct_t const&, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>&&, std::tuple<>&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:2431:19
    #7 0x559e00b255c2 in std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, int> > >::operator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_map.h:501:15
    #8 0x559e00b188da in CrushWrapper::set_item_name(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/crush/CrushWrapper.h:466:7
    #9 0x7feb54a4dcc2 in CrushWrapper::insert_item(ceph::common::CephContext*, int, float, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&, bool) /home/jenkins-build/build/workspace/ceph-pull-requests/src/crush/CrushWrapper.cc:1119:5
    #10 0x559e00ada922 in ErasureCodeTest_create_rule_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/erasure-code/TestErasureCodeLrc.cc:127:5
    #11 0x559e00c0e0a6 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
```

so, in this change, let's manage the lifecycle of the `CrushWrapper`
instance with a smart pointer, so that it is destroyed and free'd
properly, and this should silence the ASan warning.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
tchaikov pushed a commit that referenced this pull request May 4, 2024
When sanitizer is ON, unittest_rgw_lua shows

```
=================================================================
==3738104==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 31 byte(s) in 1 object(s) allocated from:
    #0 0xaaaac100e848 in operator new(unsigned long) (/root/ceph/build/bin/unittest_rgw_lua+0x25fe848) (BuildId: 524cddb1d44130431ac70e09896af3ab7cecef82)
    #1 0xffff9356dec0 in __gnu_cxx::new_allocator<char>::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/ext/new_allocator.h:127:27
    #2 0xffff9356de3c in std::allocator<char>::allocate(unsigned long) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/allocator.h:185:32
    #3 0xffff9356de3c in std::allocator_traits<std::allocator<char> >::allocate(std::allocator<char>&, unsigned long) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/alloc_traits.h:464:20
    #4 0xffff9356db3c in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.tcc:153:14
    #5 0xffff93570bb0 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*, std::forward_iterator_tag) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.tcc:219:14
    #6 0xffff935e1bbc in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char const*>(char const*, char const*, std::__false_type) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.h:255:11
    #7 0xffff935e197c in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.h:274:4
    #8 0xffff935da484 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, unsigned long, std::allocator<char> const&) /usr/bin/../lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/basic_string.h:521:9
    #9 0xffff95b3d0ac in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > fmt::v9::to_string<char, 500ul>(fmt::v9::basic_memory_buffer<char, 500ul, std::allocator<char> > const&) /root/ceph/src/fmt/include/fmt/format.h:4050:10
    #10 0xffff95b39874 in fmt::v9::vformat[abi:cxx11](fmt::v9::basic_string_view<char>, fmt::v9::basic_format_args<fmt::v9::basic_format_context<fmt::v9::appender, char> >) /root/ceph/src/fmt/include/fmt/format-inl.h:1473:10
    #11 0xaaaac1264ab4 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > fmt::v9::format<std::basic_string_view<char, std::char_traits<char> > const&>(fmt::v9::basic_format_string<char, fmt::v9::type_identity<std::basic_string_view<char, std::char_traits<char> > const&>::type>, std::basic_string_view<char, std::char_traits<char> > const&) /root/ceph/src/fmt/include/fmt/core.h:3206:10
    #12 0xaaaac1264ab4 in rgw::lua::get_iterator_name[abi:cxx11](std::basic_string_view<char, std::char_traits<char> >) /root/ceph/src/rgw/rgw_lua_utils.h:276:10
    #13 0xaaaac1286864 in boost::container::flat_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, void>::iterator* rgw::lua::create_iterator_metadata<boost::container::flat_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, void> >(lua_State*, std::basic_string_view<char, std::char_traits<char> >, boost::container::flat_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, void>::iterator const&, boost::container::flat_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, void>::iterator const&) /root/ceph/src/rgw/rgw_lua_utils.h:295:38
    #14 0xaaaac128603c in int rgw::lua::next<boost::container::flat_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, void>, void>(lua_State*) /root/ceph/src/rgw/rgw_lua_utils.h:432:15
    #15 0xffff917d1e94  (/lib/aarch64-linux-gnu/liblua5.3.so.0+0x11e94) (BuildId: 3debb95525f7191c93f5ba6001de5c986b4cedfb)
    #16 0xffff917d20ec  (/lib/aarch64-linux-gnu/liblua5.3.so.0+0x120ec) (BuildId: 3debb95525f7191c93f5ba6001de5c986b4cedfb)
    #17 0xffff917dc32c  (/lib/aarch64-linux-gnu/liblua5.3.so.0+0x1c32c) (BuildId: 3debb95525f7191c93f5ba6001de5c986b4cedfb)
    #18 0xffff917d23b8  (/lib/aarch64-linux-gnu/liblua5.3.so.0+0x123b8) (BuildId: 3debb95525f7191c93f5ba6001de5c986b4cedfb)
    #19 0xffff917ca528  (/lib/aarch64-linux-gnu/liblua5.3.so.0+0xa528) (BuildId: 3debb95525f7191c93f5ba6001de5c986b4cedfb)
    #20 0xffff917ccf38  (/lib/aarch64-linux-gnu/liblua5.3.so.0+0xcf38) (BuildId: 3debb95525f7191c93f5ba6001de5c986b4cedfb)
    #21 0xffff917d226c in lua_pcallk (/lib/aarch64-linux-gnu/liblua5.3.so.0+0x1226c) (BuildId: 3debb95525f7191c93f5ba6001de5c986b4cedfb)
    #22 0xaaaac1232a8c in rgw::lua::request::execute(rgw::sal::Driver*, RGWREST*, OpsLogSink*, req_state*, RGWOp*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /root/ceph/src/rgw/rgw_lua_request.cc:823:9
    #23 0xaaaac1021934 in TestRGWLua_MetadataIterator_Test::TestBody() /root/ceph/src/test/rgw/test_rgw_lua.cc:628:8
    #24 0xaaaac121a40c in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #25 0xaaaac11cee0c in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14
    #26 0xaaaac1182268 in testing::Test::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2680:5
    #27 0xaaaac11841ac in testing::TestInfo::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:2858:11
    #28 0xaaaac11857ac in testing::TestSuite::Run() /root/ceph/src/googletest/googletest/src/gtest.cc:3012:28
    #29 0xaaaac11a1570 in testing::internal::UnitTestImpl::RunAllTests() /root/ceph/src/googletest/googletest/src/gtest.cc:5723:44
    #30 0xaaaac1224280 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2605:10
    #31 0xaaaac11d593c in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /root/ceph/src/googletest/googletest/src/gtest.cc:2641:14

SUMMARY: AddressSanitizer: 31 byte(s) leaked in 1 allocation(s).
```

Should avoid std::string does not be freed.
https://github.com/ceph/ceph/blob/08d35a8d8529783882dd092c73c0b27be41c4d86/src/rgw/rgw_lua_utils.h#L364,
this way should be OK.

Reported issue: llvm/llvm-project#60709
Fix:
llvm/llvm-project@c6b12b7
(clang >= 17, but CI use clang 14)

Signed-off-by: Rongqi Sun <sunrongqi@huawei.com>
tchaikov added a commit that referenced this pull request May 5, 2024
this change was created in the same spirit of b8c30a7.

in BlueFS.test_shared_alloc and BlueFS.test_shared_alloc_sparse, we
keep the return value of `fs.get_perf_counters()`, and dereference it
after umounting the fs, but the `PerfCounters*` pointer returned from
`fs.get_perf_counters()` is destroyed in `BlueFS::_shutdown_logger()`
which is in turn called by `BlueFS::umount()`. so ASan points this out:

```
==548153==ERROR: AddressSanitizer: heap-use-after-free on address 0x6110000336c0 at pc 0x7fc810326654 bp 0x7ffd869be8f0 sp 0x7ffd869be8e8
READ of size 8 at 0x6110000336c0 thread T0
    #0 0x7fc810326653 in ceph::common::PerfCounters::get(int) const /home/jenkins-build/build/workspace/ceph-pull-requests/src/common/perf_counters.cc:246:8
    #1 0x564e7a5397a5 in BlueFS_test_shared_alloc_sparse_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/objectstore/test_bluefs.cc:1265:3
    #2 0x564e7a644006 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    #3 0x564e7a5fdbc2 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    #4 0x564e7a5ae7ec in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2680:5
    #5 0x564e7a5b0822 in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2858:11
    #6 0x564e7a5b1e5b in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3012:28
    #7 0x564e7a5cf2e8 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5723:44
    #8 0x564e7a64c8b6 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    #9 0x564e7a604662 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    #10 0x564e7a5ce672 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5306:10
    #11 0x564e7a55a410 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #12 0x564e7a551295 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/objectstore/test_bluefs.cc:1609:10
    #13 0x7fc80d775d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #14 0x7fc80d775e3f in __libc_start_main csu/../csu/libc-start.c:392:3
    #15 0x564e7a4296a4 in _start (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_bluefs+0x2856a4) (BuildId: fd4e4e0b1c2f9a3b0c1a7051d8ed68b3576e3277)

0x6110000336c0 is located 0 bytes inside of 208-byte region [0x6110000336c0,0x611000033790)
freed by thread T0 here:
    #0 0x564e7a4e7b1d in operator delete(void*) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_bluefs+0x343b1d) (BuildId: fd4e4e0b1c2f9a3b0c1a7051d8ed68b3576e3277)
    #1 0x564e7a686ce3 in BlueFS::_shutdown_logger() /home/jenkins-build/build/workspace/ceph-pull-requests/src/os/bluestore/BlueFS.cc:462:3
    #2 0x564e7a6a9b55 in BlueFS::umount(bool) /home/jenkins-build/build/workspace/ceph-pull-requests/src/os/bluestore/BlueFS.cc:1076:3
    #3 0x564e7a539767 in BlueFS_test_shared_alloc_sparse_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/objectstore/test_bluefs.cc:1262:6
    #4 0x564e7a644006 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    #5 0x564e7a5fdbc2 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    #6 0x564e7a5ae7ec in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2680:5
    #7 0x564e7a5b0822 in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2858:11
    #8 0x564e7a5b1e5b in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3012:28
    #9 0x564e7a5cf2e8 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5723:44
    #10 0x564e7a64c8b6 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2605:10
    #11 0x564e7a604662 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2641:14
    #12 0x564e7a5ce672 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5306:10
    #13 0x564e7a55a410 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2486:46
    #14 0x564e7a551295 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/objectstore/test_bluefs.cc:1609:10
    #15 0x7fc80d775d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
```

in this change, instead of keeping `logger` across the `umount()` and
`mount()` calls, we get another instance of `logger`, query it for
the perf counter that we are interested, and compare the value
to see if it is unchanged.

this should address the ASan warning above.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants