[lttng-dev] Babeltrace bug in lttng-live mode

Liguang Li liguang.li at windriver.com
Thu Mar 9 07:44:43 UTC 2017


Hi,

A babeltrace BUG is found in the lttng-live mode, after analyze the
backtrace and the source code, i found this issue maybe a defect of design.

The reproduce steps is as following:

#cat test.sh
#!/bin/sh

lttng -n create session --live 1000000 -U net://localhost/
lttng enable-channel channel0 -u --buffers-uid -C 1024k -W 1
lttng enable-event -u --channel channel0 -a

babeltrace --clock-date --no-delta -i lttng-live
net://localhost/host/localhost/session &

sleep 2
lttng start
sleep 2

sample_1 &  # First application
sleep 0.5
sample_2 &  # Second application


I checked the source code and found the issue happens in the following
workflow.

lttng_live_read
   add_traces
       add_one_trace                                            --- (2)
          bt_context_add_trace
	     ctf_open_mmap_trace
		ctf_open_mmap_trace_read
		   ctf_open_mmap_stream_read
		      prepare_mmap_stream_definition
			 packet_seek(ctf_live_packet_seek)
			    get_next_index
			       append_metadata
			 	  ctf_append_trace_metadata     --- (1)

In (1), the first argument of the function ctf_append_trace_metadata is
invalid, because the viewer_stream->ctf_trace->handle is NULL now.

The ctf_trace->handle variable is assigned in (2) after the following
work is done.

A fix patch is found in the mail list, but after applied this patch, we
found the new metadata info can't be updated, the event id can not be
found in array.

The patch link:
https://lists.lttng.org/pipermail/lttng-dev/2015-August/024891.html

How to fix this issue, any ideas?

Regards & Thanks
Liguang


More information about the lttng-dev mailing list