X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.c;h=1a3c22a6c8f87715dc85c878ec5b0c3443d7d1e3;hb=15623b7d24de5bd828ac21f55bdfea4835c4227a;hp=ffd71bbac5cdb8af69e4d69a9af3f19d47fd2dbd;hpb=43fade62cebf3c70b79e48e1ad9afbb9ab6e48f3;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index ffd71bbac..1a3c22a6c 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -1654,6 +1654,16 @@ int cmd_add_context(struct ltt_session *session, enum lttng_domain_type domain, int ret, chan_kern_created = 0, chan_ust_created = 0; char *app_ctx_provider_name = NULL, *app_ctx_name = NULL; + /* + * Don't try to add a context if the session has been started at + * some point in time before. The tracer does not allow it and would + * result in a corrupted trace. + */ + if (session->has_been_started) { + ret = LTTNG_ERR_TRACE_ALREADY_STARTED; + goto end; + } + if (ctx->ctx == LTTNG_EVENT_CONTEXT_APP_CONTEXT) { app_ctx_provider_name = ctx->u.app_ctx.provider_name; app_ctx_name = ctx->u.app_ctx.ctx_name; @@ -3710,10 +3720,12 @@ static int set_relayd_for_snapshot(struct consumer_output *consumer, rcu_read_lock(); cds_lfht_for_each_entry(snap_output->consumer->socks->ht, &iter.iter, socket, node.node) { + pthread_mutex_lock(socket->lock); ret = send_consumer_relayd_sockets(0, session->id, snap_output->consumer, socket, session->name, session->hostname, session->live_timer); + pthread_mutex_unlock(socket->lock); if (ret != LTTNG_OK) { rcu_read_unlock(); goto error;