Skip to content

test/mon/test_election: fix memory leaks of Owner and ConnectionTracker#64065

Merged
tchaikov merged 1 commit intoceph:mainfrom
tchaikov:wip-test-mon-election-fix-leaks
Jul 1, 2025
Merged

test/mon/test_election: fix memory leaks of Owner and ConnectionTracker#64065
tchaikov merged 1 commit intoceph:mainfrom
tchaikov:wip-test-mon-election-fix-leaks

Conversation

@tchaikov
Copy link
Contributor

@tchaikov tchaikov commented Jun 20, 2025

Previously, Owner and ConnectionTracker instances were leaked when electors were removed from the map while still being referenced by lambda captures. And ASan rightly pointed this out when running connectivity.handles_removing_ranks test.

Use shared_ptr to manage their lifecycles, ensuring proper cleanup even when instances are captured by lambdas after removal from the electors map.

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

Previously, Owner and ConnectionTracker instances were leaked when
electors were removed from the map while still being referenced by
lambda captures. And ASan rightly pointed this out when running
connectivity.handles_removing_ranks test.

Use shared_ptr to manage their lifecycles, ensuring proper cleanup
even when instances are captured by lambdas after removal from the
electors map.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
@tchaikov
Copy link
Contributor Author

please see a part of the report from ASan:

==803313==ERROR: LeakSanitizer: detected memory leaks

Indirect leak of 16224 byte(s) in 338 object(s) allocated from:
    #0 0x55aa601d156d in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_mon_election+0x23d56d) (BuildId: 1af48a60853e729bbb84a5400d8aa03a01a65f50)
    #1 0x55aa6022a8de in __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<int const, double>>>::allocate(unsigned long, void const*) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/ext/new_allocator.h:127:27
    #2 0x55aa6022a870 in std::allocator<std::_Rb_tree_node<std::pair<int const, double>>>::allocate(unsigned long) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/allocator.h:185:32
    #3 0x55aa6022a870 in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<int const, double>>>>::allocate(std::allocator<std::_Rb_tree_node<std::pair<int const, double>>>&, unsigned long) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/alloc_traits.h:464:20
    #4 0x55aa6022a771 in std::_Rb_tree<int, std::pair<int const, double>, std::_Select1st<std::pair<int const, double>>, std::less<int>, std::allocator<std::pair<int const, double>>>::_M_get_node() /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:561:16
    #5 0x55aa6033b524 in std::_Rb_tree_node<std::pair<int const, double>>* std::_Rb_tree<int, std::pair<int const, double>, std::_Select1st<std::pair<int const, double>>, std::less<int>, std::allocator<std::pair<int const, double>>>::_M_create_node<std::piecewise_construct_t const&, std::tuple<int const&>, std::tuple<>>(std::piecewise_construct_t const&, std::tuple<int const&>&&, std::tuple<>&&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:611:23
    #6 0x55aa6033b30e in std::_Rb_tree_iterator<std::pair<int const, double>> std::_Rb_tree<int, std::pair<int const, double>, std::_Select1st<std::pair<int const, double>>, std::less<int>, std::allocator<std::pair<int const, double>>>::_M_emplace_hint_unique<std::piecewise_construct_t const&, std::tuple<int const&>, std::tuple<>>(std::_Rb_tree_const_iterator<std::pair<int const, double>>, std::piecewise_construct_t const&, std::tuple<int const&>&&, std::tuple<>&&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:2431:19
    #7 0x55aa6033b0fe in std::map<int, double, std::less<int>, std::allocator<std::pair<int const, double>>>::operator[](int const&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_map.h:501:15
    #8 0x55aa603398ad in std::enable_if<!denc_traits<int, void>::supported || !denc_traits<double, void>::supported, void>::type ceph::decode<int, double, std::less<int>, std::allocator<std::pair<int const, double>>, denc_traits<int, void>, denc_traits<double, void>>(std::map<int, double, std::less<int>, std::allocator<std::pair<int const, double>>>&, ceph::buffer::v15_2_0::list::iterator_impl<true>&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/include/encoding.h:1096:12
    #9 0x55aa60339124 in ConnectionReport::decode(ceph::buffer::v15_2_0::list::iterator_impl<true>&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/mon/ConnectionTracker.h:37:5
    #10 0x55aa603387ec in decode(ConnectionReport&, ceph::buffer::v15_2_0::list::iterator_impl<true>&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/mon/ConnectionTracker.h:52:1
    #11 0x55aa60324889 in std::enable_if<!denc_traits<int, void>::supported || !denc_traits<ConnectionReport, void>::supported, void>::type ceph::decode<int, ConnectionReport, std::less<int>, std::allocator<std::pair<int const, ConnectionReport>>, denc_traits<int, void>, denc_traits<ConnectionReport, void>>(std::map<int, ConnectionReport, std::less<int>, std::allocator<std::pair<int const, ConnectionReport>>>&, ceph::buffer::v15_2_0::list::iterator_impl<true>&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/include/encoding.h:1096:5
    #12 0x55aa6031d418 in ConnectionTracker::decode(ceph::buffer::v15_2_0::list::iterator_impl<true>&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/mon/ConnectionTracker.cc:473:3
    #13 0x55aa601f9236 in ConnectionTracker::ConnectionTracker(ceph::buffer::v15_2_0::list const&, ceph::common::CephContext*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/mon/ConnectionTracker.h:201:5
    #14 0x55aa601d5cba in Election::propose_to(int, int, unsigned int, ceph::buffer::v15_2_0::list&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:388:15
    #15 0x55aa6020180d in Owner::propose_to_peers(unsigned int, ceph::buffer::v15_2_0::list&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:147:15
    #16 0x55aa602f7b5d in ElectionLogic::start() /home/jenkins-build/build/workspace/ceph-pull-requests/src/mon/ElectionLogic.cc:148:12
    #17 0x55aa601d7c14 in Election::start_all() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:459:21
    #18 0x55aa601f2663 in handles_removing_ranks(ElectionLogic::election_strategy) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:978:16
    #19 0x55aa601f3885 in connectivity_handles_removing_ranks_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:1030:1
    #20 0x55aa602e312d 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:2653:10
    #21 0x55aa602a1935 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:2689:14
    #22 0x55aa6025b7ad in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2728:5
    #23 0x55aa6025cf2c in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2874:11
    #24 0x55aa6025e3a5 in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3052:30
    #25 0x55aa6027ec04 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:6004:44
    #26 0x55aa602ec78d 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:2653:10
    #27 0x55aa602a693a 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:2689:14
    #28 0x55aa6027dff9 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5583:10
    #29 0x55aa601f7000 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2334:73
    #30 0x55aa601d3e67 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:39:10

Indirect leak of 13520 byte(s) in 338 object(s) allocated from:
    #0 0x55aa601d156d in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_mon_election+0x23d56d) (BuildId: 1af48a60853e729bbb84a5400d8aa03a01a65f50)
    #1 0x55aa60307a7e in __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<int const, bool>>>::allocate(unsigned long, void const*) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/ext/new_allocator.h:127:27
    #2 0x55aa60307a10 in std::allocator<std::_Rb_tree_node<std::pair<int const, bool>>>::allocate(unsigned long) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/allocator.h:185:32
    #3 0x55aa60307a10 in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<int const, bool>>>>::allocate(std::allocator<std::_Rb_tree_node<std::pair<int const, bool>>>&, unsigned long) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/alloc_traits.h:464:20
    #4 0x55aa60307921 in std::_Rb_tree<int, std::pair<int const, bool>, std::_Select1st<std::pair<int const, bool>>, std::less<int>, std::allocator<std::pair<int const, bool>>>::_M_get_node() /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:561:16
    #5 0x55aa6033adbc in std::_Rb_tree_node<std::pair<int const, bool>>* std::_Rb_tree<int, std::pair<int const, bool>, std::_Select1st<std::pair<int const, bool>>, std::less<int>, std::allocator<std::pair<int const, bool>>>::_M_create_node<std::pair<int const, bool>>(std::pair<int const, bool>&&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:611:23
    #6 0x55aa6033abb2 in std::_Rb_tree_iterator<std::pair<int const, bool>> std::_Rb_tree<int, std::pair<int const, bool>, std::_Select1st<std::pair<int const, bool>>, std::less<int>, std::allocator<std::pair<int const, bool>>>::_M_emplace_hint_unique<std::pair<int const, bool>>(std::_Rb_tree_const_iterator<std::pair<int const, bool>>, std::pair<int const, bool>&&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:2431:19
    #7 0x55aa6033aa5e in std::_Rb_tree_iterator<std::pair<int const, bool>> std::map<int, bool, std::less<int>, std::allocator<std::pair<int const, bool>>>::emplace_hint<std::pair<int const, bool>>(std::_Rb_tree_const_iterator<std::pair<int const, bool>>, std::pair<int const, bool>&&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_map.h:608:16
    #8 0x55aa6033a845 in void _denc::maplike_details<std::map<int, bool, std::less<int>, std::allocator<std::pair<int const, bool>>>>::insert<std::pair<int const, bool>>(std::map<int, bool, std::less<int>, std::allocator<std::pair<int const, bool>>>&, std::pair<int const, bool>&&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/include/denc.h:1218:9
    #9 0x55aa6033a5d7 in _denc::container_base<std::map, _denc::maplike_details<std::map<int, bool, std::less<int>, std::allocator<std::pair<int const, bool>>>>, int, bool, std::less<int>, std::allocator<std::pair<int const, bool>>>::decode_nohead(unsigned long, std::map<int, bool, std::less<int>, std::allocator<std::pair<int const, bool>>>&, ceph::buffer::v15_2_0::ptr::iterator_impl<true>&, unsigned long) /home/jenkins-build/build/workspace/ceph-pull-requests/src/include/denc.h:1013:2
    #10 0x55aa60339eb7 in _denc::container_base<std::map, _denc::maplike_details<std::map<int, bool, std::less<int>, std::allocator<std::pair<int const, bool>>>>, int, bool, std::less<int>, std::allocator<std::pair<int const, bool>>>::decode(std::map<int, bool, std::less<int>, std::allocator<std::pair<int const, bool>>>&, ceph::buffer::v15_2_0::ptr::iterator_impl<true>&, unsigned long) /home/jenkins-build/build/workspace/ceph-pull-requests/src/include/denc.h:984:7
    #11 0x55aa603395de in std::enable_if<denc_traits<std::map<int, bool, std::less<int>, std::allocator<std::pair<int const, bool>>>, void>::supported && denc_traits<std::map<int, bool, std::less<int>, std::allocator<std::pair<int const, bool>>>, void>::need_contiguous, void>::type ceph::decode<std::map<int, bool, std::less<int>, std::allocator<std::pair<int const, bool>>>, denc_traits<std::map<int, bool, std::less<int>, std::allocator<std::pair<int const, bool>>>, void>>(std::map<int, bool, std::less<int>, std::allocator<std::pair<int const, bool>>>&, ceph::buffer::v15_2_0::list::iterator_impl<true>&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/include/denc.h:1731:3
    #12 0x55aa6033910d in ConnectionReport::decode(ceph::buffer::v15_2_0::list::iterator_impl<true>&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/mon/ConnectionTracker.h:36:5
    #13 0x55aa603387ec in decode(ConnectionReport&, ceph::buffer::v15_2_0::list::iterator_impl<true>&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/mon/ConnectionTracker.h:52:1
    #14 0x55aa60324889 in std::enable_if<!denc_traits<int, void>::supported || !denc_traits<ConnectionReport, void>::supported, void>::type ceph::decode<int, ConnectionReport, std::less<int>, std::allocator<std::pair<int const, ConnectionReport>>, denc_traits<int, void>, denc_traits<ConnectionReport, void>>(std::map<int, ConnectionReport, std::less<int>, std::allocator<std::pair<int const, ConnectionReport>>>&, ceph::buffer::v15_2_0::list::iterator_impl<true>&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/include/encoding.h:1096:5
    #15 0x55aa6031d418 in ConnectionTracker::decode(ceph::buffer::v15_2_0::list::iterator_impl<true>&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/mon/ConnectionTracker.cc:473:3
    #16 0x55aa601f9236 in ConnectionTracker::ConnectionTracker(ceph::buffer::v15_2_0::list const&, ceph::common::CephContext*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/mon/ConnectionTracker.h:201:5
    #17 0x55aa601d5cba in Election::propose_to(int, int, unsigned int, ceph::buffer::v15_2_0::list&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:388:15
    #18 0x55aa6020180d in Owner::propose_to_peers(unsigned int, ceph::buffer::v15_2_0::list&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:147:15
    #19 0x55aa602f7b5d in ElectionLogic::start() /home/jenkins-build/build/workspace/ceph-pull-requests/src/mon/ElectionLogic.cc:148:12
    #20 0x55aa601d7c14 in Election::start_all() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:459:21
    #21 0x55aa601f2663 in handles_removing_ranks(ElectionLogic::election_strategy) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:978:16
    #22 0x55aa601f3885 in connectivity_handles_removing_ranks_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:1030:1
    #23 0x55aa602e312d 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:2653:10
    #24 0x55aa602a1935 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:2689:14
    #25 0x55aa6025b7ad in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2728:5
    #26 0x55aa6025cf2c in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2874:11
    #27 0x55aa6025e3a5 in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3052:30
    #28 0x55aa6027ec04 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:6004:44
    #29 0x55aa602ec78d 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:2653:10
    #30 0x55aa602a693a 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:2689:14

Indirect leak of 13440 byte(s) in 84 object(s) allocated from:
    #0 0x55aa601d156d in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_mon_election+0x23d56d) (BuildId: 1af48a60853e729bbb84a5400d8aa03a01a65f50)
    #1 0x55aa6022ca21 in __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<int const, ConnectionReport>>>::allocate(unsigned long, void const*) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/ext/new_allocator.h:127:27
    #2 0x55aa6022c9b0 in std::allocator<std::_Rb_tree_node<std::pair<int const, ConnectionReport>>>::allocate(unsigned long) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/allocator.h:185:32
    #3 0x55aa6022c9b0 in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<int const, ConnectionReport>>>>::allocate(std::allocator<std::_Rb_tree_node<std::pair<int const, ConnectionReport>>>&, unsigned long) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/alloc_traits.h:464:20
    #4 0x55aa6022c8b1 in std::_Rb_tree<int, std::pair<int const, ConnectionReport>, std::_Select1st<std::pair<int const, ConnectionReport>>, std::less<int>, std::allocator<std::pair<int const, ConnectionReport>>>::_M_get_node() /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:561:16
    #5 0x55aa6032a434 in std::_Rb_tree_node<std::pair<int const, ConnectionReport>>* std::_Rb_tree<int, std::pair<int const, ConnectionReport>, std::_Select1st<std::pair<int const, ConnectionReport>>, std::less<int>, std::allocator<std::pair<int const, ConnectionReport>>>::_M_create_node<std::piecewise_construct_t const&, std::tuple<int const&>, std::tuple<>>(std::piecewise_construct_t const&, std::tuple<int const&>&&, std::tuple<>&&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:611:23
    #6 0x55aa6032a21e in std::_Rb_tree_iterator<std::pair<int const, ConnectionReport>> std::_Rb_tree<int, std::pair<int const, ConnectionReport>, std::_Select1st<std::pair<int const, ConnectionReport>>, std::less<int>, std::allocator<std::pair<int const, ConnectionReport>>>::_M_emplace_hint_unique<std::piecewise_construct_t const&, std::tuple<int const&>, std::tuple<>>(std::_Rb_tree_const_iterator<std::pair<int const, ConnectionReport>>, std::piecewise_construct_t const&, std::tuple<int const&>&&, std::tuple<>&&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:2431:19
    #7 0x55aa60320aee in std::map<int, ConnectionReport, std::less<int>, std::allocator<std::pair<int const, ConnectionReport>>>::operator[](int const&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_map.h:501:15
    #8 0x55aa6032487d in std::enable_if<!denc_traits<int, void>::supported || !denc_traits<ConnectionReport, void>::supported, void>::type ceph::decode<int, ConnectionReport, std::less<int>, std::allocator<std::pair<int const, ConnectionReport>>, denc_traits<int, void>, denc_traits<ConnectionReport, void>>(std::map<int, ConnectionReport, std::less<int>, std::allocator<std::pair<int const, ConnectionReport>>>&, ceph::buffer::v15_2_0::list::iterator_impl<true>&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/include/encoding.h:1096:12
    #9 0x55aa6031d418 in ConnectionTracker::decode(ceph::buffer::v15_2_0::list::iterator_impl<true>&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/mon/ConnectionTracker.cc:473:3
    #10 0x55aa601f9236 in ConnectionTracker::ConnectionTracker(ceph::buffer::v15_2_0::list const&, ceph::common::CephContext*) /home/jenkins-build/build/workspace/ceph-pull-requests/src/mon/ConnectionTracker.h:201:5
    #11 0x55aa601d5cba in Election::propose_to(int, int, unsigned int, ceph::buffer::v15_2_0::list&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:388:15
    #12 0x55aa6020180d in Owner::propose_to_peers(unsigned int, ceph::buffer::v15_2_0::list&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:147:15
    #13 0x55aa602f7b5d in ElectionLogic::start() /home/jenkins-build/build/workspace/ceph-pull-requests/src/mon/ElectionLogic.cc:148:12
    #14 0x55aa601d7c14 in Election::start_all() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:459:21
    #15 0x55aa601f2663 in handles_removing_ranks(ElectionLogic::election_strategy) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:978:16
    #16 0x55aa601f3885 in connectivity_handles_removing_ranks_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:1030:1
    #17 0x55aa602e312d 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:2653:10
    #18 0x55aa602a1935 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:2689:14
    #19 0x55aa6025b7ad in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2728:5
    #20 0x55aa6025cf2c in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2874:11
    #21 0x55aa6025e3a5 in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3052:30
    #22 0x55aa6027ec04 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:6004:44
    #23 0x55aa602ec78d 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:2653:10
    #24 0x55aa602a693a 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:2689:14
    #25 0x55aa6027dff9 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5583:10
    #26 0x55aa601f7000 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2334:73
    #27 0x55aa601d3e67 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:39:10
    #28 0x7fdfa92fad8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

Indirect leak of 4464 byte(s) in 18 object(s) allocated from:
    #0 0x55aa601d156d in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_mon_election+0x23d56d) (BuildId: 1af48a60853e729bbb84a5400d8aa03a01a65f50)
    #1 0x55aa601d5c74 in Election::propose_to(int, int, unsigned int, ceph::buffer::v15_2_0::list&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:388:11
    #2 0x55aa6020180d in Owner::propose_to_peers(unsigned int, ceph::buffer::v15_2_0::list&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:147:15
    #3 0x55aa602f7b5d in ElectionLogic::start() /home/jenkins-build/build/workspace/ceph-pull-requests/src/mon/ElectionLogic.cc:148:12
    #4 0x55aa601d7c14 in Election::start_all() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:459:21
    #5 0x55aa601f2663 in handles_removing_ranks(ElectionLogic::election_strategy) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:978:16
    #6 0x55aa601f3885 in connectivity_handles_removing_ranks_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:1030:1
    #7 0x55aa602e312d 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:2653:10
    #8 0x55aa602a1935 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:2689:14
    #9 0x55aa6025b7ad in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2728:5
    #10 0x55aa6025cf2c in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2874:11
    #11 0x55aa6025e3a5 in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3052:30
    #12 0x55aa6027ec04 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:6004:44
    #13 0x55aa602ec78d 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:2653:10
    #14 0x55aa602a693a 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:2689:14
    #15 0x55aa6027dff9 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5583:10
    #16 0x55aa601f7000 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2334:73
    #17 0x55aa601d3e67 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:39:10
    #18 0x7fdfa92fad8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

Indirect leak of 3200 byte(s) in 20 object(s) allocated from:
    #0 0x55aa601d156d in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_mon_election+0x23d56d) (BuildId: 1af48a60853e729bbb84a5400d8aa03a01a65f50)
    #1 0x55aa6022ca21 in __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<int const, ConnectionReport>>>::allocate(unsigned long, void const*) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/ext/new_allocator.h:127:27
    #2 0x55aa6022c9b0 in std::allocator<std::_Rb_tree_node<std::pair<int const, ConnectionReport>>>::allocate(unsigned long) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/allocator.h:185:32
    #3 0x55aa6022c9b0 in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<int const, ConnectionReport>>>>::allocate(std::allocator<std::_Rb_tree_node<std::pair<int const, ConnectionReport>>>&, unsigned long) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/alloc_traits.h:464:20
    #4 0x55aa6022c8b1 in std::_Rb_tree<int, std::pair<int const, ConnectionReport>, std::_Select1st<std::pair<int const, ConnectionReport>>, std::less<int>, std::allocator<std::pair<int const, ConnectionReport>>>::_M_get_node() /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:561:16
    #5 0x55aa6032974c in std::_Rb_tree_node<std::pair<int const, ConnectionReport>>* std::_Rb_tree<int, std::pair<int const, ConnectionReport>, std::_Select1st<std::pair<int const, ConnectionReport>>, std::less<int>, std::allocator<std::pair<int const, ConnectionReport>>>::_M_create_node<std::pair<int, ConnectionReport>>(std::pair<int, ConnectionReport>&&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:611:23
    #6 0x55aa603293fd in std::pair<std::_Rb_tree_iterator<std::pair<int const, ConnectionReport>>, bool> std::_Rb_tree<int, std::pair<int const, ConnectionReport>, std::_Select1st<std::pair<int const, ConnectionReport>>, std::less<int>, std::allocator<std::pair<int const, ConnectionReport>>>::_M_emplace_unique<std::pair<int, ConnectionReport>>(std::pair<int, ConnectionReport>&&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:2384:19
    #7 0x55aa6032051c in std::enable_if<is_constructible<std::pair<int const, ConnectionReport>, std::pair<int, ConnectionReport>>::value, std::pair<std::_Rb_tree_iterator<std::pair<int const, ConnectionReport>>, bool>>::type std::map<int, ConnectionReport, std::less<int>, std::allocator<std::pair<int const, ConnectionReport>>>::insert<std::pair<int, ConnectionReport>>(std::pair<int, ConnectionReport>&&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_map.h:817:16
    #8 0x55aa6030b9af in ConnectionTracker::reports(int) /home/jenkins-build/build/workspace/ceph-pull-requests/src/mon/ConnectionTracker.cc:49:30
    #9 0x55aa6030c579 in ConnectionTracker::receive_peer_report(ConnectionTracker const&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/mon/ConnectionTracker.cc:72:35
    #10 0x55aa6020abad in Owner::receive_scores(ceph::buffer::v15_2_0::list) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:238:18
    #11 0x55aa601f415c in Election::queue_election_message(int, int, std::function<void (bool)>)::$_0::operator()() const /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:350:5
    #12 0x55aa601f3fe4 in void std::__invoke_impl<void, Election::queue_election_message(int, int, std::function<void (bool)>)::$_0&>(std::__invoke_other, Election::queue_election_message(int, int, std::function<void (bool)>)::$_0&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:61:14
    #13 0x55aa601f3f84 in std::enable_if<is_invocable_r_v<void, Election::queue_election_message(int, int, std::function<void (bool)>)::$_0&>, void>::type std::__invoke_r<void, Election::queue_election_message(int, int, std::function<void (bool)>)::$_0&>(Election::queue_election_message(int, int, std::function<void (bool)>)::$_0&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:111:2
    #14 0x55aa601f3d2c in std::_Function_handler<void (), Election::queue_election_message(int, int, std::function<void (bool)>)::$_0>::_M_invoke(std::_Any_data const&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_function.h:290:9
    #15 0x55aa601f99f7 in std::function<void ()>::operator()() const /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_function.h:590:9
    #16 0x55aa601d700d in Election::run_timesteps(int) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:441:7
    #17 0x55aa601f0b09 in handles_removing_ranks(ElectionLogic::election_strategy) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:960:26
    #18 0x55aa601f3885 in connectivity_handles_removing_ranks_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:1030:1
    #19 0x55aa602e312d 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:2653:10
    #20 0x55aa602a1935 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:2689:14
    #21 0x55aa6025b7ad in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2728:5
    #22 0x55aa6025cf2c in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2874:11
    #23 0x55aa6025e3a5 in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3052:30
    #24 0x55aa6027ec04 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:6004:44
    #25 0x55aa602ec78d 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:2653:10
    #26 0x55aa602a693a 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:2689:14
    #27 0x55aa6027dff9 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5583:10
    #28 0x55aa601f7000 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2334:73
    #29 0x55aa601d3e67 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:39:10
    #30 0x7fdfa92fad8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

Indirect leak of 2840 byte(s) in 5 object(s) allocated from:
    #0 0x55aa601d156d in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_mon_election+0x23d56d) (BuildId: 1af48a60853e729bbb84a5400d8aa03a01a65f50)
    #1 0x55aa601d4484 in Election::Election(int, ElectionLogic::election_strategy, int, double) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:314:19
    #2 0x55aa601f0aed in handles_removing_ranks(ElectionLogic::election_strategy) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:958:14
    #3 0x55aa601f3885 in connectivity_handles_removing_ranks_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:1030:1
    #4 0x55aa602e312d 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:2653:10
    #5 0x55aa602a1935 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:2689:14
    #6 0x55aa6025b7ad in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2728:5
    #7 0x55aa6025cf2c in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2874:11
    #8 0x55aa6025e3a5 in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3052:30
    #9 0x55aa6027ec04 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:6004:44
    #10 0x55aa602ec78d 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:2653:10
    #11 0x55aa602a693a 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:2689:14
    #12 0x55aa6027dff9 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5583:10
    #13 0x55aa601f7000 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2334:73
    #14 0x55aa601d3e67 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:39:10
    #15 0x7fdfa92fad8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

Indirect leak of 2272 byte(s) in 4 object(s) allocated from:
    #0 0x55aa601d156d in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_mon_election+0x23d56d) (BuildId: 1af48a60853e729bbb84a5400d8aa03a01a65f50)
    #1 0x55aa601d4484 in Election::Election(int, ElectionLogic::election_strategy, int, double) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:314:19
    #2 0x55aa601f2635 in handles_removing_ranks(ElectionLogic::election_strategy) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:976:14
    #3 0x55aa601f3885 in connectivity_handles_removing_ranks_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:1030:1
    #4 0x55aa602e312d 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:2653:10
    #5 0x55aa602a1935 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:2689:14
    #6 0x55aa6025b7ad in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2728:5
    #7 0x55aa6025cf2c in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2874:11
    #8 0x55aa6025e3a5 in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3052:30
    #9 0x55aa6027ec04 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:6004:44
    #10 0x55aa602ec78d 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:2653:10
    #11 0x55aa602a693a 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:2689:14
    #12 0x55aa6027dff9 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5583:10
    #13 0x55aa601f7000 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2334:73
    #14 0x55aa601d3e67 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:39:10
    #15 0x7fdfa92fad8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

Indirect leak of 1920 byte(s) in 12 object(s) allocated from:
    #0 0x55aa601d156d in operator new(unsigned long) (/home/jenkins-build/build/workspace/ceph-pull-requests/build/bin/unittest_mon_election+0x23d56d) (BuildId: 1af48a60853e729bbb84a5400d8aa03a01a65f50)
    #1 0x55aa6022ca21 in __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<int const, ConnectionReport>>>::allocate(unsigned long, void const*) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/ext/new_allocator.h:127:27
    #2 0x55aa6022c9b0 in std::allocator<std::_Rb_tree_node<std::pair<int const, ConnectionReport>>>::allocate(unsigned long) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/allocator.h:185:32
    #3 0x55aa6022c9b0 in std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<int const, ConnectionReport>>>>::allocate(std::allocator<std::_Rb_tree_node<std::pair<int const, ConnectionReport>>>&, unsigned long) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/alloc_traits.h:464:20
    #4 0x55aa6022c8b1 in std::_Rb_tree<int, std::pair<int const, ConnectionReport>, std::_Select1st<std::pair<int const, ConnectionReport>>, std::less<int>, std::allocator<std::pair<int const, ConnectionReport>>>::_M_get_node() /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:561:16
    #5 0x55aa6032974c in std::_Rb_tree_node<std::pair<int const, ConnectionReport>>* std::_Rb_tree<int, std::pair<int const, ConnectionReport>, std::_Select1st<std::pair<int const, ConnectionReport>>, std::less<int>, std::allocator<std::pair<int const, ConnectionReport>>>::_M_create_node<std::pair<int, ConnectionReport>>(std::pair<int, ConnectionReport>&&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:611:23
    #6 0x55aa603293fd in std::pair<std::_Rb_tree_iterator<std::pair<int const, ConnectionReport>>, bool> std::_Rb_tree<int, std::pair<int const, ConnectionReport>, std::_Select1st<std::pair<int const, ConnectionReport>>, std::less<int>, std::allocator<std::pair<int const, ConnectionReport>>>::_M_emplace_unique<std::pair<int, ConnectionReport>>(std::pair<int, ConnectionReport>&&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:2384:19
    #7 0x55aa6032051c in std::enable_if<is_constructible<std::pair<int const, ConnectionReport>, std::pair<int, ConnectionReport>>::value, std::pair<std::_Rb_tree_iterator<std::pair<int const, ConnectionReport>>, bool>>::type std::map<int, ConnectionReport, std::less<int>, std::allocator<std::pair<int const, ConnectionReport>>>::insert<std::pair<int, ConnectionReport>>(std::pair<int, ConnectionReport>&&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_map.h:817:16
    #8 0x55aa6030b9af in ConnectionTracker::reports(int) /home/jenkins-build/build/workspace/ceph-pull-requests/src/mon/ConnectionTracker.cc:49:30
    #9 0x55aa6030c579 in ConnectionTracker::receive_peer_report(ConnectionTracker const&) /home/jenkins-build/build/workspace/ceph-pull-requests/src/mon/ConnectionTracker.cc:72:35
    #10 0x55aa6020abad in Owner::receive_scores(ceph::buffer::v15_2_0::list) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:238:18
    #11 0x55aa601f415c in Election::queue_election_message(int, int, std::function<void (bool)>)::$_0::operator()() const /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:350:5
    #12 0x55aa601f3fe4 in void std::__invoke_impl<void, Election::queue_election_message(int, int, std::function<void (bool)>)::$_0&>(std::__invoke_other, Election::queue_election_message(int, int, std::function<void (bool)>)::$_0&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:61:14
    #13 0x55aa601f3f84 in std::enable_if<is_invocable_r_v<void, Election::queue_election_message(int, int, std::function<void (bool)>)::$_0&>, void>::type std::__invoke_r<void, Election::queue_election_message(int, int, std::function<void (bool)>)::$_0&>(Election::queue_election_message(int, int, std::function<void (bool)>)::$_0&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:111:2
    #14 0x55aa601f3d2c in std::_Function_handler<void (), Election::queue_election_message(int, int, std::function<void (bool)>)::$_0>::_M_invoke(std::_Any_data const&) /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_function.h:290:9
    #15 0x55aa601f99f7 in std::function<void ()>::operator()() const /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_function.h:590:9
    #16 0x55aa601d700d in Election::run_timesteps(int) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:441:7
    #17 0x55aa601f2683 in handles_removing_ranks(ElectionLogic::election_strategy) /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:980:28
    #18 0x55aa601f3885 in connectivity_handles_removing_ranks_Test::TestBody() /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:1030:1
    #19 0x55aa602e312d 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:2653:10
    #20 0x55aa602a1935 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:2689:14
    #21 0x55aa6025b7ad in testing::Test::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2728:5
    #22 0x55aa6025cf2c in testing::TestInfo::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:2874:11
    #23 0x55aa6025e3a5 in testing::TestSuite::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:3052:30
    #24 0x55aa6027ec04 in testing::internal::UnitTestImpl::RunAllTests() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:6004:44
    #25 0x55aa602ec78d 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:2653:10
    #26 0x55aa602a693a 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:2689:14
    #27 0x55aa6027dff9 in testing::UnitTest::Run() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/src/gtest.cc:5583:10
    #28 0x55aa601f7000 in RUN_ALL_TESTS() /home/jenkins-build/build/workspace/ceph-pull-requests/src/googletest/googletest/include/gtest/gtest.h:2334:73
    #29 0x55aa601d3e67 in main /home/jenkins-build/build/workspace/ceph-pull-requests/src/test/mon/test_election.cc:39:10
    #30 0x7fdfa92fad8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

@tchaikov tchaikov requested a review from gregsfortytwo June 20, 2025 11:23
@tchaikov
Copy link
Contributor Author

@gregsfortytwo hi Greg, could you please help review this change?

@tchaikov tchaikov changed the title test/mon/test_election: fix memory leaks in Owner and ConnectionTracker test/mon/test_election: fix memory leaks of Owner and ConnectionTracker Jun 20, 2025
@tchaikov tchaikov mentioned this pull request Jun 20, 2025
14 tasks
@tchaikov
Copy link
Contributor Author

jenkins test make check arm64

@tchaikov tchaikov requested a review from kamoltat June 27, 2025 14:04
@tchaikov
Copy link
Contributor Author

hi @kamoltat could you help review this change as well?

@ronen-fr
Copy link
Contributor

LGTM

@kamoltat
Copy link
Member

hi @kamoltat could you help review this change as well?

yes @tchaikov reviewing

Copy link
Member

@kamoltat kamoltat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the changes, shared pointers make sense, provides much better safe guarding.

@kamoltat kamoltat added needs-squid-backport PR needs a squid backport needs-tentacle-backport PRs that need tentacle back-port labels Jul 1, 2025
@tchaikov tchaikov merged commit f1b2583 into ceph:main Jul 1, 2025
26 of 29 checks passed
@tchaikov tchaikov deleted the wip-test-mon-election-fix-leaks branch July 1, 2025 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mon needs-squid-backport PR needs a squid backport needs-tentacle-backport PRs that need tentacle back-port tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants