From: Mathieu Desnoyers Date: Mon, 5 Jan 2015 21:43:06 +0000 (-0500) Subject: Fix: call lttng_poll_set_max_size before start threads X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=25b397f9ccee70eb6f2968837702c50f22ad7bbf Fix: call lttng_poll_set_max_size before start threads This changes the location of lttng_poll_set_max_size() call within sessiond main() to call it before creating the ht_cleanup thread. This fix is only needed on top of the main refactoring patch. This fix also adds checks for lttng_poll_set_max_size() error values. Fixes #747 Signed-off-by: Mathieu Desnoyers 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 b43e8f150..7122d065e 100644 --- a/src/bin/lttng-consumerd/lttng-consumerd.c +++ b/src/bin/lttng-consumerd/lttng-consumerd.c @@ -346,7 +346,10 @@ int main(int argc, char **argv) } /* Set up max poll set size */ - lttng_poll_set_max_size(); + if (lttng_poll_set_max_size()) { + retval = -1; + goto exit_init_data; + } if (*command_sock_path == '\0') { switch (opt_type) { diff --git a/src/bin/lttng-relayd/live.c b/src/bin/lttng-relayd/live.c index 756efbede..3728005df 100644 --- a/src/bin/lttng-relayd/live.c +++ b/src/bin/lttng-relayd/live.c @@ -2102,7 +2102,10 @@ int relayd_live_create(struct lttng_uri *uri, cds_wfcq_init(&viewer_conn_queue.head, &viewer_conn_queue.tail); /* Set up max poll set size */ - lttng_poll_set_max_size(); + if (lttng_poll_set_max_size()) { + retval = -1; + goto exit_init_data; + } /* Setup the dispatcher thread */ ret = pthread_create(&live_dispatcher_thread, NULL, diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index 94bb4cb8e..d09b0c6e7 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -2850,7 +2850,10 @@ int main(int argc, char **argv) cds_wfcq_init(&relay_conn_queue.head, &relay_conn_queue.tail); /* Set up max poll set size */ - lttng_poll_set_max_size(); + if (lttng_poll_set_max_size()) { + retval = -1; + goto exit_init_data; + } /* Initialize communication library */ lttcomm_init(); diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 80eebf163..5fcd540e5 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -5205,6 +5205,12 @@ int main(int argc, char **argv) goto exit_ht_cleanup_pipe; } + /* Set up max poll set size */ + if (lttng_poll_set_max_size()) { + retval = -1; + goto exit_set_max_size; + } + /* Create thread to clean up RCU hash tables */ ret = pthread_create(&ht_cleanup_thread, NULL, thread_ht_cleanup, (void *) NULL); @@ -5539,9 +5545,6 @@ int main(int argc, char **argv) */ session_list_ptr = session_get_list(); - /* Set up max poll set size */ - lttng_poll_set_max_size(); - cmd_init(); /* Check for the application socket timeout env variable. */ @@ -5771,6 +5774,7 @@ exit_init_data: retval = -1; } exit_ht_cleanup: +exit_set_max_size: utils_close_pipe(ht_cleanup_pipe); exit_ht_cleanup_pipe: