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 674043 - [0.11] Serialized allocation query deadlocks
[0.11] Serialized allocation query deadlocks
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.11.x
Other Mac OS
: Normal major
: 0.11.x
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-04-13 12:18 UTC by Matej Knopp
Modified: 2012-04-16 11:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
decodebin should not block on caps event (1.01 KB, patch)
2012-04-16 10:44 UTC, Matej Knopp
none Details | Review
decodebin should not block on sticky and oob events (2.06 KB, patch)
2012-04-16 11:32 UTC, Matej Knopp
none Details | Review
decodebin should not block on sticky and oob events (1.13 KB, patch)
2012-04-16 11:39 UTC, Matej Knopp
none Details | Review
decodebin should not block on sticky and oob events (1.08 KB, patch)
2012-04-16 11:45 UTC, Matej Knopp
committed Details | Review

Description Matej Knopp 2012-04-13 12:18:53 UTC
QT Demuxer deadlocks when posting the (now serialized) allocation query

Stack trace:
  • #3 g_cond_wait
  • #4 gst_multi_queue_sink_query
  • #5 gst_pad_query
  • #6 gst_pad_peer_query
  • #7 qtdemux_do_allocation
  • #8 gst_qtdemux_add_stream
  • #9 qtdemux_expose_streams

gst_multi_queue_sink_query blocks until there is response for the query, but the response never comes because of a blocking probe. The blocking probe will be lifted when other streams are exposed, which doesn't happen because qtdemux loop thread is stuck.

I might be missing something here but how can serialized queries work (given current implementation) with queues without deadlocking?
Comment 1 Wim Taymans 2012-04-14 08:01:44 UTC
(In reply to comment #0)

>I might be missing something here but how can serialized queries work (given
>current implementation) with queues without deadlocking?

It's not related to serialized events. In this case, qtdemux should first expose the pads and then do the allocation queries on them.
Comment 2 Matej Knopp 2012-04-14 08:26:35 UTC
I didn't mention serialized events, i meant serialized queries.

What if (hypothetically) there is a blocking probe that will only be removed when there is data coming on other pads. The data will never come though because qtdemux gets stuck doing the allocation query.

i.e.

           +----+---[ Pad1: thread blocked by probe 
         / |    |           lifted when there is data on other branches]
QtDemux +--| MQ +---[ Pad2 ]
         \ |    |
           +----+---[ Pad3 ]

QtDemux will do Allocation Query on pad1 from the loop thread. The thread is paused until Pad1 responds. However there is blocking probe on pad1 that will only be lifted when some other probe (on pad2 or 3) gets data, caps event etc.

Normally the probe wouldn't be a problem because there is a multiqueue. However with serialized queries the query will block the loop thread immediately, even with multiqueue.
Comment 3 Wim Taymans 2012-04-16 09:08:23 UTC
(In reply to comment #2)
> I didn't mention serialized events, i meant serialized queries.

I meant serialized queries.

> 
> What if (hypothetically) there is a blocking probe that will only be removed
> when there is data coming on other pads. The data will never come though
> because qtdemux gets stuck doing the allocation query.
> 
> i.e.
> 
>            +----+---[ Pad1: thread blocked by probe 
>          / |    |           lifted when there is data on other branches]
> QtDemux +--| MQ +---[ Pad2 ]
>          \ |    |
>            +----+---[ Pad3 ]

> 
> QtDemux will do Allocation Query on pad1 from the loop thread. The thread is
> paused until Pad1 responds. However there is blocking probe on pad1 that will
> only be lifted when some other probe (on pad2 or 3) gets data, caps event etc.

You should make the probe not block on the query. Then the query will be done (not-linked or you can reply yourself) and dataflow continues as it was before. The fact that the query is serialized is not a problem, the new thing is that the blocking probe and also block on queries now.

I was talking about another case where the app is waiting for no-more-pads to remove the probes.
Comment 4 Matej Knopp 2012-04-16 10:44:19 UTC
Created attachment 212131 [details] [review]
decodebin should not block on caps event

Decodebin blocking on caps event was blocking the demuxer loop thread
Comment 5 Matej Knopp 2012-04-16 11:32:45 UTC
Created attachment 212135 [details] [review]
decodebin should not block on sticky and oob events
Comment 6 Matej Knopp 2012-04-16 11:39:58 UTC
Created attachment 212137 [details] [review]
decodebin should not block on sticky and oob events
Comment 7 Matej Knopp 2012-04-16 11:45:30 UTC
Created attachment 212139 [details] [review]
decodebin should not block on sticky and oob events

put the block after variable declarations
Comment 8 Sebastian Dröge (slomo) 2012-04-16 11:49:28 UTC
commit b6765417e18fd97435b77464439c999f49c6a186
Author: Matej Knopp <matej.knopp@gmail.com>
Date:   Mon Apr 16 13:43:41 2012 +0200

    decodebin: Do not block on sticky and oob events