Fix: if relayd is unreachable, disable consumer for the session
authorDavid Goulet <dgoulet@efficios.com>
Tue, 25 Jun 2013 20:25:06 +0000 (16:25 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 25 Jun 2013 20:25:06 +0000 (16:25 -0400)
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/ust-app.c
src/bin/lttng-sessiond/ust-consumer.c

index bba77023a6415ff0b52e9f0dcfde6729c5a0856f..bcf349f9290476de0268dce0e9a535e331d6dedc 100644 (file)
@@ -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;
 }
index 1736a3e851b20b646aa0f0b95c8e65c3ddc67fd6..0f553a671603845a6bdd40b9819505963d27c45b 100644 (file)
@@ -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();
index ca96ff727bbd6705b84cc6f88c2e3826929bda9f..367e92cd32368b2b4b522834bad22010c1668cf7 100644 (file)
@@ -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);
This page took 0.029056 seconds and 4 git commands to generate.