eProsima / Fast-DDS

The most complete DDS - Proven: Plenty of success cases. Looking for commercial support? Contact info@eprosima.com
https://eprosima.com
Apache License 2.0
2.04k stars 729 forks source link

Crash at Domain::removeParticipant() #4984

Open sribasadhikary opened 1 week ago

sribasadhikary commented 1 week ago

Is there an already existing issue for this?

Expected behavior

It shouldn't crash the program.

Current behavior

While destroyed, the program crashes at Domain::removeParticipant

Steps to reproduce

Store the eprosima::fastrtps::Participant* in an unique_ptr While the program closes, it crashes at Domain::removeParticipant

Fast DDS version/commit

2.6

Platform/Architecture

Ubuntu Focal 20.04 amd64

Transport layer

UDPv4

Additional context

[ 0] 0x00007f1d3db6ade0 eprosima::fastrtps::rtps::TopicPayloadPool::shrink(unsigned int) at ??:? (in /lib/libfastrtps.so.2.6) [ 1] 0x00007f1d3db6aec0 eprosima::fastrtps::rtps::TopicPayloadPool::release_history(eprosima::fastrtps::rtps::PoolConfig const&, bool) at ??:? (in /lib/libfastrtps.so.2.6) [ 2] 0x00007f1d3ddaf565 eprosima::fastrtps::rtps::WLP::~WLP() at ??:? (in /lib/libfastrtps.so.2.6) [ 3] 0x00007f1d3ddaf709 eprosima::fastrtps::rtps::WLP::~WLP() at ??:? (in /lib/libfastrtps.so.2.6) [ 4] 0x00007f1d3dd773e0 eprosima::fastrtps::rtps::BuiltinProtocols::~BuiltinProtocols() at ??:? (in /lib/libfastrtps.so.2.6) [ 5] 0x00007f1d3dd77559 eprosima::fastrtps::rtps::BuiltinProtocols::~BuiltinProtocols() at ??:? (in /lib/libfastrtps.so.2.6) [ 6] 0x00007f1d3dbb1b71 eprosima::fastrtps::rtps::RTPSParticipantImpl::disable() at ??:? (in /lib/libfastrtps.so.2.6) [ 7] 0x00007f1d3dbc00b6 eprosima::fastrtps::rtps::RTPSDomain::removeRTPSParticipant(eprosima::fastrtps::rtps::RTPSParticipant) at ??:? (in /lib/libfastrtps.so.2.6) [ 8] 0x00007f1d3dbd741c eprosima::fastrtps::ParticipantImpl::~ParticipantImpl() at ??:? (in /lib/libfastrtps.so.2.6) [ 9] 0x00007f1d3dbd7849 eprosima::fastrtps::ParticipantImpl::~ParticipantImpl() at ??:? (in /lib/libfastrtps.so.2.6) [ 10] 0x00007f1d3dbcb829 eprosima::fastrtps::Domain::removeParticipant(eprosima::fastrtps::Participant) at ??:? (in /lib/libfastrtps.so.2.6) [ 11] 0x00007f1d50d3e8e9 ClientCode::rtps::Participant::~Participant() at ../rtps/Participant.cpp:99 (in ourlibtargetRTPSDevice.so) [ 12] 0x00007f1d50d125d8 std::default_delete::operator()(ClientCode::rtps::Participant*) const at ../gcc-12.3.0/include/c++/12.3.0/bits/unique_ptr.h:95 (in ourlibtargetRTPSDevice.so) [ 13] 0x00007f1d56ef7f32 io::Channel::close() at Channel.cpp:195

XML configuration file

No response

Relevant log output

No response

Network traffic capture

No response

EduPonz commented 1 week ago

Hi @sribasadhikary,

I'm afraid we're going to need more information on this issue:

  1. Which version of 2.6 are you using?
  2. Could you provide the relevant code on your io::Channel::close() method?

As a side note, the Fast RTPS PubSub API you're using is deprecated in Fast DDS v2.6, you may consider switching to the DDS API.

sribasadhikary commented 1 week ago
  1. I am using FastDDS 2.6.1.
  2. I have a program that communicates using DDS and it is all successful. The Participant has both Publishers and Subscribers created from it.
  3. The crash is sporadic. I think it crashes when I close the program and still, some data is available to publish or receive.
  4. The function eprosima::fastrtps::rtps::TopicPayloadPool::shrink should have some protective measures to not crash the program while termination.
  5. The outline of the program and the APIs I use are mentioned below class Participant {   public:     Participant() participant(nullptr){} init(args...){    participant = Domain::createParticipant(PParam, (ParticipantListener)&participantListener);    participant->createPublisher<ABCDPubSubType, ABCD>(args); participant->createSubscriber<XYZPubSubType, XYZ> (args); ... ...}    ~Participant(){         Domain::removeParticipant(participant);    }    private:     eprosima::fastrtps::Participant participant_; }

int main(){     std::uniqueptr participant;     participant.reset(new Participant());     participant->init(args....)

/* more code to publish, and receive */

}