From: David Goulet Date: Tue, 25 Jun 2013 20:25:06 +0000 (-0400) Subject: Fix: if relayd is unreachable, disable consumer for the session X-Git-Tag: v2.2.0~2 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=d9078d0c000d04d49c599a72c1a725026b636ec0;p=lttng-tools.git Fix: if relayd is unreachable, disable consumer for the session Signed-off-by: David Goulet --- diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index bba77023a..bcf349f92 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -606,10 +606,11 @@ close_sock: error: if (ret != LTTNG_OK) { /* - * On error, nullify the consumer sequence index so streams are not - * associated with it once sent to the consumer. + * The consumer output for this session should not be used anymore + * since the relayd connection failed thus making any tracing or/and + * streaming not usable. */ - uatomic_set(&consumer->net_seq_index, -1); + consumer->enabled = 0; } return ret; } diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 1736a3e85..0f553a671 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -1946,9 +1946,11 @@ static int do_consumer_create_channel(struct ltt_ust_session *usess, * Now get the channel from the consumer. This call wil populate the stream * list of that channel and set the ust objects. */ - ret = ust_consumer_get_channel(socket, ua_chan); - if (ret < 0) { - goto error_destroy; + if (usess->consumer->enabled) { + ret = ust_consumer_get_channel(socket, ua_chan); + if (ret < 0) { + goto error_destroy; + } } rcu_read_unlock(); diff --git a/src/bin/lttng-sessiond/ust-consumer.c b/src/bin/lttng-sessiond/ust-consumer.c index ca96ff727..367e92cd3 100644 --- a/src/bin/lttng-sessiond/ust-consumer.c +++ b/src/bin/lttng-sessiond/ust-consumer.c @@ -203,6 +203,12 @@ int ust_consumer_ask_channel(struct ust_app_session *ua_sess, assert(socket->fd >= 0); assert(registry); + if (!consumer->enabled) { + ret = -LTTNG_ERR_NO_CONSUMER; + DBG3("Consumer is disabled"); + goto error; + } + pthread_mutex_lock(socket->lock); ret = ask_channel_creation(ua_sess, ua_chan, consumer, socket, registry);