From: Jérémie Galarneau Date: Thu, 6 Dec 2018 19:47:34 +0000 (-0500) Subject: Perform the clean-up of application notify sockets in main thread X-Git-Tag: v2.12.0-rc1~706 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=faadaa3a56561aca9dbd8f10f91d1e0fc40ed7e2;p=lttng-tools.git Perform the clean-up of application notify sockets in main thread The notify sockets of applications are owned by the "notify-apps" thread. If an application exits during the course of the session daemon's life, the notify thread will take care of cleaning its associated notify socket. However, there is no teardown/clean-up code to handle their clean-up when the daemon is torn down. This change adds a new step in the sessiond clean-up code that closes closes all notify sockets present in the ust_app_by_notify_sock hash table at the time of the sessiond cleanup. Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index e2b7a083c..8c5f3f6af 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -3921,6 +3921,24 @@ void ust_app_clean_list(void) rcu_read_lock(); + /* Cleanup notify socket hash table */ + if (ust_app_ht_by_notify_sock) { + cds_lfht_for_each_entry(ust_app_ht_by_notify_sock->ht, &iter.iter, app, + notify_sock_n.node) { + struct cds_lfht_node *node; + struct ust_app *app; + + node = cds_lfht_iter_get_node(&iter.iter); + if (!node) { + continue; + } + + app = container_of(node, struct ust_app, + notify_sock_n.node); + ust_app_notify_sock_unregister(app->notify_sock); + } + } + if (ust_app_ht) { cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) { ret = lttng_ht_del(ust_app_ht, &iter); @@ -3938,14 +3956,6 @@ void ust_app_clean_list(void) } } - /* Cleanup notify socket hash table */ - if (ust_app_ht_by_notify_sock) { - cds_lfht_for_each_entry(ust_app_ht_by_notify_sock->ht, &iter.iter, app, - notify_sock_n.node) { - ret = lttng_ht_del(ust_app_ht_by_notify_sock, &iter); - assert(!ret); - } - } rcu_read_unlock(); /* Destroy is done only when the ht is empty */