diff mbox

[lttng-tools] Fix: consumerd memory leak when using snapshot sessions

Message ID 1466582117-32094-1-git-send-email-marian.florea@windriver.com
State Changes Requested, archived
Headers show

Commit Message

Marian Florea June 22, 2016, 7:55 a.m. UTC
When starting tracing a snapshot session in an active environment
a metadata channel is created that on destroy is not freed. Because the
metadata channel created is not passed to the metadata thread/is not monitored,
the destruction of this channel can be done by notifying the channel thread.
Sessiond thread inside consumerd when receiving a close_metadata command
will now also notify the channel thread to destroy the metadata channel.

Fixes: #1017

Signed-off-by: Marian Florea <marian.florea at windriver.com>
---
 src/common/ust-consumer/ust-consumer.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jérémie Galarneau July 5, 2016, 1:19 a.m. UTC | #1
Hi Marian,

This patch causes the poll file set in
consumer_thread_channel_poll()[1] to become invalid, resulting in
PERRORs:
PERROR - 21:11:33.724761 [12226/12230]: epoll_ctl DEL: No such file or
directory (in compat_epoll_del() at compat-epoll.c:183)

The problem can be reproduced easily by running the
./tests/regression/tools/snapshots/test_ust_fast [2] test.

Will you be submitting a v2?

Thanks,
Jérémie

[1] https://github.com/lttng/lttng-tools/blob/master/src/common/consumer/consumer.c#L2805
[2] https://github.com/lttng/lttng-tools/blob/master/tests/regression/tools/snapshots/test_ust_fast

On Wed, Jun 22, 2016 at 3:55 AM, Marian Florea
<marian.florea at windriver.com> wrote:
> When starting tracing a snapshot session in an active environment
> a metadata channel is created that on destroy is not freed. Because the
> metadata channel created is not passed to the metadata thread/is not monitored,
> the destruction of this channel can be done by notifying the channel thread.
> Sessiond thread inside consumerd when receiving a close_metadata command
> will now also notify the channel thread to destroy the metadata channel.
>
> Fixes: #1017
>
> Signed-off-by: Marian Florea <marian.florea at windriver.com>
> ---
>  src/common/ust-consumer/ust-consumer.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c
> index 01d5ecf..14d3dff 100644
> --- a/src/common/ust-consumer/ust-consumer.c
> +++ b/src/common/ust-consumer/ust-consumer.c
> @@ -1622,6 +1622,8 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
>                         ret_code = ret;
>                 }
>
> +               notify_thread_del_channel(ctx, msg.u.close_metadata.key);
> +
>                 goto end_msg_sessiond;
>         }
>         case LTTNG_CONSUMER_FLUSH_CHANNEL:
> --
> 1.9.1
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
diff mbox

Patch

diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c
index 01d5ecf..14d3dff 100644
--- a/src/common/ust-consumer/ust-consumer.c
+++ b/src/common/ust-consumer/ust-consumer.c
@@ -1622,6 +1622,8 @@  int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
 			ret_code = ret;
 		}
 
+		notify_thread_del_channel(ctx, msg.u.close_metadata.key);
+
 		goto end_msg_sessiond;
 	}
 	case LTTNG_CONSUMER_FLUSH_CHANNEL: