File descriptor leak on Raspberry Pi

Nicolas Dufresne nicolas at ndufresne.ca
Mon May 1 18:06:54 UTC 2023


Hi,

Le jeudi 27 avril 2023 à 14:47 +0200, Jérôme Laheurte via gstreamer-devel a
écrit :
> Hello everybody. There seems to be a file descriptor leak in the device
> monitor API on ARM; using this sample program:
> 
> #include <unistd.h>
> #include <gst/gst.h>
> 
> int main(int argc, char *argv[]) {
>   gst_init(&argc, &argv);
> 
>   while (1) {
>     GstDeviceMonitor* monitor = gst_device_monitor_new();
>     if (!gst_device_monitor_start(monitor))
>       return 1;
>     gst_device_monitor_stop(monitor);
>     gst_object_unref(monitor);
> 
>     sleep(1);
>   }
> 
>   return 0;
> }
> 
> and monitoring /proc/[pid]/fd, there’s one new file descriptor every second
> created by eventfd2. Funny thing this only happens on a Raspberry Pi 4B
> (Raspbian). Versions tested:

Thank you very much for the report, this little test was very handy. I have made
a merge request to fix this leak, the eventfd is from a leaked GMainLoop.

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4521

> 
>   * GStreamer 1.14.4 RPi: leak
>   * GStreamer 1.18.4 RPi: leak
>   * GStreamer 1.18.4 Intel: no leak
>   * GStreamer 1.16.3 Intel: no leak
> 
> The only device provider is v4l2, with gudev enabled. I can provide more logs
> and test more recent versions if necessary, though it will take some time. A
> quick search in the issues didn’t turn out anything but I wanted to make sure
> before opening a new one: is this known ?
> 
> Best regards
> Jérôme Laheurte
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20230501/919730e7/attachment.htm>


More information about the gstreamer-devel mailing list