Fix: sessiond: snapshot: handle consumer return codes
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 14 Nov 2018 21:46:05 +0000 (16:46 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 16 Nov 2018 20:48:07 +0000 (15:48 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/consumer.c
src/bin/lttng-sessiond/ust-app.c

index b6c9d3055705b04bea1e848750f76cf1a1d86912..a179eeffd1f72f5cde0d1fcb013e70ae2ac4b7e2 100644 (file)
@@ -1505,6 +1505,14 @@ int consumer_snapshot_channel(struct consumer_socket *socket, uint64_t key,
        ret = consumer_send_msg(socket, &msg);
        pthread_mutex_unlock(socket->lock);
        if (ret < 0) {
+               switch (-ret) {
+               case LTTCOMM_CONSUMERD_CHAN_NOT_FOUND:
+                       ret = -LTTNG_ERR_CHAN_NOT_FOUND;
+                       break;
+               default:
+                       ret = -LTTNG_ERR_SNAPSHOT_FAIL;
+                       break;
+               }
                goto error;
        }
 
index 2c1b845adf56bc35ef2ec1875599e2c2113904ae..0e1907d8e99ed5fef30dd1e52f1bf802b51381ea 100644 (file)
@@ -6066,15 +6066,17 @@ int ust_app_snapshot_record(struct ltt_ust_session *usess,
                                                nb_packets_per_stream,
                                                trace_archive_id);
                                if (ret < 0) {
+                                       if (ret == -LTTNG_ERR_CHAN_NOT_FOUND) {
+                                               continue;
+                                       }
                                        goto error;
                                }
                        }
 
                        registry = get_session_registry(ua_sess);
                        if (!registry) {
-                               DBG("Application session is being torn down. Abort snapshot record.");
-                               ret = -1;
-                               goto error;
+                               DBG("Application session is being torn down. Skip application.");
+                               continue;
                        }
                        ret = consumer_snapshot_channel(socket,
                                        registry->metadata_key, output,
@@ -6082,6 +6084,9 @@ int ust_app_snapshot_record(struct ltt_ust_session *usess,
                                        pathname, wait, 0,
                                        trace_archive_id);
                        if (ret < 0) {
+                               if (ret == -LTTNG_ERR_CHAN_NOT_FOUND) {
+                                       continue;
+                               }
                                goto error;
                        }
                }
This page took 0.029659 seconds and 5 git commands to generate.