From 7ebbba65d65972cc4305dd94864825cc5dee7e5b Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Sat, 12 Jan 2019 14:17:58 -0500 Subject: [PATCH] Fix: leak of lttng-consumerd global HTs in run-as worker MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit All resources allocated by the consumerd before the launch of the run-as worker process are leaked since the run-as process is only fork()'ed (the original process image is preserved). Moving the launch of the worker earlier in the initialization of the consumerd works around this problem. Signed-off-by: Jérémie Galarneau --- src/bin/lttng-consumerd/lttng-consumerd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bin/lttng-consumerd/lttng-consumerd.c b/src/bin/lttng-consumerd/lttng-consumerd.c index ddd07a142..5d3467c1f 100644 --- a/src/bin/lttng-consumerd/lttng-consumerd.c +++ b/src/bin/lttng-consumerd/lttng-consumerd.c @@ -311,6 +311,10 @@ int main(int argc, char **argv) rcu_register_thread(); + if (run_as_create_worker(argv[0], NULL, NULL) < 0) { + goto exit_set_signal_handler; + } + if (set_signal_handler()) { retval = -1; goto exit_set_signal_handler; @@ -411,10 +415,6 @@ int main(int argc, char **argv) set_ulimit(); } - if (run_as_create_worker(argv[0], NULL, NULL) < 0) { - goto exit_init_data; - } - /* create the consumer instance with and assign the callbacks */ ctx = lttng_consumer_create(opt_type, lttng_consumer_read_subbuffer, NULL, lttng_consumer_on_recv_stream, NULL); -- 2.34.1