From f0cca1dcef7ff0de43b9d04275aa4c2bcaa12be5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Thu, 6 Dec 2018 15:38:14 -0500 Subject: [PATCH] Fix: ensure the ht clean pipe is empty before processing quit pipe MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The ht-cleanup thread does not ensure that all data pending on its ht_clean_pipe has been read (and processed) before processing the "quit" event on the quit_pipe. This causes a number of urcu hash tables to be leaked on exit of the sessiond even though they have been pushed on the cleanup pipe. Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/ht-cleanup.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/bin/lttng-sessiond/ht-cleanup.c b/src/bin/lttng-sessiond/ht-cleanup.c index 09c13fe00..91c0544c3 100644 --- a/src/bin/lttng-sessiond/ht-cleanup.c +++ b/src/bin/lttng-sessiond/ht-cleanup.c @@ -128,6 +128,7 @@ static void *thread_ht_cleanup(void *data) health_code_update(); while (1) { + restart: DBG3("[ht-thread] Polling."); health_poll_entry(); ret = lttng_poll_wait(&events, -1); @@ -181,6 +182,13 @@ static void *thread_ht_cleanup(void *data) lttng_ht_destroy(ht); health_code_update(); + + /* + * Ensure that we never process the quit pipe + * event while there is still data available + * on the ht clean pipe. + */ + goto restart; } else if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP)) { ERR("ht cleanup pipe error"); goto error; -- 2.34.1