From: Jonathan Rajotte Date: Wed, 6 Jun 2018 16:06:04 +0000 (-0400) Subject: Fix: cleanup relayd sockets on rotation command communication error X-Git-Tag: v2.11.0-rc2~217 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=768f6a48fa1c038a789306140deeef4b1e0390a2;p=lttng-tools.git Fix: cleanup relayd sockets on rotation command communication error Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/consumer/consumer.c b/src/common/consumer/consumer.c index 63a2ab288..2c8283655 100644 --- a/src/common/consumer/consumer.c +++ b/src/common/consumer/consumer.c @@ -4216,6 +4216,10 @@ int rotate_relay_stream(struct lttng_consumer_local_data *ctx, stream->chan->current_chunk_id, stream->last_sequence_number); pthread_mutex_unlock(&relayd->ctrl_sock_mutex); + if (ret < 0) { + ERR("Relayd rotate stream failed. Cleaning up relayd %" PRIu64".", relayd->net_seq_idx); + lttng_consumer_cleanup_relayd(relayd); + } if (ret) { ERR("Rotate relay stream"); } @@ -4389,6 +4393,10 @@ int rotate_rename_relay(const char *old_path, const char *new_path, pthread_mutex_lock(&relayd->ctrl_sock_mutex); ret = relayd_rotate_rename(&relayd->control_sock, old_path, new_path); + if (ret < 0) { + ERR("Relayd rotate rename failed. Cleaning up relayd %" PRIu64".", relayd->net_seq_idx); + lttng_consumer_cleanup_relayd(relayd); + } pthread_mutex_unlock(&relayd->ctrl_sock_mutex); end: return ret; @@ -4419,6 +4427,10 @@ int lttng_consumer_rotate_pending_relay(uint64_t session_id, pthread_mutex_lock(&relayd->ctrl_sock_mutex); ret = relayd_rotate_pending(&relayd->control_sock, chunk_id); + if (ret < 0) { + ERR("Relayd rotate pending failed. Cleaning up relayd %" PRIu64".", relayd->net_seq_idx); + lttng_consumer_cleanup_relayd(relayd); + } pthread_mutex_unlock(&relayd->ctrl_sock_mutex); end: @@ -4456,6 +4468,10 @@ int mkdir_relay(const char *path, uint64_t relayd_id) pthread_mutex_lock(&relayd->ctrl_sock_mutex); ret = relayd_mkdir(&relayd->control_sock, path); + if (ret < 0) { + ERR("Relayd mkdir failed. Cleaning up relayd %" PRIu64".", relayd->net_seq_idx); + lttng_consumer_cleanup_relayd(relayd); + } pthread_mutex_unlock(&relayd->ctrl_sock_mutex); end: