DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] lib/telemetry:fix telemetry conns leak in case of socket write fail
@ 2024-01-19 11:40 sunshaowei01
  2024-01-19 11:54 ` Bruce Richardson
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: sunshaowei01 @ 2024-01-19 11:40 UTC (permalink / raw)
  To: dev; +Cc: ciara.power

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

Signed-off-by: sunshaowei01 <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)


^ permalink raw reply	[flat|nested] 14+ messages in thread
* [PATCH] [v2]lib/telemetry:fix telemetry conns leak in case of socket write fail
@ 2024-01-20  8:32 Shaowei Sun
  0 siblings, 0 replies; 14+ messages in thread
From: Shaowei Sun @ 2024-01-20  8:32 UTC (permalink / raw)
  To: dev; +Cc: ciara.power

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)


^ permalink raw reply	[flat|nested] 14+ messages in thread
* [PATCH] [v2]lib/telemetry:fix telemetry conns leak in case of socket write fail
@ 2024-01-20  8:50 Shaowei Sun
  0 siblings, 0 replies; 14+ messages in thread
From: Shaowei Sun @ 2024-01-20  8:50 UTC (permalink / raw)
  To: dev; +Cc: ciara.power

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)


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-02-01 15:19 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-19 11:40 [PATCH] lib/telemetry:fix telemetry conns leak in case of socket write fail sunshaowei01
2024-01-19 11:54 ` Bruce Richardson
2024-01-19 15:42 ` Power, Ciara
2024-01-19 15:54 ` David Marchand
2024-01-20  4:18   ` =?gb18030?B?u9i4tKO6IFtQQVRDSF0gbGliL3RlbGVtZXRyeTpmaXggdGVsZW1ldHJ5IGNvbm5zIGxlYWsgaW4gY2FzZSBvZiBzb2NrZXQgd3JpdGUgZmFpbA==?= =?gb18030?B?MTgxOTg0Njc4Nw==?=
2024-01-22  9:05     ` 回复: [PATCH] lib/telemetry:fix telemetry conns leak in case of socket write fail Bruce Richardson
2024-01-20  8:58 ` [PATCH] [v2]lib/telemetry:fix " Shaowei Sun
2024-01-22  7:39   ` fengchengwen
2024-01-30  1:57 ` [PATCH] [v3]lib/telemetry:fix " Shaowei Sun
2024-02-01 13:14   ` David Marchand
2024-02-01 14:11     ` =?gb18030?B?u9i4tKO6IFtQQVRDSF0gW3YzXWxpYi90ZWxlbWV0cnk6Zml4IHRlbGVtZXRyeSBjb25ucyBsZWFrIGluIGNhc2Ugb2Ygc29ja2V0IHdyaXRlIGZhaWw=?= =?gb18030?B?IFNoYW9XZWkgU3Vu?=
2024-02-01 15:19   ` [PATCH] [v3]lib/telemetry:fix telemetry conns leak in case of socket write fail David Marchand
2024-01-20  8:32 [PATCH] [v2]lib/telemetry:fix " Shaowei Sun
2024-01-20  8:50 Shaowei Sun

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).