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 574024 - [GstAdapter] gst_adapter_push should not accept empty buffers
[GstAdapter] gst_adapter_push should not accept empty buffers
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other All
: Normal minor
: 0.10.23
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-03-04 03:33 UTC by vanista
Modified: 2009-03-04 08:25 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description vanista 2009-03-04 03:33:23 UTC
Please describe the problem:
When empty buffers are pushed into an adapter, these buffers remain alive until gst_adapter_clear is called. This can potentially be a runtime leak in filters which access adapters with take, peek and flush functions, and only clear the adapter in their reset or finalize functions. For a live streaming application, this can cause the adapter to grow indefinitely.

Steps to reproduce:
I stumbled on this problem by doing some tests with the fakesrc filter. For instance, the following pipeline causes a major leak which can quickly use up all available memory :

gst-launch-0.10 fakesrc ! mpegtsdemux ! fakesink

I recommand using ulimit to prevent a DoS while running this, or be quick to kill it ;-)



Actual results:
fakesrc pushes buffers with no data, mpegtsdemux adds these buffers to it's initial adapter then checks for available size. Since all buffers are empty, the adapter just keeps growing.
If subsequent buffers are not empty and regular take and peek functions are called, the empty buffers are ignored and remain queued in the adapter.

Expected results:


Does this happen every time?
Yes it's systematic

Other information:
I'm not sure about the odds of encountering empty buffers, but seeing the udpsrc filter allows receiving empty payloads, I guess it's plausible.

In any case, I think it's conceptually wrong to pile up empty buffers in an adapter for which the purpose is to provide a fixed number of bytes. These should be unreffed automatically in the gst_adapter_push function.
Comment 1 Edward Hervey 2009-03-04 08:07:04 UTC
Indeed, since the adapter works in bytes, pushing empty buffers is pointless. They should be unreffed in _push().
Comment 2 Edward Hervey 2009-03-04 08:25:30 UTC
commit f0481cb7174008336f16a9ea7b45c1ae5d197cf4
Author: Edward Hervey <bilboed@bilboed.com>
Date:   Wed Mar 4 09:20:43 2009 +0100

    GstAdapter: Discard empty buffers in _push(). Fixes #574024