Bug #878

lttng-sessiond cannot unload lttng-modules when live session exists

Added by Mathieu Desnoyers over 5 years ago. Updated over 4 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


After the following set of commands:

lttng-sessiond (as root)

lttng create --live; lttng enable-channel -k test; lttng start

If we CTRL-C lttng-sessiond, this appears:

^CError: Unable to remove module lttng-ring-buffer-client-discard
Error: Unable to remove module lttng-lib-ring-buffer
Error: Unable to remove module lttng-tracer

It appears there is still a refcount held by sessiond when we try to remove the modules in this scenario. It could be a file that should have been closed but has not.


Updated by Jérémie Galarneau almost 5 years ago

  • Assignee set to Jonathan Rajotte Julien

Updated by Jonathan Rajotte Julien almost 5 years ago

  • Status changed from New to Confirmed

Updated by Jonathan Rajotte Julien almost 5 years ago

Look like a race between the consumerd cleanup and the cleanup from sessiond.

Using lsmod we can see that there is no more refs on lttng_ring_buffer_metadata_client and it's easily removed with modprob by hand.

/sys/kernel/debug/tracing/modules give a way to track who is triggering modules_get and modules_put for lttng_ring_buffer_metadata_client (via filter).

        modprobe-13671 [002] .... 93370.022587: module_load: lttng_ring_buffer_client_discard OX
        modprobe-13671 [002] .... 93370.023329: module_put: lttng_ring_buffer_client_discard call_site=SyS_finit_module refcnt=2
  lttng-sessiond-13767 [002] .... 93377.718143: module_get: lttng_ring_buffer_client_discard call_site=lttng_channel_create [lttng_tracer] refcnt=3
  lttng-sessiond-13767 [002] .... 93377.722421: module_get: lttng_ring_buffer_client_discard call_site=_channel_create [lttng_ring_buffer_client_discard] refcnt=4
  lttng-sessiond-13661 [000] .... 93384.156345: module_put: lttng_ring_buffer_client_discard call_site=_lttng_channel_destroy [lttng_tracer] refcnt=1
 lttng-consumerd-13785 [002] .... 93384.394481: module_put: lttng_ring_buffer_client_discard call_site=release_priv_ops [lttng_ring_buffer_client_discard] refcnt=5

Looks like consumerd and sessiond release lttng_ring_buffer_client_discard on cleanup. If we break while removing the modules and assuring that consumerd release before the modules removal everything works fine.

Let's see where we can go from there. Any thought?


Updated by Jonathan Rajotte Julien almost 5 years ago

  • Status changed from Confirmed to In Progress

Updated by Jonathan Rajotte Julien almost 5 years ago

  • Status changed from In Progress to Feedback

Updated by Jérémie Galarneau over 4 years ago

  • Target version set to 2.7

Updated by Jonathan Rajotte Julien over 4 years ago

  • Status changed from Feedback to Resolved
  • % Done changed from 0 to 100

Applied in changeset tools|commit:4e4714cb244d7ace4f4a462a3923066fd4760669.

Also available in: Atom PDF