Fix: close indexes when rotating the trace files in mmap mode
[lttng-tools.git] / src / common / consumer.c
index 9eb24c7a49df195c08e644e1aaba000c710608b5..db0e96223217d64a198af4c7ef0d21b75fa0d736 100644 (file)
@@ -1212,8 +1212,6 @@ void lttng_consumer_cleanup(void)
         * it.
         */
        lttng_ht_destroy(consumer_data.stream_list_ht);
-
-       run_as_destroy_worker();
 }
 
 /*
@@ -1600,6 +1598,12 @@ ssize_t lttng_consumer_on_read_subbuffer_mmap(
                        outfd = stream->out_fd;
 
                        if (stream->index_fd >= 0) {
+                               ret = close(stream->index_fd);
+                               if (ret < 0) {
+                                       PERROR("Closing index");
+                                       goto end;
+                               }
+                               stream->index_fd = -1;
                                ret = index_create_file(stream->chan->pathname,
                                                stream->name, stream->uid, stream->gid,
                                                stream->chan->tracefile_size,
@@ -1783,6 +1787,12 @@ ssize_t lttng_consumer_on_read_subbuffer_splice(
                        outfd = stream->out_fd;
 
                        if (stream->index_fd >= 0) {
+                               ret = close(stream->index_fd);
+                               if (ret < 0) {
+                                       PERROR("Closing index");
+                                       goto end;
+                               }
+                               stream->index_fd = -1;
                                ret = index_create_file(stream->chan->pathname,
                                                stream->name, stream->uid, stream->gid,
                                                stream->chan->tracefile_size,
This page took 0.050242 seconds and 4 git commands to generate.