From: sunshaowei01 <1819846787@qq.com>
To: dev@dpdk.org
Cc: ciara.power@intel.com, Shaowei Sun <1819846787@qq.com>
Subject: [PATCH] lib/telemetry:fix telemetry conns leak in case of socket write fail
Date: Sat, 20 Jan 2024 00:12:05 +0800 [thread overview]
Message-ID: <tencent_B60C0D44A22BD9086CDAD53966C870E0DB0A@qq.com> (raw)
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)
next reply other threads:[~2024-01-19 16:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-19 16:12 sunshaowei01 [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-01-19 16:25 Shaowei Sun
2024-01-19 11:40 sunshaowei01
2024-01-19 11:54 ` Bruce Richardson
2024-01-19 15:42 ` Power, Ciara
2024-01-19 15:54 ` David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_B60C0D44A22BD9086CDAD53966C870E0DB0A@qq.com \
--to=1819846787@qq.com \
--cc=ciara.power@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).