Project

General

Profile

Actions

Bug #866

closed

lttng save produces an invalid session configuration when saving a live session that was loaded from an .lttng file

Added by Jérémie Galarneau over 9 years ago. Updated over 9 years ago.

Status:
Resolved
Priority:
Normal
Target version:
-
Start date:
12/01/2014
Due date:
% Done:

100%

Estimated time:

Description

Reproduction steps:

1. Create a live session using the lttng client

$ lttng create save-test --live
$ lttng enable-event -k -a

2. Save this session configuration

$ lttng save -o /tmp/my_sessions

You can see that the consumer output is saved as expected in the resulting file:

...
        <output>
            <consumer_output>
                <enabled>true</enabled>
                <destination>
                    <net_output>
                        <control_uri>tcp4://127.0.0.1:5342/</control_uri>
                        
                    </net_output>
                </destination>
            </consumer_output>
        </output>
...

3. Let's destroy this session, load it from the file and save it once more...

$ lttng destroy
$ lttng load -i /tmp/my_sessions
$ lttng save -o /tmp/some_other_sessions

See how this file's output section differs from what was seen previously:

        <output>
            <consumer_output>
                <enabled>true</enabled>
                <destination>
                    <path></path>
                </destination>
            </consumer_output>
        </output>

It seems that the "save" code has serialized the output as if it was a "local" output with a NULL name.

This was puzzling at first since the lttng client and session "load" code are both based on the same liblttng-ctl API. It turns out that a session has three "consumer_output" members...

struct ltt_session {
    ...
    struct consumer_output *consumer;
    ...
    struct ltt_kernel_session *kernel_session;    /* Contains a "consumer" member of type struct consumer_output */
    struct ltt_ust_session *ust_session;        /* Also contains a "consumer" member of type struct consumer_output */
    ...
}

The session save code serializes the top-most member, assuming that a session only has one associated consumer_output location.

This only works if the live session is created by the client because an undocumented "0" value is used as the domain type when calling lttng_set_consumer_url(). This value causes the "global" session's consumer output to be populated, instead of the domain-specific ones.

The fix consists in applying all consumer URI changes to all domains since we can't change the liblttng-ctl API to expose an LTTNG_DOMAIN_ALL member. Anyway, there is no reason to support multiple consumer outputs in a given session.

For now, the information will be stored multiple times... This should be refactored and the domain should remain ignored.

Actions #1

Updated by Jérémie Galarneau over 9 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Applied in changeset tools|commit:bda32d5621dc58f49d1e77b6998b53fc976d35d4.

Actions

Also available in: Atom PDF