From: Jérémie Galarneau Date: Sat, 12 Jan 2019 19:17:58 +0000 (-0500) Subject: Fix: leak of lttng-consumerd global HTs in run-as worker X-Git-Tag: v2.11.0-rc2~84 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=7ebbba65d65972cc4305dd94864825cc5dee7e5b;p=lttng-tools.git Fix: leak of lttng-consumerd global HTs in run-as worker 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 --- 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);