Fix: close wait_fd on kernel tracing
authorJulien Desfossez <jdesfossez@efficios.com>
Thu, 23 May 2013 20:13:35 +0000 (16:13 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 28 May 2013 17:08:45 +0000 (13:08 -0400)
The wait_fd in the kernel consumer streams was not closed causing a leak
of FDs in the consumer and never triggering the teardown mechanism in
the kernel tracer. This applies for metadata and data stream.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/common/consumer.c

index 044a504cec512443039e15eac186df07e841f896..990db9e2690eff92ec683b8dd1df1aef65542ab0 100644 (file)
@@ -463,6 +463,13 @@ void consumer_del_stream(struct lttng_consumer_stream *stream,
                                PERROR("munmap");
                        }
                }
+
+               if (stream->wait_fd >= 0) {
+                       ret = close(stream->wait_fd);
+                       if (ret) {
+                               PERROR("close");
+                       }
+               }
                break;
        case LTTNG_CONSUMER32_UST:
        case LTTNG_CONSUMER64_UST:
@@ -1876,6 +1883,13 @@ void consumer_del_metadata_stream(struct lttng_consumer_stream *stream,
                                PERROR("munmap metadata stream");
                        }
                }
+
+               if (stream->wait_fd >= 0) {
+                       ret = close(stream->wait_fd);
+                       if (ret < 0) {
+                               PERROR("close kernel metadata wait_fd");
+                       }
+               }
                break;
        case LTTNG_CONSUMER32_UST:
        case LTTNG_CONSUMER64_UST:
This page took 0.035524 seconds and 4 git commands to generate.