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.16k stars 765 forks source link

DomainParticipantFactory instance deallocater not be called when call return 0 in main function,environment:mingw64 #3590

Closed shelman-zl closed 1 year ago

shelman-zl commented 1 year ago

Is there an already existing issue for this?

Expected behavior

the test program can exit normally.

Current behavior

the test program just lock after return 0, I debug found is the DomainParticipantFactory instance deallocated function is not be called and executed.

Steps to reproduce

this is my test program: int main(int argc, char* argv) { eprosima::fastdds::dds::DomainParticipant participant = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->create_participant(1, eprosima::fastdds::dds::PARTICIPANT_QOS_DEFAULT); if (participant) { participant->close(); eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->delete_participant(participant); }

for (int i = 0; i < 10; ++i)
{
    participant = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->create_participant(2, eprosima::fastdds::dds::PARTICIPANT_QOS_DEFAULT);
    if (participant)
    {
        std::this_thread::sleep_for(std::chrono::milliseconds(100));
        participant->close();
        eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->delete_participant(participant);
    }
}
eprosima::fastrtps::rtps::RTPSDomain::stopAll();

std::cout << "Stoping..." << std::endl;
//exit(1);
//std::exit(0);

return 0;

}

Fast DDS version/commit

2.10.1 and master branch

Platform/Architecture

Windows 10 Visual Studio 2019, Other. Please specify in Additional context section.

Transport layer

UDPv4

Additional context

this problem also occurs under Mingw64 environment.

XML configuration file

No response

Relevant log output

No response

Network traffic capture

No response

shelman-zl commented 1 year ago

the DomainParticipantFactory destructor is stucked too! it is similar to #3556

MiguelCompany commented 1 year ago

@shelman-zl You don't need to call eprosima::fastrtps::rtps::RTPSDomain::stopAll();. The operations performed by that call will be automatically done by the DomainParticipantFactory destructor

shelman-zl commented 1 year ago

@MiguelCompany Yes, I also annotation off this sentence "eprosima::fastrtps::rtps::RTPSDomain::stopAll();", but this problem still exist under windows system.

shelman-zl commented 1 year ago

Hello, I have another problem, it is the rtps example "AsSocket": Reader init() function: HistoryAttributes hatt; hatt.payloadMaxSize = 255; mp_history = new ReaderHistory(hatt);

//CREATE READER
ReaderAttributes ratt;
ratt.endpoint.setEntityID(3);
Locator_t loc;
IPLocator::setIPv4(loc, ip);
loc.port = static_cast<uint16_t>(port);
ratt.endpoint.multicastLocatorList.push_back(loc);
mp_reader = RTPSDomain::createRTPSReader(mp_participant, ratt, mp_history, &m_listener);
mp_reader->enableMessagesFromUnkownWriters(true);

Writer init() function: //CREATE WRITERHISTORY HistoryAttributes hatt; hatt.payloadMaxSize = 255; mp_history = new WriterHistory(hatt);

//CREATE WRITER
WriterAttributes watt;
watt.endpoint.reliabilityKind = BEST_EFFORT;
mp_writer = RTPSDomain::createRTPSWriter(mp_participant, watt, mp_history);
if (mp_writer == nullptr)
{
    returnfalse;
}

//ADD REMOTE READER (IN THIS CASE A READER IN THE SAME MACHINE)
ReaderProxyData ratt(4u, 1u);
ratt.guid({c_GuidPrefix_Unknown, 0x304});
Locator_t loc;
IPLocator::setIPv4(loc, ip);
loc.port = static_cast<uint16_t>(port);
ratt.add_unicast_locator(loc);
mp_writer->matched_reader_add(ratt);
  1. when I wanna send data size is 5MB (5 1024 1024), it can not send this big data. 2.reader entity id is "3", but writer set is 0x304, I do not known the mutual relationship between this two different entity id.

please teach me, and let me know the meaning, thank you!

At 2023-06-15 13:38:12, "Miguel Company" @.***> wrote:

@shelman-zl You don't need to call eprosima::fastrtps::rtps::RTPSDomain::stopAll();. The operations performed by that call will be automatically done by the DomainParticipantFactory destructor

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

JLBuenoLopez commented 1 year ago

Hi @shelman-zl

In order to help you, please open one ticket for each issue. It is hard to keep track of a ticket handling several topics. Therefore, I am only going to issue the original issue. First, you should clarify your code. The snippet shared in the opening ticket mentions participant->close() instruction. Fast DDS DomainParticipant API does not provide a close API so I do not really understand how to reproduce the issue.

You state that this issue is happening in Windows 10 Visual Studio 2019 which is an officially supported platform, but at the same time, the ticket title mentions compiler MinGW64 which is not.

Please, provide clear reproducible instructions in an officially supported platform so we can analyze the reported issue. Also, consider opening other tickets in the corresponding forums according to Fast DDS CONTRIBUTING guidelines for any other issue you are experiencing.

shelman-zl commented 1 year ago

Hi @JLBuenoLopez-eProsima , I am sorry, I apologize for not describing it clearly. I have encountered this problem with the Fast-DDS library compiled with MinGW64 compiler on the Windows system, I create the participant and register the topic, this program can exchange the message data between publisher and subcriber. but when program quit, it is stucked in DomainParticipantFactory destructor function, even though I don't call eprosima::fastrtps::rtps::RTPSDomain::stopAll(); in my code.

shelman-zl commented 1 year ago

@JLBuenoLopez-eProsima If necessary, I can send you my program code with e-mail.

Mario-DL commented 1 year ago

Hi @shelman-zl,

Following @JLBuenoLopez-eProsima and in accordance with our CONTRIBUTING.md guidelines, the MinGW compiler is not an officially supported, so I am moving this issue to the corresponding discussion forum.