From 25e05442022c5b38b5f17ef7ea03723fa05ecc7e Mon Sep 17 00:00:00 2001 From: David Goulet Date: Tue, 25 Mar 2014 11:34:47 -0400 Subject: [PATCH] Fix: don't ask data pending if session was not started Fixes #770 Signed-off-by: David Goulet --- src/bin/lttng-sessiond/cmd.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 20b072060..36fe233ae 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -2528,6 +2528,21 @@ int cmd_data_pending(struct ltt_session *session) if (session->enabled) { ret = LTTNG_ERR_SESSION_STARTED; goto error; + } else { + /* + * If stopped, just make sure we've started before else the above call + * will always send that there is data pending. + * + * The consumer assumes that when the data pending command is received, + * the trace has been started before or else no output data is written + * by the streams which is a condition for data pending. So, this is + * *VERY* important that we don't ask the consumer before a start + * trace. + */ + if (!session->started) { + ret = 0; + goto error; + } } if (ksess && ksess->consumer) { -- 2.34.1