From a4cd560e4a0019c023928ef506b832852526b188 Mon Sep 17 00:00:00 2001 From: Yash Pandit Date: Mon, 2 Feb 2026 17:51:23 +0530 Subject: [PATCH 1/2] Move ZMQ socket bind to poll thread to prevent blocking Signed-off-by: Yash Pandit --- common/zmqserver.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/common/zmqserver.cpp b/common/zmqserver.cpp index 353ac50..2ad46bc 100644 --- a/common/zmqserver.cpp +++ b/common/zmqserver.cpp @@ -76,15 +76,7 @@ void ZmqServer::bind() zmq_setsockopt(m_socket, ZMQ_BINDTODEVICE, m_vrf.c_str(), m_vrf.length()); } - int rc = zmq_bind(m_socket, m_endpoint.c_str()); - if (rc != 0) - { - SWSS_LOG_THROW("zmq_bind failed on endpoint: %s, zmqerrno: %d", - m_endpoint.c_str(), - zmq_errno()); - } - - SWSS_LOG_DEBUG("ZmqServer bind to endpoint: %s", m_endpoint.c_str()); + SWSS_LOG_NOTICE("ZmqServer socket created, actual bind to %s will occur asynchronously in mqPollThread to prevent blocking", m_endpoint.c_str()); startMqPollThread(); } @@ -153,6 +145,14 @@ void ZmqServer::mqPollThread() SWSS_LOG_ENTER(); SWSS_LOG_NOTICE("mqPollThread begin"); + SWSS_LOG_NOTICE("Attempting to bind to zmq endpoint: %s", m_endpoint.c_str()); + if (zmq_bind(m_socket, m_endpoint.c_str()) != 0) + { + SWSS_LOG_THROW("zmq_bind failed on endpoint: %s, zmqerrno: %d", + m_endpoint.c_str(), + zmq_errno()); + } + // zmq_poll will use less CPU zmq_pollitem_t poll_item; poll_item.fd = 0; From eed0ae8e01fd693ac6ae65025ede3835243e3a92 Mon Sep 17 00:00:00 2001 From: Yash Pandit Date: Mon, 2 Feb 2026 18:01:52 +0530 Subject: [PATCH 2/2] Corrected Logging Signed-off-by: Yash Pandit --- common/zmqserver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/zmqserver.cpp b/common/zmqserver.cpp index 2ad46bc..da9a623 100644 --- a/common/zmqserver.cpp +++ b/common/zmqserver.cpp @@ -76,7 +76,7 @@ void ZmqServer::bind() zmq_setsockopt(m_socket, ZMQ_BINDTODEVICE, m_vrf.c_str(), m_vrf.length()); } - SWSS_LOG_NOTICE("ZmqServer socket created, actual bind to %s will occur asynchronously in mqPollThread to prevent blocking", m_endpoint.c_str()); + SWSS_LOG_NOTICE("ZmqServer socket created, actual bind to %s will occur in mqPollThread to prevent blocking", m_endpoint.c_str()); startMqPollThread(); }