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

[21654] The discovery_server example is stucked or deadlock when many readers and writers are matching with tcpv4/reilability.

Open chunyisong opened this issue 5 months ago • 1 comments

Is there an already existing issue for this?

  • [X] I have searched the existing issues

Expected behavior

The discover server example should work well when many readers and writers are matching with tcpv4/reilability,and should be closed by Ctrl+C.

Current behavior

The example can be started but stucked and can not be close by Ctrl+C.

image

Steps to reproduce

To test discover server performance when many readers and writers are matching,I add simple code to create 1000 differern topics and related (one with per topic ) 1000 writers/readers.

  1. Add simple source code only to create 1000 topics/writers/readers for matching test:
diff --git a/examples/cpp/discovery_server/ClientPublisherApp.cpp b/examples/cpp/discovery_server/ClientPublisherApp.cpp
index 52422d14a..cb05752a0 100644
--- a/examples/cpp/discovery_server/ClientPublisherApp.cpp
+++ b/examples/cpp/discovery_server/ClientPublisherApp.cpp
@@ -209,6 +209,11 @@ ClientPublisherApp::ClientPublisherApp(
     {
         throw std::runtime_error("DataWriter initialization failed");
     }
+    for (int i = 0, n = 1000; i < n; ++i) {
+        const auto& tn = config.topic_name + std::to_string(i);
+        auto topic = participant_->create_topic(tn, type_.get_type_name(), TOPIC_QOS_DEFAULT);
+        assert(publisher_->create_datawriter(topic, wqos, this) != nullptr);
+    }
 }
 
 ClientPublisherApp::~ClientPublisherApp()
diff --git a/examples/cpp/discovery_server/ClientSubscriberApp.cpp b/examples/cpp/discovery_server/ClientSubscriberApp.cpp
index a026455eb..c9b7fcf83 100644
--- a/examples/cpp/discovery_server/ClientSubscriberApp.cpp
+++ b/examples/cpp/discovery_server/ClientSubscriberApp.cpp
@@ -209,6 +209,11 @@ ClientSubscriberApp::ClientSubscriberApp(
     {
         throw std::runtime_error("DataWriter initialization failed");
     }
+    for (int i = 0, n = 1000; i < n; ++i) {
+        const auto& tn = config.topic_name + std::to_string(i);
+        auto topic = participant_->create_topic(tn, type_.get_type_name(), TOPIC_QOS_DEFAULT);
+        assert(subscriber_->create_datareader(topic, rqos, this) != nullptr);
+    }
 }
 
 ClientSubscriberApp::~ClientSubscriberApp()
  1. Open a terminal,start server app: ./discovery_serverd server --transport tcpv4
  2. Open a terminal,start publisher app: ./discovery_serverd publisher --reliable --transport tcpv4
  3. Open a terminal,start subscriber app: ./discovery_serverd subscriber --reliable --transport tcpv4
  4. After a while, all three apps are stucked or deadlock,and Ctrl+C can not kill any app.As top shown in the image above,three apps are no CPU usage,no send/receive log,Ctrl+C failed.

Fast DDS version/commit

FastDDS v3.0.0

Platform/Architecture

Ubuntu Focal 20.04 amd64

Transport layer

TCPv4

Additional context

No response

XML configuration file

No response

Relevant log output

No response

Network traffic capture

No response

chunyisong avatar Sep 13 '24 06:09 chunyisong