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 782553 - Resources are not being freed when using alsasink/pulsesink
Resources are not being freed when using alsasink/pulsesink
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-python
1.6.2
Other Linux
: Normal major
: 1.13.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-05-12 12:16 UTC by Daniel
Modified: 2017-06-02 08:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gst_bin_add: change the annotation to (transfer floating). (991 bytes, patch)
2017-05-31 17:24 UTC, Mathieu Duponchelle
none Details | Review

Description Daniel 2017-05-12 12:16:59 UTC
Hi, using Gstreamer 1.8.3 and gst-python 1.6.2 in Ubuntu 16.04 I see that launching a pipeline with audiotestsrc and alsasink or pulsesink doesn't free resources correctly.

If I check the /proc/<PROC_ID>/fd of the python script, I notice that the opened files list grows each time I restart the pipeline.

If I use the C bindings instead of Python it works correctly.

I tried to create the pipeline in three different ways, and all seemed to give the same result.

Gist with all the scripts used for testing.
https://gist.github.com/dpeite/44f5b0d58b242d6ec1e47dcd88e77615

Tested in Python 2.7.12 so far. We will test it in Python 3 next week.
Comment 1 Daniel 2017-05-15 08:15:05 UTC
Tested in Python 3.5.2 and also didn't work.

But if I use autoaudiosink instead of alsasink or pulsesink it works correctly on both Python versions.
Comment 2 Daniel 2017-05-18 11:07:27 UTC
I tested using alsasrc and pulsesrc instead of audiotestsrc and doesn't free resources.

In summary:

audiotestsrc --------- autoaudiosink      = All ok, no new files
audiotestsrc --------- pulsesink/alsasink = New files in each iteration
alsasrc/pulsesrc ----- autoaudiosink      = New files in each iteration
alsasrc/pulsesrc ----- pulsesink/alsasink = New files in each iteration
Comment 3 Alfonso 2017-05-29 17:00:50 UTC
I have tried executing the scripts with the gstreamer master branch and they seem to have the same issue. The python scripts create new files with each iteration and the C script does not.
Comment 4 Alfonso 2017-05-29 17:01:13 UTC
Is there something else we can test to help narrow down the issue?
Comment 5 Arjen Veenhuizen 2017-05-31 10:59:24 UTC
Just to let you know that I too ran into this problem and never really got around solving it. Note that calling self.pipeline.unref() explicitly does not free your handles and causes a refcount warning when the (python) process is finished. I see the same behavior when using a pipeline like 

videotestsrc - xvimagesink
Comment 6 Tim-Philipp Müller 2017-05-31 11:07:33 UTC
This might also be related to floating references and how we have annotated them in GStreamer in the past. Sebastian did a whole bunch of fixes for that in git master, for what it's worth, so you might want to test with that as well.
Comment 7 Mathieu Duponchelle 2017-05-31 17:24:04 UTC
Created attachment 352959 [details] [review]
gst_bin_add: change the annotation to (transfer floating).

The default implementation then goes on to call gst_object_set_parent,
which is (transfer floating).
Comment 8 Alfonso 2017-06-01 16:32:44 UTC
I've tested the master branch and the issue seems to be fixed. Should this change also be applied to the 1.8 branch (and 1.10, 1.12, ...)?

I have patched and compiled the 1.8 with this change and it seems to also fix the issue, but I may be missing more fixes related to the annotations?
Comment 9 Arun Raghavan 2017-06-02 02:52:32 UTC
I'm not sure we want to push this to 1.12 as a point release change, so you might have to wait till 1.14 to have this in a stable release. Either way, it's unlikely we'll make backports to versions older than 1.12 (the overhead of maintaining more than one previous stable release is too high).
Comment 10 Tim-Philipp Müller 2017-06-02 08:20:39 UTC
These changes are a bit intrusive, I don't think they'll be backported.

Thanks for testing and confirming it's fixed in master!