From: Jérémie Galarneau Date: Thu, 6 Dec 2018 20:38:14 +0000 (-0500) Subject: Fix: ensure the ht clean pipe is empty before processing quit pipe X-Git-Tag: v2.11.0-rc2~118 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f0cca1dcef7ff0de43b9d04275aa4c2bcaa12be5;p=lttng-tools.git Fix: ensure the ht clean pipe is empty before processing quit pipe 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 --- 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;