Project

General

Profile

Actions

Bug #1351

open

Babeltrace2 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/21/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: 2.0.3

Get below babletrace2 error when we call "babeltrace2 lts21/live", lts21/live is folder name of trace data.

01-02 06:43:13.098  1029  1029 E PLUGIN/CTF/META/IR-VISITOR get_unary_unsigned@visitor-generate-ir.c:800 [auto-disc-source-ctf-fs] At line 43 in metadata stream: Invalid constant unsigned integer.
01-02 06:43:13.099  1029  1029 E PLUGIN/CTF/META/IR-VISITOR visit_clock_decl_entry@visitor-generate-ir.c:4356 [auto-disc-source-ctf-fs] At line 43 in metadata stream: Unexpected unary expression for clock class's `offset` attribute.
01-02 06:43:13.099  1029  1029 E PLUGIN/CTF/META/IR-VISITOR visit_clock_decl@visitor-generate-ir.c:4530 [auto-disc-source-ctf-fs] At line 43 in metadata stream: Cannot visit clock class's entry: ret=-22
01-02 06:43:13.099  1029  1029 E PLUGIN/CTF/META/IR-VISITOR ctf_visitor_generate_ir_visit_node@visitor-generate-ir.c:4773 [auto-disc-source-ctf-fs] At line 44 in metadata stream: Cannot visit clock class: ret=-22
01-02 06:43:13.099  1029  1029 E PLUGIN/CTF/META/DECODER ctf_metadata_decoder_append_content@decoder.c:336 [auto-disc-source-ctf-fs] Failed to visit AST node to create CTF IR objects: mdec-addr=0xa245b0, ret=-22
01-02 06:43:13.099  1029  1029 E PLUGIN/SRC.CTF.FS/META ctf_fs_metadata_set_trace_class@metadata.c:128 [auto-disc-source-ctf-fs] Cannot update metadata decoder's content.
01-02 06:43:13.099  1029  1029 E PLUGIN/SRC.CTF.FS ctf_fs_component_create_ctf_fs_trace_one_path@fs.c:1204 [auto-disc-source-ctf-fs] Cannot create trace for `/root/lts21/live/xmu03/session-19700101-000023/ust/uid/0/32-bit`.
01-02 06:43:13.099  1029  1029 W LIB/GRAPH add_component_with_init_method_data@graph.c:973 Component initialization method failed: status=ERROR, comp-addr=0xa1be90, comp-name="auto-disc-source-ctf-fs", comp-log-level=WARNING, comp-class-type=SOURCE, comp-class-name="fs", comp-class-partial-descr="Read CTF traces from the file sy", comp-class-is-frozen=0, comp-class-so-handle-addr=0xa278f8, comp-class-so-handle-path="/usr/lib/babeltrace2/plugins/babeltrace-plugin-ctf.so", comp-input-port-count=0, comp-output-port-count=0
01-02 06:43:13.099  1029  1029 E CLI cmd_run_ctx_create_components_from_config_components@babeltrace2.c:2295 Cannot create component: plugin-name="ctf", comp-cls-name="fs", comp-cls-type=1, comp-name="auto-disc-source-ctf-fs" 
01-02 06:43:13.099  1029  1029 E CLI cmd_run@babeltrace2.c:2480 Cannot create components.

ERROR:    [Babeltrace CLI] (../../../git/src/cli/babeltrace2.c:2480)
  Cannot create components.
CAUSED BY [Babeltrace CLI] (../../../git/src/cli/babeltrace2.c:2295)
  Cannot create component: plugin-name="ctf", comp-cls-name="fs", comp-cls-type=1, comp-name="auto-disc-source-ctf-fs" 
CAUSED BY [libbabeltrace2] (../../../../git/src/lib/graph/graph.c:973)
  Component initialization method failed: status=ERROR, comp-addr=0xa1be90, comp-name="auto-disc-source-ctf-fs", comp-log-level=WARNING, comp-class-type=SOURCE, comp-class-name="fs", comp-class-partial-descr="Read CTF traces from the file sy", comp-class-is-frozen=0, comp-class-so-handle-addr=0xa278f8, comp-class-so-handle-path="/usr/lib/babeltrace2/plugins/babeltrace-plugin-ctf.so", comp-input-port-count=0, comp-output-port-count=0
CAUSED BY [auto-disc-source-ctf-fs: 'source.ctf.fs'] (../../../../../git/src/plugins/ctf/fs-src/fs.c:1204)
  Cannot create trace for `/root/lts21/live/xmu03/session-19700101-000023/ust/uid/0/32-bit`.

Seems the same issue to https://bugs.lttng.org/issues/1277, but there is not fix patch yet.
We have the same issue on babeltrace version 1.5.8 too, https://bugs.lttng.org/issues/1350

We fix it with the attached patch: which is based on latest branch: stable-2.0.
Please help check it.

Thanks.


Files

Actions #1

Updated by Jérémie Galarneau 3 months ago

  • Status changed from New to Feedback

The proposed patch breaks the public API, which is not acceptable. Philippe's reply to #1277 describes a suitable fix.

See https://bugs.lttng.org/issues/1277#note-2.

Actions #2

Updated by Heng Guo 3 months ago

For below solution in https://bugs.lttng.org/issues/1277, does it mean that the fix should be at lttng-tools?

As a Babeltrace 2 clock class's offset (in cycles) is an unsigned integer property, transfer any negative offset attribute value to the offset_s attribute before creating the clock class object.

Actions #3

Updated by Jérémie Galarneau 3 months ago

No, the CTF 1.8 format allows a negative offset. The Babeltrace 2 Trace IR API doesn't.

When the offset is negative, it can be converted to a positive value by adjusting offset_s.

Essentially, when offset is negative:

offset_s--;
offset = frequency + original_offset;
Actions #4

Updated by Heng Guo 3 months ago

A new patch V2 is attached, Please help check it.

Thanks

Actions

Also available in: Atom PDF