After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 687845 - filesrc: leaks file descriptor if activation in pull mode fails
filesrc: leaks file descriptor if activation in pull mode fails
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
1.0.2
Other Linux
: Normal major
: 1.0.4
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-11-07 14:02 UTC by fcosta87
Modified: 2012-12-14 14:39 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description fcosta87 2012-11-07 14:02:19 UTC
Using the following pipeline filesrc fails to open file:

filesrc location=/dev/dvb/adapter0/dvr0 ! tsdemux ! h264parser ! avdec_h264 ! xvimagesink

The output from the log is the following:


0:00:00.221212462  4545  0x9527460 ERROR                basesrc gstbasesrc.c:3278:gst_base_src_start_complete:<file-source> Cannot operate in pull mode, stopping
0:00:00.221289531  4545  0x9527460 WARN                 filesrc gstfilesrc.c:513:gst_file_src_start:<file-source> error: No se pudo abrir el archivo «/dev/dvb/adapter0/dvr0» para leer.
0:00:00.221306784  4545  0x9527460 WARN                 filesrc gstfilesrc.c:513:gst_file_src_start:<file-source> error: system error: Dispositivo o recurso ocupado
0:00:00.221336008  4545  0x9527460 WARN                 basesrc gstbasesrc.c:3509:gst_base_src_activate_push:<file-source> Failed to start in push mode
0:00:00.221349720  4545  0x9527460 WARN                GST_PADS gstpad.c:974:gst_pad_set_active:<file-source:src> Failed to activate pad

I read the code in gstfilesrc.c and realized that if pull mode fails it doesn't close the file before triying to re-open it in push-mode.
Comment 1 Edward Hervey 2012-11-09 10:12:39 UTC
When using DVB, you should use the dvbsrc element.

gst-launch-1.0 dvbsrc ! tsdemux ! ...
Comment 2 fcosta87 2012-11-09 14:46:14 UTC
/dev/dvb/adapter0/dvr0 is a pipe created by myself. I don't need all the things that dvbsrc takes care of.

If i debug filesrc i can see that first it tries to open the file in pull-mode, it fails. While trying to open in push-mode, in the function gst_file_src_start I can see that before opening it src->fd isn't 0. Therefore i presume the file is still opened and that's why the log says the device is busy.
Comment 3 Tim-Philipp Müller 2012-11-09 14:54:42 UTC
Re-opening, if there's a logic error / bug in the open sequence, it probably applies regardless of the file.
Comment 4 Tim-Philipp Müller 2012-11-09 21:12:23 UTC
Confirmed.

I'm not entirely sure what the right place to fix it is though. This async start/complete/wait stuff is a bit confusing.
Comment 5 Wim Taymans 2012-12-13 13:50:16 UTC
commit 6e6fc159a7c22eecbf04086c72cb182bad4ed7d3
Author: Wim Taymans <wim.taymans@collabora.co.uk>
Date:   Thu Dec 13 14:48:35 2012 +0100

    basesrc: call _stop when start failed
    
    When we failed to complete the start, call stop again. This makes sure that all
    successfull calls to _start are paired with a _stop.
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=687845