Fast-DDS icon indicating copy to clipboard operation
Fast-DDS copied to clipboard

Repeatedly trigger service discovery procedure will lead to memory leak

Open MengDes opened this issue 7 months ago • 1 comments

Is there an already existing issue for this?

  • [X] I have searched the existing issues

Expected behavior

two process A and B communication use dds ,and C is one participants in dds networks , proc C 's memory should be fixed

Current behavior

Repeatedl restart A or B, and C will start discovery procdure, and memory usage will sustained growth, use varlgrind we found many memory possibly lost relevant to service discovery, such as eprosima::fastrtps::rtps::PDP::addReaderProxyData

Steps to reproduce

restart A or B

Fast DDS version/commit

fast dds 2.1.4

Platform/Architecture

Ubuntu Focal 20.04 amd64

Transport layer

UDPv4

Additional context

No response

XML configuration file

No response

Relevant log output

==35441== 116,832 bytes in 227 blocks are possibly lost in loss record 2,395 of 2,408
==35441==    at 0x483C815: malloc (vg_replace_malloc.c:446)
==35441==    by 0x6E7B565: foonathan::memory::heap_alloc(unsigned long) (heap_allocator.cpp:45)
==35441==    by 0x6E7B736: foonathan::memory::detail::heap_allocator_impl::allocate(unsigned long, unsigned long) (heap_allocator.hpp:54)
==35441==    by 0x6E7B82A: foonathan::memory::detail::lowlevel_allocator<foonathan::memory::detail::heap_allocator_impl>::allocate_node(unsigned long, unsigned long) (lowlevel_allocator.hpp:55)
==35441==    by 0x6E7BBDD: decltype (({parm#2}.allocate_node)({parm#3}, {parm#4})) foonathan::memory::traits_detail::allocate_node<foonathan::memory::detail::lowlevel_allocator<foonathan::memory::detail::heap_allocator_impl> >(foonathan::memory::traits_detail::full_concept, foonathan::memory::detail::lowlevel_allocator<foonathan::memory::detail::heap_allocator_impl>&, unsigned long, unsigned long) (allocator_traits.hpp:175)
==35441==    by 0x6E7BC1A: void* foonathan::memory::traits_detail::allocate_array<foonathan::memory::detail::lowlevel_allocator<foonathan::memory::detail::heap_allocator_impl> >(foonathan::memory::traits_detail::min_concept, foonathan::memory::detail::lowlevel_allocator<foonathan::memory::detail::heap_allocator_impl>&, unsigned long, unsigned long, unsigned long) (allocator_traits.hpp:227)
==35441==    by 0x6E7B9E0: foonathan::memory::allocator_traits<foonathan::memory::detail::lowlevel_allocator<foonathan::memory::detail::heap_allocator_impl> >::allocate_array(foonathan::memory::detail::lowlevel_allocator<foonathan::memory::detail::heap_allocator_impl>&, unsigned long, unsigned long, unsigned long) (allocator_traits.hpp:315)
==35441==    by 0x6E7DDF3: foonathan::memory::growing_block_allocator<foonathan::memory::detail::lowlevel_allocator<foonathan::memory::detail::heap_allocator_impl>, 2u, 1u>::allocate_block() (memory_arena.hpp:474)
==35441==    by 0x6E7E53D: foonathan::memory::memory_arena<foonathan::memory::growing_block_allocator<foonathan::memory::detail::lowlevel_allocator<foonathan::memory::detail::heap_allocator_impl>, 2u, 1u>, false>::allocate_block() (memory_arena.hpp:354)
==35441==    by 0x6E80C29: foonathan::memory::memory_pool<foonathan::memory::node_pool, foonathan::memory::detail::lowlevel_allocator<foonathan::memory::detail::heap_allocator_impl> >::allocate_block() (memory_pool.hpp:232)
==35441==    by 0x686E336: foonathan::memory::memory_pool<foonathan::memory::node_pool, foonathan::memory::detail::lowlevel_allocator<foonathan::memory::detail::heap_allocator_impl> >::memory_pool<>(unsigned long, unsigned long) (memory_pool.hpp:82)
==35441==    by 0x6869F0A: eprosima::fastrtps::rtps::WriterProxy::WriterProxy(eprosima::fastrtps::rtps::StatefulReader*, eprosima::fastrtps::rtps::RemoteLocatorsAllocationAttributes const&, eprosima::fastrtps::ResourceLimitedContainerConfig const&) (WriterProxy.cpp:93)
==35441== 
==35441== 392,784 bytes in 147 blocks are possibly lost in loss record 2,406 of 2,408
==35441==    at 0x483CFA3: operator new(unsigned long) (vg_replace_malloc.c:487)
==35441==    by 0x6BB828A: eprosima::fastrtps::rtps::PDP::addReaderProxyData(eprosima::fastrtps::rtps::GUID_t const&, eprosima::fastrtps::rtps::GUID_t&, std::function<bool (eprosima::fastrtps::rtps::ReaderProxyData*, bool, eprosima::fastrtps::rtps::ParticipantProxyData const&)>) (PDP.cpp:818)
==35441==    by 0x6BEA912: eprosima::fastrtps::rtps::EDPBaseSUBListener::add_reader_from_change(eprosima::fastrtps::rtps::RTPSReader*, eprosima::fastrtps::rtps::ReaderHistory*, eprosima::fastrtps::rtps::CacheChange_t*, eprosima::fastrtps::rtps::EDP*, bool) (EDPSimpleListeners.cpp:216)
==35441==    by 0x6BEADF2: eprosima::fastrtps::rtps::EDPSimpleSUBListener::onNewCacheChangeAdded(eprosima::fastrtps::rtps::RTPSReader*, eprosima::fastrtps::rtps::CacheChange_t const*) (EDPSimpleListeners.cpp:266)
==35441==    by 0x6876325: eprosima::fastrtps::rtps::StatefulReader::NotifyChanges(eprosima::fastrtps::rtps::WriterProxy*) (StatefulReader.cpp:1192)
==35441==    by 0x6875E2A: eprosima::fastrtps::rtps::StatefulReader::change_received(eprosima::fastrtps::rtps::CacheChange_t*, eprosima::fastrtps::rtps::WriterProxy*, unsigned long) (StatefulReader.cpp:1111)
==35441==    by 0x6874379: eprosima::fastrtps::rtps::StatefulReader::processDataMsg(eprosima::fastrtps::rtps::CacheChange_t*) (StatefulReader.cpp:609)
==35441==    by 0x689C3F4: eprosima::fastrtps::rtps::MessageReceiver::process_data_message_without_security(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&)::{lambda(eprosima::fastrtps::rtps::RTPSReader*)#1}::operator()(eprosima::fastrtps::rtps::RTPSReader*) const (MessageReceiver.cpp:202)
==35441==    by 0x68A1373: void eprosima::fastrtps::rtps::MessageReceiver::findAllReaders<eprosima::fastrtps::rtps::MessageReceiver::process_data_message_without_security(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&)::{lambda(eprosima::fastrtps::rtps::RTPSReader*)#1}>(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::MessageReceiver::process_data_message_without_security(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&)::{lambda(eprosima::fastrtps::rtps::RTPSReader*)#1} const&) const (MessageReceiver.cpp:694)
==35441==    by 0x689C43D: eprosima::fastrtps::rtps::MessageReceiver::process_data_message_without_security(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&) (MessageReceiver.cpp:205)
==35441==    by 0x68AB372: void std::__invoke_impl<void, void (eprosima::fastrtps::rtps::MessageReceiver::*&)(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&), eprosima::fastrtps::rtps::MessageReceiver*&, eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&>(std::__invoke_memfun_deref, void (eprosima::fastrtps::rtps::MessageReceiver::*&)(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&), eprosima::fastrtps::rtps::MessageReceiver*&, eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&) (invoke.h:73)
==35441==    by 0x68AA705: std::__invoke_result<void (eprosima::fastrtps::rtps::MessageReceiver::*&)(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&), eprosima::fastrtps::rtps::MessageReceiver*&, eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&>::type std::__invoke<void (eprosima::fastrtps::rtps::MessageReceiver::*&)(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&), eprosima::fastrtps::rtps::MessageReceiver*&, eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&>(void (eprosima::fastrtps::rtps::MessageReceiver::*&)(eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&), eprosima::fastrtps::rtps::MessageReceiver*&, eprosima::fastrtps::rtps::EntityId_t const&, eprosima::fastrtps::rtps::CacheChange_t&) (invoke.h:95)
==35441== 
==35441== LEAK SUMMARY:
==35441==    definitely lost: 0 bytes in 0 blocks
==35441==    indirectly lost: 0 bytes in 0 blocks
==35441==      possibly lost: 768,640 bytes in 1,370 blocks
==35441==    still reachable: 9,388,749 bytes in 43,319 blocks
==35441==         suppressed: 0 bytes in 0 blocks
==35441== Reachable blocks (those to which a pointer was found) are not shown.
==35441== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==35441== 
==35441== For lists of detected and suppressed errors, rerun with: -s
==35441== ERROR SUMMARY: 32 errors from 32 contexts (suppressed: 0 from 0)

Network traffic capture

No response

MengDes avatar Jun 27 '24 11:06 MengDes