Fix: metadata channel leak when using the snapshot tracing mode
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 8 Feb 2018 23:25:55 +0000 (18:25 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 12 Feb 2018 17:20:16 +0000 (12:20 -0500)
commita1ca62dae052f90f4b3d0811a76055ce8cf44873
tree372ef8e3e1ff439eddf7e55c3b2bf523c350230a
parent3076a7f8fb33156a85be794a8312c56bbdcb56cf
Fix: metadata channel leak when using the snapshot tracing mode

While running stress tests involving the snapshot mode, it
becomes apparent that the lttng-consumerd leaks a number of file
descriptors.

To isolate the problem, the test was narrowed down to

* Create a session in snapshot mode
* Enable a userspace channel
* Enable all userspace events
* Start tracing
* Run a traced application
* Stop tracing
* Destroy session

This has shown that 5 file descriptors were leaked on each
iteration of the above.

As the comments in this change indicate, the ownership and
lifetime of metadata channels varies depending on the tracing
mode being used.

In non-snapshot tracing modes, metadata channels are owned by
their respective streams. On destruction of a metadata stream,
consumer_del_channel() is invoked since the stream releases its
ownership of the metadata channel.

However, this relationship between metadata streams and channels
does not exist in snapshot mode; streams are created and
destroyed on every snapshot record. Hence, the
LTTNG_CONSUMER_CLOSE_METADATA command must immediately clean the
metadata channel.

The channel's "monitor" flag is used to determine whether or not
the metadata channel is in "snapshot" mode or not.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/ust-consumer/ust-consumer.c
This page took 0.025449 seconds and 4 git commands to generate.