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 497002 - Decodebin2 deadlock when demuxer bufferallocs on exposed raw pad
Decodebin2 deadlock when demuxer bufferallocs on exposed raw pad
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 588262 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-11-15 09:41 UTC by Tommi Myöhänen
Modified: 2012-06-28 09:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
use buffer_alloc instead of pad_alloc if pad is blocked (1004 bytes, patch)
2008-04-25 06:28 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
none Details | Review
use object lock and macros for both checks (1.09 KB, patch)
2008-04-25 07:46 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
none Details | Review

Description Tommi Myöhänen 2007-11-15 09:41:50 UTC
I have a case where 

 * demuxer exposes (first) raw pad inside decodebin2
 * decodebin2 plugs multiqueue to the raw pad
 * decodebin2 exposes multiqueue src pad and sets it blocked
 * demuxer prepares to push first buffer and calls gst_pad_alloc_buffer
 * multiqueue bufferalloc function is called
 -> deadlock, bufferalloc blocks because multiqueue src pad is blocked and demuxer can't go on

Should the first buffers be allocated by multiqueue in case the src pad is blocked?
Comment 1 Edward Hervey 2007-11-15 11:08:51 UTC
tricky one. I'm not feeling comfortable about constantly checking whether source pads are blocked...
Comment 2 Jan Schmidt 2007-11-15 11:19:23 UTC
You can't check reliably anyway - not atomically.

I think the correct fix will involve having decodebin track pads which come directly from the demuxer via multiqueue - the should be handled differently to pads that are buffer-alloc'd through a decoder.

I suppose it is possible to have a buffer-alloc on a decodebin2 output pad from a decoder which is proxying an upstream buffer-alloc request, but I can't think of any instances where that is implemented, and I don't know how we would handle it.
Comment 3 Wim Taymans 2007-11-15 17:08:34 UTC
I don't really see the deadlock here. After decodebin2 exposed the pads it'll unblock the pads and dataflow can continue. Am I missing something?
Comment 4 Jan Schmidt 2007-11-15 17:20:41 UTC
As I understand it, the deadlock happens when you ask decodebin2 to give you 'encoded' formats, direct from the demuxer - ie, the demuxer is trying to buffer-alloc one the first pad, so it gets blocked while decodebin2 waits for the other pads, which will never come because the demuxer is blocked and can't create them.
Comment 5 Tommi Myöhänen 2008-04-03 10:09:30 UTC
(In reply to comment #4)
> As I understand it, the deadlock happens when you ask decodebin2 to give you
> 'encoded' formats, direct from the demuxer - ie, the demuxer is trying to
> buffer-alloc one the first pad, so it gets blocked while decodebin2 waits for
> the other pads, which will never come because the demuxer is blocked and can't
> create them.
> 

Yes, so the problem occurs when there's no decoder needed in decodebin2 and demuxer wants to do buffer_alloc. 
Comment 6 Wim Taymans 2008-04-03 10:14:10 UTC
oh right, because the pad_alloc is not decoupled with the multiqueue.
Comment 7 Stefan Sauer (gstreamer, gtkdoc dev) 2008-04-25 06:28:31 UTC
Created attachment 109883 [details] [review]
use buffer_alloc instead of pad_alloc if pad is blocked
Comment 8 Stefan Sauer (gstreamer, gtkdoc dev) 2008-04-25 07:46:22 UTC
Created attachment 109886 [details] [review]
use object lock and macros for both checks
Comment 9 Sebastian Dröge (slomo) 2009-05-07 13:31:51 UTC
Any news on this? The last patch seems to improve the situation at least
Comment 10 Thiago Sousa Santos 2009-11-25 18:42:44 UTC
*** Bug 588262 has been marked as a duplicate of this bug. ***
Comment 11 Thiago Sousa Santos 2009-11-25 18:44:08 UTC
The patch didn't fix it for 588262 because the multiqueue's srcpad might be blocked AND linked and it will forward the alloc to the next pad/element, that can be blocked.
Comment 12 Tim-Philipp Müller 2012-02-24 12:34:29 UTC
I think we have changed all demuxers now to not ever do a pad_alloc_buffer.
Comment 13 Tim-Philipp Müller 2012-06-27 17:08:04 UTC
Can this be closed as OBSOLETE ?

In 0.10 we've fixed it by making demuxers not pad_alloc IIRC, and in 0.11 this isn't really a problem any longer, is it? (And pad probes/blocks can be done with much more fine-grained control).
Comment 14 Sebastian Dröge (slomo) 2012-06-28 09:20:16 UTC
Yes, for 0.10 it's fixed in all demuxers and for 0.11 it's completely different