The description below is the bug of Lttng from customer, and now I try to fix it, continue update this artical daily until fix it and send email to upstream of lttng.org,ok,god praise me,goodluck,let's begin.
Hello,
While testing enabling and disabling tracepoints on XMU03 using lttng we found what seems to be a bug with lttng disable command. If one enables tracepoint using filtering per process, then enables tracepoint without a filter and then tries to disable that
tracepoint, the ones enabled with filtering always stay enabled and we haven't found a way to disable them.
If I'm correct lttng currently doesn't support specifically disabling tracepoints using filters but I presume that if I try disabling a tracepoint (for all processes) even those enabled with filter should be disabled. Lttng also lists all tracepoints as disabled
although tracing continues. This happens whether the traces are enabled through user application or with lttng shell command.
To reproduce:
first enable tracepoint with filter for process:
lttng enable-event my_provider:my_tracepoint --filter '$ctx.procname == "my-process*"' --session session -u -c channel
then enable tracing for all processes:
lttng enable-event my_provider:my_tracepoint --session session -u -c channel
then try disabling tracepoint:
lttng disable-event --session session --channel channel --userspace my_provider:my_tracepoint
lttng list session gives:
my_provider:my_tracepoint (type: tracepoint) [disabled]
my_provider:my_tracepoint (type: tracepoint) [disabled] [with filter]
and traces for a filtered process will still be logging.
-------------------------------------------------------------------------------------line--------------------------------------------------------------------------------------------------
now I have reproduce it in my local computer,which is ubuntu,the steps below:
PS: the userspace program I used example of lttng.org of document,which you could refer to it
root@pek-cdong-d2:~# lttng create mysession Session mysession created.Traces will be written in /root/lttng-traces/mysession-20150806-111341root@pek-cdong-d2:~# root@pek-cdong-d2:~#
root@pek-cdong-d2:~#
root@pek-cdong-d2:~# lttng enable-event hello_world:my_first_tracepoint --session mysession -u -c channellttng enable-event hello_world:my_first_tracepoint --session mysession -u -c channel UST event hello_world:my_first_tracepoint created in channel channel
root@pek-cdong-d2:~# lttng enable-event hello_world:my_first_tracepoint --filter '$ctx.procname == "./hello*"' --session mysession -u -c channel Event hello_world:my_first_tracepoint: Filter '$ctx.procname == "./hello*"' successfully set
root@pek-cdong-d2:~#
root@pek-cdong-d2:~# lttng disable-event --session mysession --channel channel --userspace hello_world:my_first_tracepoint UST event hello_world:my_first_tracepoint disabled in channel channel for session mysession
root@pek-cdong-d2:~#
root@pek-cdong-d2:~# lttng startTracing started for session mysession
root@pek-cdong-d2:~# lttng stopWaiting for data availability.Tracing stopped for session mysession
root@pek-cdong-d2:~#
root@pek-cdong-d2:~#
root@pek-cdong-d2:~#
root@pek-cdong-d2:~# lttng view
Trace directory: /root/lttng-traces/mysession-20150806-111341
[11:14:06.815998656] (+?.?????????) pek-cdong-d2 hello_world:my_first_tracepoint: { cpu_id = 3 }, { my_string_field = "hi there!", my_integer_field = 23 }[11:14:06.816007919] (+0.000009263) pek-cdong-d2 hello_world:my_first_tracepoint: { cpu_id = 3 }, { my_string_field = "./hello", my_integer_field = 0 }[11:14:08.816271732] (+2.000263813) pek-cdong-d2 hello_world:my_first_tracepoint: { cpu_id = 3 }, { my_string_field = "hi there!", my_integer_field = 23 }[11:14:08.816275148] (+0.000003416) pek-cdong-d2 hello_world:my_first_tracepoint: { cpu_id = 3 }, { my_string_field = "./hello", my_integer_field = 0 }
root@pek-cdong-d2:~#
root@pek-cdong-d2:~# lttng disable-event --session mysession --channel channel --userspace hello_world:my_first_tracepoint UST event hello_world:my_first_tracepoint disabled in channel channel for session mysession
root@pek-cdong-d2:~#
root@pek-cdong-d2:~# lttng start
Tracing started for session mysession
root@pek-cdong-d2:~#
root@pek-cdong-d2:~# lttng stop
Waiting for data availability.
Tracing stopped for session mysession
root@pek-cdong-d2:~#
root@pek-cdong-d2:~# lttng view
Trace directory: /root/lttng-traces/mysession-20150806-111431
[11:15:24.400240926] (+?.?????????) pek-cdong-d2 hello_world:my_first_tracepoint: { cpu_id = 2 }, { my_string_field = "hi there!", my_integer_field = 23 }[11:15:24.400251675] (+0.000010749) pek-cdong-d2 hello_world:my_first_tracepoint: { cpu_id = 2 }, { my_string_field = "./hello", my_integer_field = 0 }[11:15:26.400352329] (+2.000100654) pek-cdong-d2 hello_world:my_first_tracepoint: { cpu_id = 2 }, { my_string_field = "hi there!", my_integer_field = 23 }[11:15:26.400355683] (+0.000003354) pek-cdong-d2 hello_world:my_first_tracepoint: { cpu_id = 2 }, { my_string_field = "./hello", my_integer_field = 0 }[11:15:28.400528270] (+2.000172587) pek-cdong-d2 hello_world:my_first_tracepoint: { cpu_id = 2 }, { my_string_field = "hi there!", my_integer_field = 23 }[11:15:28.400531503] (+0.000003233) pek-cdong-d2 hello_world:my_first_tracepoint: { cpu_id = 2 }, { my_string_field = "./hello", my_integer_field = 0 }[11:15:30.400702565] (+2.000171062) pek-cdong-d2 hello_world:my_first_tracepoint: { cpu_id = 2 }, { my_string_field = "hi there!", my_integer_field = 23 }[11:15:30.400705720] (+0.000003155) pek-cdong-d2 hello_world:my_first_tracepoint: { cpu_id = 2 }, { my_string_field = "./hello", my_integer_field = 0 }[11:15:32.400819265] (+2.000113545) pek-cdong-d2 hello_world:my_first_tracepoint: { cpu_id = 2 }, { my_string_field = "hi there!", my_integer_field = 23 }[11:15:32.400822570] (+0.000003305) pek-cdong-d2 hello_world:my_first_tracepoint: { cpu_id = 2 }, { my_string_field = "./hello", my_integer_field = 0 }[11:15:34.400993852] (+2.000171282) pek-cdong-d2 hello_world:my_first_tracepoint: { cpu_id = 2 }, { my_string_field = "hi there!", my_integer_field = 23 }[11:15:34.400997070] (+0.000003218) pek-cdong-d2 hello_world:my_first_tracepoint: { cpu_id = 2 }, { my_string_field = "./hello", my_integer_field = 0 }[11:15:36.401169380] (+2.000172310) pek-cdong-d2 hello_world:my_first_tracepoint: { cpu_id = 2 }, { my_string_field = "hi there!", my_integer_field = 23 }[11:15:36.401172758] (+0.000003378) pek-cdong-d2 hello_world:my_first_tracepoint: { cpu_id = 2 }, { my_string_field = "./hello", my_integer_field = 0 }root@pek-cdong-d2:~#