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 755867 - playsink: fix leak of audio sink
playsink: fix leak of audio sink
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: 1.6.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 756552 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2015-09-30 09:39 UTC by Arnaud Vrac
Modified: 2015-10-17 08:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
playsink: fix leak of audio sink (906 bytes, patch)
2015-09-30 09:39 UTC, Arnaud Vrac
needs-work Details | Review

Description Arnaud Vrac 2015-09-30 09:39:41 UTC
Created attachment 312413 [details] [review]
playsink: fix leak of audio sink

The leak was introduced in commit f99a24f8b3 (playsink: Require the
streamvolume interface on the sink when using the sink).
Comment 1 Tim-Philipp Müller 2015-09-30 12:45:42 UTC
It looks right at first glance. I tried to write a unit test for it and it executes that code path, but valgrind shows no leak. But then it doesn't either if I add extra refs, so I don't know what's going on there.
Comment 2 Arnaud Vrac 2015-09-30 17:43:01 UTC
I don't know about valgrind, I'm using refdbg to trace GObjects leaks. Are you using G_SLICE=always-malloc when running valgrind ?
Comment 3 Sebastian Dröge (slomo) 2015-10-02 13:25:20 UTC
I also had it a few times that valgrind didn't detect obvious leaks. So let's get this in
Comment 4 Sebastian Dröge (slomo) 2015-10-02 13:30:21 UTC
Review of attachment 312413 [details] [review]:

::: gst/playback/gstplaysink.c
@@ +2768,3 @@
   if (elem) {
     chain->volume = elem;
+    gst_object_unref (elem);

Why is this correct? And there's the same code in line 2971 :)

I wonder why we don't keep another reference around of the chain->volume thing... and unref it later. That would seem more consistent.
Comment 5 Sebastian Dröge (slomo) 2015-10-15 06:41:12 UTC
*** Bug 756552 has been marked as a duplicate of this bug. ***
Comment 6 Sebastian Dröge (slomo) 2015-10-15 06:45:37 UTC
commit b424bc2e4f9a3bc80f713194419bdb3153d4f08d
Author: Vineeth TM <vineeth.tm@samsung.com>
Date:   Thu Oct 15 10:01:38 2015 +0900

    playsink: Fix volume element leak
    
    In case sink implements a streamvolume interface, volume element is being got
    from the sink. But this is transfer full. So the memory should be freed before
    setting it to NULL. This was resulting in major memory leaks
    
    https://bugzilla.gnome.org/show_bug.cgi?id=755867
Comment 7 Sebastian Dröge (slomo) 2015-10-15 06:46:43 UTC
Now with the testcase from bug #756552, I still get
> GStreamer-CRITICAL **: gst_poll_get_read_gpollfd: assertion 'set != NULL' failed

after a while. So we still leak *something* :)
Comment 8 Sebastian Dröge (slomo) 2015-10-15 06:52:24 UTC
After 508 iterations btw, and it's the bus that is failing with this error when creating it.
Comment 9 Sebastian Dröge (slomo) 2015-10-15 06:55:24 UTC
... because we're leaking all playbin instances for whatever reason.
Comment 10 Vineeth 2015-10-15 07:06:09 UTC
Yeah.. 
this was not happening for me, because i changed to  proper file path
  g_object_set (G_OBJECT (playbin), "uri", "file:///home/vineethtm/gst/master/media/11.ogg", NULL);


With the same code it is still leaking because of the file not available.. Have to check more about this.
Comment 11 Vineeth 2015-10-15 07:20:25 UTC
and just for reference, this leak is happening even without the commit mentioned above.. so there seems to be other leaks.
Comment 12 Sebastian Dröge (slomo) 2015-10-15 07:21:18 UTC
So in error cases we're leaking something somewhere. Start with checking where we first detect the error, and if we leak something in the error code path there. Or if we leak something when an error message arrives somewhere in a message handler inside uridecodebin or playbin.
Comment 13 Sebastian Dröge (slomo) 2015-10-15 07:35:47 UTC
Let's handle that in bug #756611 then :)
Comment 14 Christoph Reiter (lazka) 2015-10-15 08:58:06 UTC
Thanks for the quick fix. Will this get pushed to 1.6 as well?
Comment 15 Sebastian Dröge (slomo) 2015-10-15 09:14:21 UTC
Yes, soon