From: Jérémie Galarneau Date: Wed, 7 Aug 2019 18:21:11 +0000 (-0400) Subject: Fix: incorrect time unit used when waiting on destruction handle X-Git-Tag: v2.12.0-rc1~519 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=c8f61fd42dad6e45ff82402089f99af568de5984;p=lttng-tools.git Fix: incorrect time unit used when waiting on destruction handle DEFAULT_DATA_AVAILABILITY_WAIT_TIME is used by the lttng client to wait on the destruction handle returned by a session destruction command. This constant is in micro-seconds while the destruction handle expects a timeout in ms. This causes the client to appear unresponsive while waiting for the destruction of a session. Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng/commands/destroy.c b/src/bin/lttng/commands/destroy.c index e52735f43..a258f6409 100644 --- a/src/bin/lttng/commands/destroy.c +++ b/src/bin/lttng/commands/destroy.c @@ -101,7 +101,7 @@ static int destroy_session(struct lttng_session *session) fflush(stdout); } - usleep(DEFAULT_DATA_AVAILABILITY_WAIT_TIME); + usleep(DEFAULT_DATA_AVAILABILITY_WAIT_TIME_US); _MSG("."); fflush(stdout); } @@ -127,7 +127,7 @@ static int destroy_session(struct lttng_session *session) do { status = lttng_destruction_handle_wait_for_completion(handle, - DEFAULT_DATA_AVAILABILITY_WAIT_TIME); + DEFAULT_DATA_AVAILABILITY_WAIT_TIME_US / USEC_PER_MSEC); switch (status) { case LTTNG_DESTRUCTION_HANDLE_STATUS_TIMEOUT: if (!printed_wait_msg) { diff --git a/src/bin/lttng/commands/rotate.c b/src/bin/lttng/commands/rotate.c index ab31546f9..e1ed0eb7c 100644 --- a/src/bin/lttng/commands/rotate.c +++ b/src/bin/lttng/commands/rotate.c @@ -104,7 +104,7 @@ static int rotate_tracing(char *session_name) } if (rotation_state == LTTNG_ROTATION_STATE_ONGOING) { - ret = usleep(DEFAULT_DATA_AVAILABILITY_WAIT_TIME); + ret = usleep(DEFAULT_DATA_AVAILABILITY_WAIT_TIME_US); if (ret) { PERROR("\nusleep"); goto error; diff --git a/src/bin/lttng/commands/stop.c b/src/bin/lttng/commands/stop.c index 9d211d68b..d2040b9f9 100644 --- a/src/bin/lttng/commands/stop.c +++ b/src/bin/lttng/commands/stop.c @@ -135,7 +135,7 @@ static int stop_tracing(void) * returned value indicates availability. */ if (ret) { - usleep(DEFAULT_DATA_AVAILABILITY_WAIT_TIME); + usleep(DEFAULT_DATA_AVAILABILITY_WAIT_TIME_US); _MSG("."); fflush(stdout); } diff --git a/src/common/defaults.h b/src/common/defaults.h index 08bbb64b9..183e31518 100644 --- a/src/common/defaults.h +++ b/src/common/defaults.h @@ -284,7 +284,7 @@ * Wait period before retrying the lttng_data_pending command in the lttng * stop command of liblttng-ctl. */ -#define DEFAULT_DATA_AVAILABILITY_WAIT_TIME 200000 /* usec */ +#define DEFAULT_DATA_AVAILABILITY_WAIT_TIME_US 200000 /* usec */ /* * Wait period before retrying the lttng_consumer_flushed_cache when diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index 8c52c456d..d9e961f2c 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -724,7 +724,7 @@ static int _lttng_stop_tracing(const char *session_name, int wait) * call returned value indicates availability. */ if (data_ret) { - usleep(DEFAULT_DATA_AVAILABILITY_WAIT_TIME); + usleep(DEFAULT_DATA_AVAILABILITY_WAIT_TIME_US); } } while (data_ret != 0);