From e09272cd700e3a0a59100cdf6c3ad2332341109c Mon Sep 17 00:00:00 2001 From: David Goulet Date: Fri, 19 Oct 2012 12:07:36 -0400 Subject: [PATCH] Fix: Relayd and consumerd socket leaks Using the set_consumer_uri call, the connection is established between the session daemon and the relayd then sent to the relayd. However, when start_tracing is initiated, the sessiond creates, if needed, the relayd sockets and send them to the consumer. A validation was missing in one of the function call to validate if the sockets were already sent to the consumer. Note that using lttng_create_session with a remote URL, the sockets are created only when tracing starts thus not having this issue. This fixes leaks on the relayd and consumerd when destroying a session. Fixes #374 #382 Signed-off-by: David Goulet --- src/bin/lttng-sessiond/cmd.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 06bf0f4f3..d1417efd7 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -522,6 +522,12 @@ static int send_consumer_relayd_socket(int domain, struct ltt_session *session, int ret; struct lttcomm_sock *sock = NULL; + /* Don't resend the sockets to the consumer. */ + if (consumer->dst.net.relayd_socks_sent) { + ret = LTTNG_OK; + goto error; + } + /* Set the network sequence index if not set. */ if (consumer->net_seq_index == -1) { /* @@ -566,6 +572,7 @@ close_sock: lttcomm_destroy_sock(sock); } +error: return ret; } -- 2.34.1