GNOME Bugzilla – Bug 757975
jackaudiosink leaks file descriptors when errors occur.
Last modified: 2016-03-01 12:13:24 UTC
I have written a media player which uses playbin with the audio-sink set to jackaudiosink. When the playback completes correctly, there is no issue. When an error occurs, for instance when the JACK server is not present, then the application will leak file descriptors until they run out and my application crashes. I have narrowed this behaviour down to the jackaudiosink, as it does not happen with other audio-sinks. Additionally, file descriptor leaks are also seen when using gst-play with the jackaudiosink. I have also produced the minimal code to reproduce this, as below: #include <gst/gst.h> #include <glib.h> #include <unistd.h> gint main(gint argc, gchar *argv[]) { gst_init(&argc, &argv); GstElement *audio_sink = gst_element_factory_make("jackaudiosink", NULL); GstElement *play = gst_element_factory_make("playbin", "play"); g_object_set(G_OBJECT(play), "uri", argv[1], NULL); g_object_set(G_OBJECT(play), "audio-sink", audio_sink, NULL); gst_element_set_state(play, GST_STATE_PLAYING); sleep(1); gst_element_set_state(play, GST_STATE_NULL); gst_object_unref(GST_OBJECT(play)); gst_deinit(); return 0; } Compiled with the following, on Ubuntu 15.10: gcc -Wall jack_leak.c -o jack_leak $(pkg-config --cflags --libs gstreamer-1.0) The file descriptors can be shown with valgrind. Trace shown below after running valgrind --track-fds=yes --suppressions=gst.supp ./jack_leak file:///home/tristan/test.mp3 are shown below: ==52435== FILE DESCRIPTORS: 7 open at exit. ==52435== Open AF_UNIX socket 6: <unknown> ==52435== at 0x56D10EA: socketpair (syscall-template.S:81) ==52435== by 0x4EB6919: gst_poll_new (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.600.0) ==52435== by 0x4EB6A0D: gst_poll_new_timer (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.600.0) ==52435== by 0x4E760B7: gst_bus_constructed (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.600.0) ==52435== by 0x516D906: g_object_new_internal (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== by 0x516EC70: g_object_newv (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== by 0x4E76771: gst_bus_new (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.600.0) ==52435== by 0x4EAFDAD: gst_pipeline_init (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.600.0) ==52435== by 0x518B3B6: g_type_create_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== by 0x516D38A: g_object_new_internal (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== by 0x516F224: g_object_new_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== by 0x516F590: g_object_new (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== ==52435== Open AF_UNIX socket 5: <unknown> ==52435== at 0x56D10EA: socketpair (syscall-template.S:81) ==52435== by 0x4EB6919: gst_poll_new (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.600.0) ==52435== by 0x4EB6A0D: gst_poll_new_timer (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.600.0) ==52435== by 0x4E760B7: gst_bus_constructed (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.600.0) ==52435== by 0x516D906: g_object_new_internal (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== by 0x516EC70: g_object_newv (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== by 0x4E76771: gst_bus_new (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.600.0) ==52435== by 0x4EAFDAD: gst_pipeline_init (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.600.0) ==52435== by 0x518B3B6: g_type_create_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== by 0x516D38A: g_object_new_internal (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== by 0x516F224: g_object_new_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== by 0x516F590: g_object_new (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== ==52435== Open AF_UNIX socket 4: <unknown> ==52435== at 0x56D10EA: socketpair (syscall-template.S:81) ==52435== by 0x4EB6919: gst_poll_new (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.600.0) ==52435== by 0x4EB6A0D: gst_poll_new_timer (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.600.0) ==52435== by 0x4ECDC75: gst_system_clock_init (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.600.0) ==52435== by 0x518B3B6: g_type_create_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== by 0x516D38A: g_object_new_internal (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== by 0x516F224: g_object_new_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== by 0x516F590: g_object_new (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== by 0x74508CE: gst_audio_clock_new (in /usr/lib/x86_64-linux-gnu/libgstaudio-1.0.so.0.600.0) ==52435== by 0x746AD0F: gst_audio_base_sink_init (in /usr/lib/x86_64-linux-gnu/libgstaudio-1.0.so.0.600.0) ==52435== by 0x518B3B6: g_type_create_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== by 0x516D38A: g_object_new_internal (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== ==52435== Open AF_UNIX socket 3: <unknown> ==52435== at 0x56D10EA: socketpair (syscall-template.S:81) ==52435== by 0x4EB6919: gst_poll_new (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.600.0) ==52435== by 0x4EB6A0D: gst_poll_new_timer (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.600.0) ==52435== by 0x4ECDC75: gst_system_clock_init (in /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0.600.0) ==52435== by 0x518B3B6: g_type_create_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== by 0x516D38A: g_object_new_internal (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== by 0x516F224: g_object_new_valist (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== by 0x516F590: g_object_new (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== by 0x74508CE: gst_audio_clock_new (in /usr/lib/x86_64-linux-gnu/libgstaudio-1.0.so.0.600.0) ==52435== by 0x746AD0F: gst_audio_base_sink_init (in /usr/lib/x86_64-linux-gnu/libgstaudio-1.0.so.0.600.0) ==52435== by 0x518B3B6: g_type_create_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== by 0x516D38A: g_object_new_internal (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4600.1) ==52435== ==52435== Open file descriptor 2: /dev/pts/0 ==52435== <inherited from parent> ==52435== ==52435== Open file descriptor 1: /dev/pts/0 ==52435== <inherited from parent> ==52435== ==52435== Open file descriptor 0: /dev/pts/0 ==52435== <inherited from parent>
I've run into a very similar issue but with pulseaudio instead of jack, and with gstreamer 1.6.0. Upgrading gst-plugins-base to 1.6.1 (or 1.6.2) fixes it for me. Specifically, the fix for bug #755867 also applies to this one. Can you confirm?
I can confirm that these file descriptors are no longer leaked on GStreamer 1.6.3.
Great, thanks for confirming.