[lttng-dev] [LTTNG-TOOLS PATCH 2/9] Explicitely stop the session on lttng destroy

Julien Desfossez jdesfossez at efficios.com
Mon Jul 13 11:28:02 EDT 2015


This is going to be useful for the upcoming feature that checks and
eventually displays the amount of lost packets/discarded events.

If we don't do that, more events might be lost/discarded between the
"lttng destroy" command and the time the trace is actually stopped.

Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
 src/bin/lttng/commands/destroy.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/bin/lttng/commands/destroy.c b/src/bin/lttng/commands/destroy.c
index 53fe3ac..3a6e3ef 100644
--- a/src/bin/lttng/commands/destroy.c
+++ b/src/bin/lttng/commands/destroy.c
@@ -78,6 +78,13 @@ static int destroy_session(struct lttng_session *session)
 	int ret;
 	char *session_name = NULL;
 
+	ret = lttng_stop_tracing_no_wait(session->name);
+	if (ret < 0) {
+		if (ret != -LTTNG_ERR_TRACE_ALREADY_STOPPED) {
+			ERR("%s", lttng_strerror(ret));
+		}
+	}
+
 	ret = lttng_destroy_session(session->name);
 	if (ret < 0) {
 		switch (-ret) {
-- 
1.9.1




More information about the lttng-dev mailing list