X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-consumerd%2Flttng-consumerd.c;h=9fb4747536ad7fb3551217f1f3d6aaa0198caae6;hp=1636b9c0d22777798ff220df010c4bc5ca6c9634;hb=e9404c27e7cc9d841785e6c4292c1add19fbc1cc;hpb=1a1a34b40ab10a195633b1ed5e2e9b42fdae0a78 diff --git a/src/bin/lttng-consumerd/lttng-consumerd.c b/src/bin/lttng-consumerd/lttng-consumerd.c index 1636b9c0d..9fb474753 100644 --- a/src/bin/lttng-consumerd/lttng-consumerd.c +++ b/src/bin/lttng-consumerd/lttng-consumerd.c @@ -99,14 +99,6 @@ static void sighandler(int sig) return; } - /* - * Ignore SIGPIPE because it should not stop the consumer whenever a - * SIGPIPE is caught through a FD operation. - */ - if (sig == SIGPIPE) { - return; - } - if (ctx) { lttng_consumer_should_exit(ctx); } @@ -127,9 +119,10 @@ static int set_signal_handler(void) return ret; } - sa.sa_handler = sighandler; sa.sa_mask = sigset; sa.sa_flags = 0; + + sa.sa_handler = sighandler; if ((ret = sigaction(SIGTERM, &sa, NULL)) < 0) { PERROR("sigaction"); return ret; @@ -140,6 +133,7 @@ static int set_signal_handler(void) return ret; } + sa.sa_handler = SIG_IGN; if ((ret = sigaction(SIGPIPE, &sa, NULL)) < 0) { PERROR("sigaction"); return ret; @@ -314,6 +308,8 @@ int main(int argc, char **argv) void *status; struct lttng_consumer_local_data *tmp_ctx; + rcu_register_thread(); + if (set_signal_handler()) { retval = -1; goto exit_set_signal_handler; @@ -542,7 +538,7 @@ int main(int argc, char **argv) goto exit_data_thread; } - /* Create the thread to manage the receive of fd */ + /* Create the thread to manage the reception of fds */ ret = pthread_create(&sessiond_thread, default_pthread_attr(), consumer_thread_sessiond_poll, (void *) ctx); @@ -587,6 +583,14 @@ exit_metadata_timer_thread: PERROR("pthread_join sessiond_thread"); retval = -1; } + + ret = consumer_timer_thread_get_channel_monitor_pipe(); + if (ret >= 0) { + ret = close(ret); + if (ret) { + PERROR("close channel monitor pipe"); + } + } exit_sessiond_thread: ret = pthread_join(data_thread, &status); @@ -628,6 +632,12 @@ exit_init_data: tmp_ctx = ctx; ctx = NULL; cmm_barrier(); /* Clear ctx for signal handler. */ + /* + * Wait for all pending call_rcu work to complete before tearing + * down data structures. call_rcu worker may be trying to + * perform lookups in those structures. + */ + rcu_barrier(); lttng_consumer_destroy(tmp_ctx); lttng_consumer_cleanup(); @@ -643,6 +653,8 @@ exit_health_consumerd_cleanup: exit_options: exit_set_signal_handler: + rcu_unregister_thread(); + if (!retval) { exit(EXIT_SUCCESS); } else {