From: David Goulet Date: Tue, 25 Mar 2014 15:34:47 +0000 (-0400) Subject: Fix: don't ask data pending if session was not started X-Git-Tag: v2.5.0-rc1~93 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=3a89d11a0ad0ca327e2df99eaf13d3a0c63e3af3;hp=9b399c4853771a3b8a49c880a9b12dd91bc4c327 Fix: don't ask data pending if session was not started Fixes #770 Signed-off-by: David Goulet --- diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 5bec35548..6df18935e 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -2532,6 +2532,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) {