Fix: snapshot path have domain subdir duplicate "ust/ust" or "kernel/kernel"
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Tue, 1 Dec 2020 17:19:53 +0000 (12:19 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 13 May 2021 00:32:19 +0000 (20:32 -0400)
commite406117916cb86acba15cab38268060ad8ab93f8
treead098101fdc196aa82c269396e396d28f3269b17
parent41436f1e4893f7e64b32e3899067572f55b50aa5
Fix: snapshot path have domain subdir duplicate "ust/ust" or "kernel/kernel"

Observed issue
==============

lttng-ivc observed unexpected path generated for streamed snapshot:

  joraj-alpa/
   test-20190319-120000-20210113-110101/
    snapshot-1-20210113-110102-0/
*     ust/
*      ust/
        pid/
         app-ust-2362198-20210113-110101/
           channel_0
           channel_1
           metadata
           channel_2
           channel_3

"ust" the domain subdir is present two-time instead off only one time.

The same problem is seen for kernel snapshots.

Cause
=====

Based on dissection the problem was introduced by commit
5da88b0f58d7f838068037ea449ddfb25d3e85ad [1]

For snapshots, the consumer output object of the snapshot output and
information is fetched from the *original* consumer output.
(code block around src/bin/lttng-sessiond/cmd.c:4748)

The snapshot consumer output does not contains the necessary information
to populate domain_subdir on copy (domain_subdir is '\0').

This would lead to a len evaluation of 1 for the consumer_path_offset in
setup_channel_trace_path:70. This would end up not "skipping" the "ust"
and "kernel" part of the path.

Solution
========

Part of the solution is to copy the domain_subdir from the original
session consumer output to the snapshot output.

Still, the problem was still present since that now that the
domain_subdir was not "\0", the value was suffixed to the passed
session_path. In the snapshot code path, "ust/" and "kernel/" were
already present in the session_path passed to setup_channel_trace_path.

A quick modification at the caller level in the snapshot code path fixes
the issues once and for all.

Tests
=======

The test suit is augmented for certain key tests to validate the
complete path of a trace.

Path validation is based on crude bash pattern matching.

Known drawbacks
=========
None

References
==========
[1] https://github.com/lttng/lttng-tools/commit/5da88b0f58d7f838068037ea449ddfb25d3e85ad

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie7cd2d5471ee3a942fa511e2f4cab09e3aa499e4
14 files changed:
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/kernel.c
src/bin/lttng-sessiond/ust-app.c
tests/regression/kernel/test_event_basic
tests/regression/tools/base-path/test_ust
tests/regression/tools/live/test_lttng_kernel
tests/regression/tools/snapshots/test_kernel
tests/regression/tools/snapshots/test_kernel_streaming
tests/regression/tools/snapshots/test_ust_streaming
tests/regression/tools/snapshots/ust_test
tests/regression/tools/streaming/test_kernel
tests/regression/tools/streaming/test_ust
tests/regression/tools/tracefile-limits/test_tracefile_size
tests/utils/utils.sh
This page took 0.027134 seconds and 4 git commands to generate.