Fix: leak of UST app hash tables
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 9 Jun 2016 20:14:28 +0000 (16:14 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 9 Jun 2016 21:02:03 +0000 (17:02 -0400)
The ht_cleanup thread is shut down before the queue of rcu
callbacks is emptied by the rcu_barrier(). Since callbacks added
by call_rcu can push hash tables through the ht_cleanup pipe, we run
into cases where the clean-up thread has been shutdown and
hash tables pushed through the clean-up pipe are leaked.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/main.c

index 625f146fa5ab253d30c7f81d52ea261337735d32..4623579e809ac8d5cb8e59e93f6447077d24b875 100644 (file)
@@ -6228,6 +6228,13 @@ exit_init_data:
        rcu_thread_offline();
        rcu_unregister_thread();
 
+       /*
+        * Ensure all prior call_rcu are done. call_rcu callbacks may push
+        * hash tables to the ht_cleanup thread. Therefore, we ensure that
+        * the queue is empty before shutting down the clean-up thread.
+        */
+       rcu_barrier();
+
        ret = notify_thread_pipe(ht_cleanup_quit_pipe[1]);
        if (ret < 0) {
                ERR("write error on ht_cleanup quit pipe");
@@ -6257,9 +6264,6 @@ exit_health_sessiond_cleanup:
 exit_create_run_as_worker_cleanup:
 
 exit_options:
-       /* Ensure all prior call_rcu are done. */
-       rcu_barrier();
-
        sessiond_cleanup_options();
 
 exit_set_signal_handler:
This page took 0.029879 seconds and 4 git commands to generate.