App using gstwaylandsink leaks fds

Nicolas Dufresne nicolas at ndufresne.ca
Wed Mar 25 21:50:36 UTC 2020


Le mercredi 25 mars 2020 à 20:28 +0100, Guillermo Rodriguez Garcia a
écrit :
> Hello all,
> 
> I have a minimal app using gstwaylandsink to show video from IP
> cameras. I found that every time the pipeline is stopped and
> destroyed, fds are leaked. After some time the application cannot
> create any fds and fails with a trace similar to this:
> 
> ERROR> 0:41:16.094958597   584 0xb3ef5b20 ERROR            waylandsink
> wlshmallocator.c:59:gst_wl_shm_allocator_alloc:<wlshmallocator0>
> opening temp file /run/xdg/wayland-shm-1644-51WWXP failed: Too many
> open files
> ERROR> 0:41:16.095183222   584 0xb3ef5b20 WARN              GST_BUFFER
> gstbuffer.c:907:gst_buffer_new_allocate: failed to allocate 4 bytes
> ERROR> (gstplayer:584): GStreamer-CRITICAL **: gst_buffer_memset:
> assertion 'GST_IS_BUFFER (buffer)' failed
> ERROR> (gstplayer:584): GStreamer-CRITICAL **: gst_buffer_peek_memory:
> assertion 'GST_IS_BUFFER (buffer)' failed
> ERROR> ** (gstplayer:584): CRITICAL **: gst_fd_memory_get_fd:
> assertion 'mem != NULL' failed
> ERROR> 0:41:16.095766306   584 0xb3ef5b20 ERROR            waylandsink
> wlshmallocator.c:211:gst_wl_shm_memory_construct_wl_buffer:<GstWlDisplay at 0xb3e55210>
> wl_shm_memory: dup failed for fd=-1 (err=-1) mem=(nil)
> 
> From a quick look at the source code I see that the fds are being
> allocated in gst_wl_shm_allocator_alloc [1]. But where are they being
> (/should they be) released?

We do 'gst_buffer_replace (&sink->last_buffer, to_render);' which drop
reference on last_buffer, and take ownerhsip of to_render.

What GStreamer version is this ? Do you have some information on how to
reproduce ? I don't face this issue here.

> 
> I need to dig further into this, but I'm not familiar with how this
> works -- any hints would be welcome.
> 
>  [1]: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/blob/master/ext/wayland/wlshmallocator.c#L40



More information about the gstreamer-devel mailing list