From 9bbfb88c5a3b6b581c81d2c9a9db14246f84675a Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 14 Nov 2018 16:46:05 -0500 Subject: [PATCH] Fix: sessiond: snapshot: handle consumer return codes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/consumer.c | 8 ++++++++ src/bin/lttng-sessiond/ust-app.c | 11 ++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c index b6c9d3055..a179eeffd 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -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; } diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 2c1b845ad..0e1907d8e 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -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; } } -- 2.34.1