Project

General

Profile

Actions

Bug #1350

open

Babeltrace failes at a negative clock `offset`

Added by Heng Guo 3 months ago. Updated 3 months ago.

Status:
Feedback
Priority:
Normal
Assignee:
-
Category:
-
Start date:
03/17/2022
Due date:
% Done:

0%

Estimated time:

Description

Below lttng packages are using in our project.
Lttng_tools: 2.12.3
Lttng_ust: 2.12.1
Babeltrace: 1.5.8

1.
In Lttng live mode, we get below babletrace error when we call "babeltrace --clock-date --no-delta -i lttng-live net://localhost/host/xxxxx/session"

[error] ctf_clock_declaration_visit: unexpected unary expression for clock offset
[error] ctf_visitor_construct_metadata: clock declaration error
[error] Error in CTF metadata constructor -22
[error] [Context] Cannot open_mmap_trace of format ctf.
[error] Error adding trace
[warning] [Context] Cannot open_trace of format lttng-live at path net://localhost/host/xxxxx/session.
[warning] [Context] cannot open trace "net://localhost/host/xxxxx/session" for reading.
[error] opening trace "net://localhost/host/xxxxx/session" for reading.
[error] none of the specified trace paths could be opened.

Finally we port commit: 61cf588beae752e5ddfc60b6b5310f769ac9e852 from master branch to 1.5.8, then the issue is fixed.

2. With this commit: 61cf588beae752e5ddfc60b6b5310f769ac9e852, we find test case: tests/bin/intersection/test_intersection fails.
1) The 1st reason is wrong clock offset_s = 1351530929945824323, refer to below :

cat tests/ctf-traces/intersection/3eventsintersect/metadata

.....
clock {
    name = test_clock;
    uuid = "7b9e2f2a-530e-4ab1-816f-0831b5c09140";
    description = "This is a test clock";
    freq = 1000000000;
    precision = 10;
    offset_s = 1351530929945824323;
    offset = 0;
    absolute = TRUE;
};

There is a overflow in clock_offset_ns() if clock offset_s = 1351530929945824323.
static inline
uint64_t clock_offset_ns(struct ctf_clock *clock)
{
        return clock->offset_s * 1000000000ULL
                        + clock_cycles_to_ns(clock, clock->offset);
}

Double check the babeltrace 2, it is already fixed to "offset_s = 13515309;" in tests/data/ctf-traces/intersection/3eventsintersect/metadata

2) The 2nd reason is the regression of commit: 61cf588beae752e5ddfc60b6b5310f769ac9e852. uint64_t should be changed to int64_t in some codes related to option "--stream-intersection".
Attach 3 related patches based on branch remotes/origin/stable-1.5.

So why commit 61cf588beae752e5ddfc60b6b5310f769ac9e852 is not merged to branch 1.5? Is there any reason or side effect of this commit?


Files

Actions #1

Updated by Jonathan Rajotte Julien 3 months ago

  • Description updated (diff)
  • Status changed from New to Feedback

Hi,

If you have a look at the commit message from 61cf588beae752e5ddfc60b6b5310f769ac9e852 the reason why it is not present in stable 1.5.8 is pretty clear.

It introduces API-breaking changes in the C and Python APIs, since we
need to be able to return negative time values, which were previously
used as errors (-1ULL).

Unless there is very compelling reasons why you are sticking with babeltrace 1.5.8, please upgrade to babeltrace2.

Cheers

Actions #2

Updated by Heng Guo 3 months ago

We have the same issue on babletrace2 and create case https://bugs.lttng.org/issues/1351.

Heng

Actions

Also available in: Atom PDF