Fix: mark channel as disabled even if the session is inactive
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 25 Feb 2021 23:19:37 +0000 (18:19 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 28 Apr 2021 21:06:55 +0000 (17:06 -0400)
commitfbee89873ae51fa4e025455b19a8ebccd0e2d8a4
tree1a03c930402fb64f5ba65d24555a775343ea5740
parentf66473ac08601dfdbed5a33a8d41957293372b45
Fix: mark channel as disabled even if the session is inactive

Observed issue
==============
When the session is stopped, disable-channel commands are no-op.

The following commands reproduce the issue:
  lttng create
  lttng enable-event -u -a
  lttng start
  sleep 4
  lttng stop

  lttng disable-channel -u channel0
  sleep 10
  lttng start
  sleep 4
  lttng stop

  lttng view

Note that the sleep command there are to give the UST application time
to produce events.

Even after disabling the channel, we can see that events are still
traced.

This is due to the fact that the `channel_ust_disable()` function
returns early if the session is inactive and omits to set the channel as
disabled.

Proposed fix
============
Move this following line before the check:
uchan->enabled = 0;

Test
====
Add a test case to exercise this exact scenario.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I9660064ac6eb99f2aea8851dc98a94cfc1b810e6
configure.ac
src/bin/lttng-sessiond/channel.c
tests/regression/Makefile.am
tests/regression/tools/Makefile.am
tests/regression/tools/channel/Makefile.am [new file with mode: 0644]
tests/regression/tools/channel/test_channel [new file with mode: 0755]
This page took 0.025285 seconds and 4 git commands to generate.