trimmer: don't get clock snapshots from messages that don't have them
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 5 May 2021 14:07:56 +0000 (10:07 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 10 Sep 2021 14:39:08 +0000 (10:39 -0400)
commit8a30271a574f095d9d6a7978f3745e568c019f7b
tree1290df04cc70d9a6467a1a1ea18449b1cb870e95
parentd4f19030befaa331ead2414c649e812cf72a2b5d
trimmer: don't get clock snapshots from messages that don't have them

When using a trace with packets that don't have beginning clock
snapshots [1] with a trimmer component, we hit:

    $ ./src/cli/babeltrace2 nvctf --timerange="05:50:53,05:50:55"
    ...
    Condition ID: `pre:message-packet-beginning-borrow-default-clock-snapshot-const:msg-stream-class-packets-have-beginning-default-clock-snapshot`.
    Function: bt_message_packet_beginning_borrow_default_clock_snapshot_const().
    ------------------------------------------------------------------------
    Error is:
    Message's stream class packets don't have beginning default clock snapshot.

The problem is with the trimmer's get_msg_ns_from_origin function
assuming that that packet begnning messages have a clock snapshot if the
stream class has a clock class (which I suppose was true in early
development stages).

Fix that by making get_msg_ns_from_origin skip over messages
that don't have clock snapshots.  In addition to packet beginning
messages, I found (just by inspection, not tested) that packet end,
discarded events and discarded packets messages are in the same
situation.

Note that the trimmer component currently requires packet messages to
have clock snapshots in order to work.  However, the check for this
happens later, during the TRIM state.  get_msg_ns_from_origin is called
early, during the SET_BOUNDS_NS_FROM_ORIGIN state.  So in
get_msg_ns_from_origin, we can't assume that messages we encounter have
them.

[1] Like the trace from
    https://lists.lttng.org/pipermail/lttng-dev/2021-May/029955.html

Change-Id: Ie56b3250829197eadb823b7ac5d23efc46d12b3c
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/5689
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/plugins/utils/trimmer/trimmer.c
This page took 0.024294 seconds and 4 git commands to generate.