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 767688 - queue2: fix crash deleting current region for small ring buffers
queue2: fix crash deleting current region for small ring buffers
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 1.8.3
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-06-15 12:46 UTC by Vincent Penquerc'h
Modified: 2016-11-22 11:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
queue2: fix crash deleting current region for small ring buffers (1.39 KB, patch)
2016-06-15 12:47 UTC, Vincent Penquerc'h
none Details | Review
unit test for regression (2.13 KB, patch)
2016-06-15 15:30 UTC, Vincent Penquerc'h
none Details | Review
queue2: fix crash deleting current region for small ring buffers (1.62 KB, patch)
2016-06-17 09:52 UTC, Vincent Penquerc'h
none Details | Review
queue2: fix crash deleting current region for small ring buffers (1.26 KB, patch)
2016-06-17 13:51 UTC, Vincent Penquerc'h
committed Details | Review
unit test for regression (2.21 KB, patch)
2016-06-17 13:52 UTC, Vincent Penquerc'h
committed Details | Review

Description Vincent Penquerc'h 2016-06-15 12:46:31 UTC
repro case:

gst-launch-1.0 filesrc location=sample.ogg ! queue2
ring-buffer-max-size=1000 ! oggdemux ! opusdec ! autoaudiosink
Comment 1 Vincent Penquerc'h 2016-06-15 12:47:18 UTC
Created attachment 329852 [details] [review]
queue2: fix crash deleting current region for small ring buffers
Comment 2 Tim-Philipp Müller 2016-06-15 12:56:32 UTC
Could you add a unit test as well? :)
Comment 3 Vincent Penquerc'h 2016-06-15 13:10:18 UTC
Will do :)
Comment 4 Vincent Penquerc'h 2016-06-15 15:30:55 UTC
Created attachment 329866 [details] [review]
unit test for regression
Comment 5 Sebastian Dröge (slomo) 2016-06-17 09:44:41 UTC
Comment on attachment 329852 [details] [review]
queue2: fix crash deleting current region for small ring buffers

Please explain a bit in more detail what happens, why it crashes and under what conditions, and how that is solved :) In the commit message I mean.

What would be the effect of create_write() returning FALSE? Shouldn't it rather create a new range instead?
Comment 6 Vincent Penquerc'h 2016-06-17 09:52:12 UTC
Created attachment 329935 [details] [review]
queue2: fix crash deleting current region for small ring buffers

Now with more comments in the commit message.

The current behavior is to fail. Maybe creating another range would be better, I don't know how queue2 works internally. But I suspect the reason why the current range is destroyed is because there is no space for a new one.
Comment 7 Sebastian Dröge (slomo) 2016-06-17 10:09:17 UTC
I guess this needs further investigation then to understand what should actually happen, and if failing is the right thing to do.
Comment 8 Vincent Penquerc'h 2016-06-17 13:51:42 UTC
Created attachment 329957 [details] [review]
queue2: fix crash deleting current region for small ring buffers
Comment 9 Vincent Penquerc'h 2016-06-17 13:52:05 UTC
Created attachment 329958 [details] [review]
unit test for regression
Comment 10 Vincent Penquerc'h 2016-06-17 13:52:55 UTC
In fact, it turns out that simply not destroying the current range works, and does not need erroring out. So it was not about no space left after all.
Comment 11 Vincent Penquerc'h 2016-06-21 09:33:39 UTC
commit 08d30b05c63cfef7244e02ba04ff9de07f4ced3c
Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Date:   Wed Jun 15 16:24:27 2016 +0100

    tests: add a test for small ring buffer sizes
    
    https://bugzilla.gnome.org/show_bug.cgi?id=767688

commit b3802f7a9e7988901367196dd3dc45cf4053d850
Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Date:   Wed Jun 15 13:43:59 2016 +0100

    queue2: fix crash deleting current region for small ring buffers
    
    Ensure we do not attempt to destroy the current range. Doing so
    causes the current one to be left dangling, and it may be dereferenced
    later, leading to a crash.
    
    This can happen with a very small queue2 ring buffer (10000 bytes)
    and 4 kB buffers.
    
    repro case:
    
    gst-launch-1.0 fakesrc sizetype=2 sizemax=4096 ! \
    queue2 ring-buffer-max-size=1000 ! fakesink sync=true
    
    https://bugzilla.gnome.org/show_bug.cgi?id=767688
Comment 12 Sebastian Dröge (slomo) 2016-06-27 06:31:54 UTC
Should this go into 1.8?