If a signal comes in after ctx has been destroyed, it will try to use a
closed file descriptor.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
return;
}
- lttng_consumer_should_exit(ctx);
+ if (ctx) {
+ lttng_consumer_should_exit(ctx);
+ }
}
/*
{
int ret = 0, retval = 0;
void *status;
+ struct lttng_consumer_local_data *tmp_ctx;
if (set_signal_handler()) {
retval = -1;
exit_health_pipe:
exit_init_data:
- lttng_consumer_destroy(ctx);
+ tmp_ctx = ctx;
+ ctx = NULL;
+ cmm_barrier(); /* Clear ctx for signal handler. */
+ lttng_consumer_destroy(tmp_ctx);
lttng_consumer_cleanup();
if (health_consumerd) {
wait_consumer(&ustconsumer64_data);
wait_consumer(&ustconsumer32_data);
-
DBG("Cleaning up all agent apps");
agent_app_ht_clean();