Fix: ensure the ht clean pipe is empty before processing quit pipe
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 6 Dec 2018 20:38:14 +0000 (15:38 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 6 Dec 2018 21:34:34 +0000 (16:34 -0500)
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 <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/ht-cleanup.c

index 09c13fe003d7d40c5af423a5bf98634e853e0162..91c0544c3c8a28c8c8391b1d5f76b0927a48bab5 100644 (file)
@@ -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;
This page took 0.025658 seconds and 4 git commands to generate.