Fixed
Created: Feb 12, 2020
Updated: Apr 13, 2020
Resolved Date: Mar 18, 2020
Found In Version: 10.17.41.19
Fix Version: 10.17.41.20
Severity: Standard
Applicable for: Wind River Linux LTS 17
Component/s: Userspace
XMU has reported that babeltrace sometimes crashes at system boot-up. This was observed when they moved their lttng-init script earlier in the boot-process. After some initial investigations I have found that this happens when babeltrace attaches to a live trace-stream and immediately receives a tracepoint event, and then immediately receives another event of another trace-point type. This makes babeltrace call the append_metadata() function in lttng-live-comm.c, in this case the "viewer_stream->ctf_trace->handle" pointer will be NULL, this is not checked for and thus a segmentation-fault will occur. I have pushed a branch to the wrl-xmu repo at github called "babeltrace-crash-reproduce" which contains a script that will reproduce this crash. Simply build the image, boot it up and run:
/opt/babeltrace-crash-reproduce/reproduce.sh
It should leave a babeltrace core-dump in the working directory.
There is a patch from the community regarding this: [https://lists.lttng.org/pipermail/lttng-dev/2015-August/024891.html]
But it is not applied to any version of babeltrace and it doesn't fix the problem completely. It fixes the segmentation-fault and makes it a little harder to reproduce but babeltrace still fails with a error-message with the patch applied:
[error] Event id 22 is outside range.
[error] Reading event failed.
[warning] [Context] Cannot open_trace of format lttng-live at path net://localhost/host/xmu03/session.
[warning] [Context] cannot open trace "net://localhost/host/xmu03/session" for reading.
[error] opening trace "net://localhost/host/xmu03/session" for reading.
[error] none of the specified trace paths could be opened.
I have reproduce this with two different versions of the lttng suite, the following versions are :
lttng-tools-2.7.0
lttng-ust-2.7.1
liburcu-0.9.1
babeltrace-1.3.1
But soon they will move to the versions below, which I also reproduced the problem with.
lttng-tools-2.8.1
lttng-ust-2.8.1
liburcu-0.9.2
babeltrace-1.4.0