[lttng-dev] [PATCH lttng-tools 1/2] Fix: add-context cannot be performed after a session has been started
Jérémie Galarneau
jeremie.galarneau at efficios.com
Mon Feb 19 15:26:10 EST 2018
Merged with a minor fix in master, stable-2.10, and stable-2.9.
I have also tweaked the documentation patch following comments from
Philippe Proulx.
Thanks!
Jérémie
On 5 February 2018 at 18:19, Jonathan Rajotte
<jonathan.rajotte-julien at efficios.com> wrote:
> The following scenario lead to a corrupted trace/metadata layout problem:
> - lttng create test
> - lttng enable-channel -u test
> - lttng enable-event -u -a -c test
> - lttng start
> - ./instrumented-application
> - lttng stop
> - lttng add-context -u -t procname -c test
> - lttng start
> - ./instrumented-application
> - lttng stop
> - lttng view
>
> Babeltrace 1.5.x will fail with:
>
> [error] Unexpected end of packet. Either the trace data stream is corrupted or metadata description does not match data layout.
> [error] Reading event failed.
> Error printing trace.
>
> Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
> ---
> src/bin/lttng-sessiond/cmd.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c
> index a295059..1a60ce3 100644
> --- a/src/bin/lttng-sessiond/cmd.c
> +++ b/src/bin/lttng-sessiond/cmd.c
> @@ -1650,6 +1650,17 @@ 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;
> --
> 2.7.4
>
--
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list