From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CA41C43909; Sat, 20 Jan 2024 09:32:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4734D402AE; Sat, 20 Jan 2024 09:32:32 +0100 (CET) Received: from out203-205-221-202.mail.qq.com (out203-205-221-202.mail.qq.com [203.205.221.202]) by mails.dpdk.org (Postfix) with ESMTP id 1AEAE402AA for ; Sat, 20 Jan 2024 09:32:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1705739542; bh=pGICy/8s7IpoKmeLEKbXOz1w0JmxUm6XzrrOnQl0APE=; h=From:To:Cc:Subject:Date; b=KUmYzZmIXAHh8ESNxzX76wjtAS+9HbRTC5JXyjdaMHJcdEtIpAu1KpC6BrpGnXERd uDJI8NMZGxsoF0xqFtNOSohQqojo0J1nHaFpdNuoOZHYkMJ2C8sNHrZ2Y88J6GNIgQ lvAnyd+0IajL13/+VHYk2WgGBZ7Ffdm6+/SVSNZI= Received: from localhost.localdomain ([2408:8207:1851:a300:71c7:2812:f2e:cd5c]) by newxmesmtplogicsvrsza10-0.qq.com (NewEsmtp) with SMTP id 814B96A6; Sat, 20 Jan 2024 16:32:20 +0800 X-QQ-mid: xmsmtpt1705739540tqh4jy8w8 Message-ID: X-QQ-XMAILINFO: NK7mH5+t7Gn7zM6FZkuRYdsi8gBpI9r6Ysosx8jwuFLw0BLcV6zkF3QnSdAUAn 8s9lmfm6qF+gl/To78AqOzghsxcydT3vXhxj9D9ip6btTsBP13uq7sRRP7T29FnxI0Gw0cobV/lO 1ju3C/lid/ng/yJhNedyBkdHFfRkoVq2hZ8jZIAf9hWvbbMH6iQZRxp+7p7AExc4PHp00dYGimLy cGw4oYzcpL+kJL+xCSny4mwH+pBCgOLxIEyjR+1dDZCzEDIY5jMfzp57DaFQ0ffKIQchxeASugxc cKbZFYjUAf3ZmOJ1iC7dLWc4eLMEB1ZkQE4kh6vpS6k51a396Z9DkzJWlNzynhJKexb5ia7yyep6 lQBX3gNxileu81vtAm8xAriz6hVEj41JyZ8QzbvZKwpLj6iRPzGwqF01mTzRmeinaXiZab/p13UZ gszDWP/+8xGpauwow1S/buFXCcaEQRCV+4c/H59Rt/u4moZG1PJWDi/QldtEx4jJMjYEtPQoHqhV 0PkcLwzKjpCQXCl3kvLC1xCc7YVc4qFy7oIb9LF3hmw7uymZvDbrGYJCTqmGpyMBaqRiWnC+RdDY R0r5tmkPI942Iws8KXpowXKd8koTFKNU/8RryXZH9+9+4kCuX4gYqy0+yekGzaSqxcj34OwDSWAG Al/zrfUzEhUBoKh4aZZqd3ddtO9Y2R+IT+NYSK+8Sc2GY1M6BokJqDTaf0yL7v2FM9yItK4wux/F 2Ly3LWZmBw1AxLm4QLkMWYUlQjrusleppKwtf9kZF4ZLW3wLR0w1NGDeaUBJZSR94beKqaHfL3tl a3SXV6DIoOW0mmz12BuqAI+8dmn6fW6XiCwSYVlqy8NB44Kzfszv1RjeOhlns6NWwqqTjbkFzqw6 /GB+cldp8PJgHDHgLSnf6EhrK6AqPw1+fkJeEYdB7C9gT+okD4UB/pjm2e3NwlHb140EH4j8bS9W 993boUBXJ+V16R7fWuIuriDdqcASf5mSdKF4YoNoUhkZznQ0WaLbXDTcvATocmrM7XrSD0G0hjlQ Q6CiZncqTY9bYsCAqX X-QQ-XMRINFO: NyFYKkN4Ny6FSmKK/uo/jdU= From: Shaowei Sun <1819846787@qq.com> To: dev@dpdk.org Cc: ciara.power@intel.com Subject: [PATCH] [v2]lib/telemetry:fix telemetry conns leak in case of socket write fail Date: Sat, 20 Jan 2024 16:32:18 +0800 X-OQ-MSGID: <20240120083218.17426-1-1819846787@qq.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Telemetry can only create 10 conns by default, each of which is processed by a thread. When a thread fails to write using socket, the thread will end directly without reducing the total number of conns. This will result in the machine running for a long time, and if there are 10 failures, the telemetry will be unavailable Fixes: 6dd571fd07c3 ("telemetry: introduce new functionality") Signed-off-by: Shaowei Sun <1819846787@qq.com> --- lib/telemetry/telemetry.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c index 31e2391867..0b00c04090 100644 --- a/lib/telemetry/telemetry.c +++ b/lib/telemetry/telemetry.c @@ -378,8 +378,8 @@ client_handler(void *sock_id) "{\"version\":\"%s\",\"pid\":%d,\"max_output_len\":%d}", telemetry_version, getpid(), MAX_OUTPUT_LEN); if (write(s, info_str, strlen(info_str)) < 0) { - close(s); - return NULL; + TMTY_LOG_LINE(ERR, "Socket write base info to client failed"); + goto exit; } /* receive data is not null terminated */ @@ -404,6 +404,7 @@ client_handler(void *sock_id) bytes = read(s, buffer, sizeof(buffer) - 1); } +exit: close(s); rte_atomic_fetch_sub_explicit(&v2_clients, 1, rte_memory_order_relaxed); return NULL; -- 2.37.1 (Apple Git-137.1)