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:33:50 +0000 (17:33 -0400)
commitf9f2e6b66480df1e8738b9a2afb0685842f56edc
tree1a03c930402fb64f5ba65d24555a775343ea5740
parentab2898b41e98d45b63eae1db12e54b490bcf7c7d
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.025678 seconds and 4 git commands to generate.