Fix: skip metadata flushed check if write failed
[lttng-tools.git] / src / common / ust-consumer / ust-consumer.c
index 65220729766d4ad56c6a5c861e9b8d8f6af84927..f7ffb0febf5b7bcdc338b30975ae7e3379724935 100644 (file)
@@ -491,10 +491,6 @@ static int ask_channel(struct lttng_consumer_local_data *ctx, int sock,
 
        channel->wait_fd = ustctl_channel_get_wait_fd(channel->uchan);
 
-       if (ret < 0) {
-               goto error;
-       }
-
        /* Open all streams for this channel. */
        ret = create_ust_streams(channel, ctx);
        if (ret < 0) {
@@ -755,6 +751,14 @@ int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset,
        if (ret < 0) {
                /* Unable to handle metadata. Notify session daemon. */
                ret_code = LTTCOMM_CONSUMERD_ERROR_METADATA;
+               /*
+                * Skip metadata flush on write error since the offset and len might
+                * not have been updated which could create an infinite loop below when
+                * waiting for the metadata cache to be flushed.
+                */
+               pthread_mutex_unlock(&channel->metadata_cache->lock);
+               pthread_mutex_unlock(&consumer_data.lock);
+               goto end_free;
        }
        pthread_mutex_unlock(&channel->metadata_cache->lock);
        pthread_mutex_unlock(&consumer_data.lock);
This page took 0.023731 seconds and 4 git commands to generate.