Skip to contentSkip to conversation

telemetry: detach pthreads

PATCH Applied Stephen Hemminger 3 participants 3 messages Aug 19, 2021 – Oct 1, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 telemetry: detach pthreads

There are a number telemetry threads which are created and there is nothing that does pthread_join() to wait for them. Mark these threads as detached, so that the pthread library can cleanup state when the thread exits.

---
 lib/telemetry/telemetry.c        | 2 ++
 lib/telemetry/telemetry_legacy.c | 1 +
 2 files changed, 3 insertions(+)
lib/telemetry/telemetry.c +2 -0
index 8665db8d035b..976f0a21566e 100644
@@ -490,6 +490,7 @@ telemetry_legacy_init(void)
 	pthread_setaffinity_np(t_old, sizeof(*thread_cpuset), thread_cpuset);
 	set_thread_name(t_old, "telemetry-v1");
 	TMTY_LOG(DEBUG, "Legacy telemetry socket initialized ok\n");
+	pthread_detach(t_old);
 	return 0;
 }
 
@@ -528,6 +529,7 @@ telemetry_v2_init(void)
 	}
 	pthread_setaffinity_np(t_new, sizeof(*thread_cpuset), thread_cpuset);
 	set_thread_name(t_new, "telemetry-v2");
+	pthread_detach(t_new);
 	atexit(unlink_sockets);
 
 	return 0;
lib/telemetry/telemetry_legacy.c +1 -0
index b7cd1bdd6c7b..8aba44d689b7 100644
@@ -121,6 +121,7 @@ register_client(const char *cmd __rte_unused, const char *params,
 		close(fd);
 		return -1;
 	}
+	pthread_detach(th);
 #endif /* !RTE_EXEC_ENV_WINDOWS */
 	return 0;
 }
Signature · 1 line
2.30.2
Acked-by on v1 1/1
#1 lore raw

Hi Stephen,

Quoted 12 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Thursday 19 August 2021 03:38
To: Power, Ciara <[email protected]>
Cc: [email protected]; Stephen Hemminger <[email protected]>
Subject: [PATCH] telemetry: detach pthreads

There are a number telemetry threads which are created and there is nothing that does pthread_join() to wait for them.
Mark these threads as detached, so that the pthread library can cleanup state when the thread exits.

Quoted 6 lines

---
lib/telemetry/telemetry.c | 2 ++
lib/telemetry/telemetry_legacy.c | 1 +

2 files changed, 3 insertions(+)

<snip>

Thanks for catching this,

#2 lore raw
Quoted 11 lines
Quoted 11 lines

There are a number telemetry threads which are created and there is nothing that does pthread_join() to wait for them.
Mark these threads as detached, so that the pthread library can cleanup state when the thread exits.

---
lib/telemetry/telemetry.c | 2 ++
lib/telemetry/telemetry_legacy.c | 1 +

2 files changed, 3 insertions(+)
Quoted 5 lines

<snip>

Thanks for catching this,

Applied, thanks.