[Bug 745319] New: gstqueue can lock the pipeline

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Fri Feb 27 20:38:20 PST 2015


https://bugzilla.gnome.org/show_bug.cgi?id=745319

            Bug ID: 745319
           Summary: gstqueue can lock the pipeline
    Classification: Platform
           Product: GStreamer
           Version: 1.4.5
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gstreamer (core)
          Assignee: gstreamer-bugs at lists.freedesktop.org
          Reporter: msameer at foolab.org
        QA Contact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---

I have a simple pipeline like this:
gst-launch-1.0 playbin video-sink=fakesink uri=file:///path/to/file

I am using a custom decoder element which gets picked up by playbin.

The decoder has a task running on its src pad to push decoded buffers
downstream which fails due to caps negotiation failing.

handle_frame then starts to return GST_FLOW_NOT_NEGOTIATED as well.

The problem is vqueue locks up and the pipeline hangs.

I traced it farther and the problem seems to be in gstqueue

decoder tries to finish a decoded frame
gst_queue_chain gets called with a buffer
gst_queue_loop wakes up because a buffer got pushed to the queue
gst_queue_push_one picks up the buffer and then returns a flow error
_loop() goes to out_flushing which will pause the task but it will 

the custom decoder is still not aware of this error tries to finish a new frame
but since caps negotiation has not succeeded then gstvideodecoder will try to
negotiate and send an allocation query which will freeze waiting on gstqueue
query_handled which will never get signaled because the task has been paused.

The stack trace from gdb indicates that:
#0  __libc_do_syscall () at
../ports/sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:43
#1  0xb6c70340 in __pthread_cond_wait (cond=cond at entry=0xb5255238,
mutex=0xb5256cc0)
    at pthread_cond_wait.c:187
#2  0xb6d3bd64 in g_cond_wait (cond=0x14e1528, mutex=0x14e14ec) at
gthread-posix.c:753
#3  0xb658fa14 in gst_queue_handle_sink_query (pad=<optimized out>,
parent=0x14e12f0, 
    query=<optimized out>) at gstqueue.c:922
#4  0xb6eca270 in gst_pad_query (pad=pad at entry=0xb540c988,
query=query at entry=0xb5256800)
    at gstpad.c:3584
#5  0xb6eca70c in gst_pad_peer_query (pad=0x152eb98, query=0xb5256800) at
gstpad.c:3712
#6  0xb6eca9d6 in query_forward_func (pad=<optimized out>, data=0xa86c42fc) at
gstpad.c:3040
#7  0xb6ec97e8 in gst_pad_forward (pad=pad at entry=0x14f4e80, 
    forward=0xb6eca959 <query_forward_func>,
user_data=user_data at entry=0xa86c42fc) at gstpad.c:2796
#8  0xb6ec9bc2 in gst_pad_query_default (pad=0x14f4e80, parent=<optimized out>,
query=0xb5256800)
    at gstpad.c:3104
#9  0xb6eca270 in gst_pad_query (pad=pad at entry=0x14f4e80,
query=query at entry=0xb5256800)
    at gstpad.c:3584
#10 0xb6eca70c in gst_pad_peer_query (pad=0xb526a1c0, query=0xb5256800) at
gstpad.c:3712
#11 0xb6eca9d6 in query_forward_func (pad=<optimized out>, data=0xa86c44fc) at
gstpad.c:3040
#12 0xb6ec97e8 in gst_pad_forward (pad=pad at entry=0x152ee48, 
    forward=0xb6eca959 <query_forward_func>,
user_data=user_data at entry=0xa86c44fc) at gstpad.c:2796
#13 0xb6ec9bc2 in gst_pad_query_default (pad=0x152ee48, parent=<optimized out>,
query=0xb5256800)
    at gstpad.c:3104
#14 0xb6eca270 in gst_pad_query (pad=pad at entry=0x152ee48,
query=query at entry=0xb5256800)
    at gstpad.c:3584
#15 0xb6eca70c in gst_pad_peer_query (pad=0xb529e078, query=0xb5256800) at
gstpad.c:3712
#16 0xa9985448 in ?? () from /usr/lib/gstreamer-1.0/libgstdeinterlace.so
#17 0xb6eca270 in gst_pad_query (pad=pad at entry=0xb5264e90,
query=query at entry=0xb5256800)
    at gstpad.c:3584
#18 0xb6eca70c in gst_pad_peer_query (pad=0xb5264d48,
query=query at entry=0xb5256800)
    at gstpad.c:3712
#19 0xb665ad00 in gst_base_transform_default_propose_allocation
(trans=0xb528ea50, 
---Type <return> to continue, or q <return> to quit---
    decide_query=<optimized out>, query=0xb5256800) at gstbasetransform.c:1418
#20 0xb669b5c0 in gst_video_filter_propose_allocation
(trans=trans at entry=0xb528ea50, 
    decide_query=decide_query at entry=0x0, query=query at entry=0xb5256800) at
gstvideofilter.c:64
#21 0xb665a8f0 in gst_base_transform_default_query (trans=0xb528ea50,
direction=<optimized out>, 
    query=0xb5256800) at gstbasetransform.c:1482
#22 0xb6eca270 in gst_pad_query (pad=pad at entry=0xb5264c00,
query=query at entry=0xb5256800)
    at gstpad.c:3584
#23 0xb6eca70c in gst_pad_peer_query (pad=0x152ecf0, query=0xb5256800) at
gstpad.c:3712
#24 0xb6eca9d6 in query_forward_func (pad=<optimized out>, data=0xa86c4bbc) at
gstpad.c:3040
#25 0xb6ec97e8 in gst_pad_forward (pad=pad at entry=0xb526a058, 
    forward=0xb6eca959 <query_forward_func>,
user_data=user_data at entry=0xa86c4bbc) at gstpad.c:2796
#26 0xb6ec9bc2 in gst_pad_query_default (pad=0xb526a058, parent=<optimized
out>, query=0xb5256800)
    at gstpad.c:3104
#27 0xb6eca270 in gst_pad_query (pad=pad at entry=0xb526a058,
query=query at entry=0xb5256800)
    at gstpad.c:3584
#28 0xb6eca70c in gst_pad_peer_query (pad=0xb5264ab8, query=0xb5256800) at
gstpad.c:3712
#29 0xb6eca9d6 in query_forward_func (pad=<optimized out>, data=0xa86c4dbc) at
gstpad.c:3040
#30 0xb6ec97e8 in gst_pad_forward (pad=pad at entry=0xb52641c0, 
    forward=0xb6eca959 <query_forward_func>,
user_data=user_data at entry=0xa86c4dbc) at gstpad.c:2796
#31 0xb6ec9bc2 in gst_pad_query_default (pad=0xb52641c0, parent=<optimized
out>, query=0xb5256800)
    at gstpad.c:3104
#32 0xb6eca270 in gst_pad_query (pad=pad at entry=0xb52641c0,
query=query at entry=0xb5256800)
    at gstpad.c:3584
#33 0xb6eca70c in gst_pad_peer_query (pad=0x152e638, query=0xb5256800) at
gstpad.c:3712
#34 0xb6eca9d6 in query_forward_func (pad=<optimized out>, data=0xa86c4fbc) at
gstpad.c:3040
#35 0xb6ec97e8 in gst_pad_forward (pad=pad at entry=0x14f4a48, 
    forward=0xb6eca959 <query_forward_func>,
user_data=user_data at entry=0xa86c4fbc) at gstpad.c:2796
#36 0xb6ec9bc2 in gst_pad_query_default (pad=0x14f4a48, parent=<optimized out>,
query=0xb5256800)
    at gstpad.c:3104
#37 0xb6eca270 in gst_pad_query (pad=pad at entry=0x14f4a48,
query=query at entry=0xb5256800)
    at gstpad.c:3584
---Type <return> to continue, or q <return> to quit---
#38 0xb6eca70c in gst_pad_peer_query (pad=0xb540c5b0, query=0xb5256800) at
gstpad.c:3712
#39 0xb6eca9d6 in query_forward_func (pad=<optimized out>, data=0xa86c51bc) at
gstpad.c:3040
#40 0xb6ec97e8 in gst_pad_forward (pad=pad at entry=0x166a848, 
    forward=0xb6eca959 <query_forward_func>,
user_data=user_data at entry=0xa86c51bc) at gstpad.c:2796
#41 0xb6ec9bc2 in gst_pad_query_default (pad=0x166a848, parent=<optimized out>,
query=0xb5256800)
    at gstpad.c:3104
#42 0xb6eca270 in gst_pad_query (pad=pad at entry=0x166a848,
query=query at entry=0xb5256800)
    at gstpad.c:3584
#43 0xb6eca70c in gst_pad_peer_query (pad=0x14f4610, query=0xb5256800) at
gstpad.c:3712
#44 0xb6eca9d6 in query_forward_func (pad=<optimized out>, data=0xa86c53bc) at
gstpad.c:3040
#45 0xb6ec97e8 in gst_pad_forward (pad=pad at entry=0x152e230, 
    forward=0xb6eca959 <query_forward_func>,
user_data=user_data at entry=0xa86c53bc) at gstpad.c:2796
#46 0xb6ec9bc2 in gst_pad_query_default (pad=0x152e230, parent=<optimized out>,
query=0xb5256800)
    at gstpad.c:3104
#47 0xb6eca270 in gst_pad_query (pad=pad at entry=0x152e230,
query=query at entry=0xb5256800)
    at gstpad.c:3584
#48 0xb6eca70c in gst_pad_peer_query (pad=0xb5217040, query=0xb5256800) at
gstpad.c:3712
#49 0xb6eca9d6 in query_forward_func (pad=<optimized out>, data=0xa86c55bc) at
gstpad.c:3040
#50 0xb6ec97e8 in gst_pad_forward (pad=pad at entry=0x14f5630, 
    forward=0xb6eca959 <query_forward_func>,
user_data=user_data at entry=0xa86c55bc) at gstpad.c:2796
#51 0xb6ec9bc2 in gst_pad_query_default (pad=pad at entry=0x14f5630,
parent=parent at entry=0xb5217040, 
    query=query at entry=0xb5256800) at gstpad.c:3104
#52 0xb67860f8 in gst_decode_pad_query (pad=0x14f5630, parent=0xb5217040,
query=0xb5256800)
    at gstdecodebin2.c:4365
#53 0xb6eca270 in gst_pad_query (pad=pad at entry=0x14f5630,
query=query at entry=0xb5256800)
    at gstpad.c:3584
#54 0xb6eca70c in gst_pad_peer_query (pad=0x1501be8, query=0xb5256800) at
gstpad.c:3712
#55 0xb66a59dc in gst_video_decoder_negotiate_pool (decoder=0xb5244168,
caps=<optimized out>)
    at gstvideodecoder.c:3293
#56 0xb66a7d14 in gst_video_decoder_negotiate_unlocked (decoder=0xb5244168)
    at gstvideodecoder.c:3443
---Type <return> to continue, or q <return> to quit---
#57 gst_video_decoder_finish_frame (decoder=0xb5244168, frame=0x14feaa0) at
gstvideodecoder.c:2649

(gdb) frame 4
#4  0xb6eca270 in gst_pad_query (pad=pad at entry=0xb540c988,
query=query at entry=0xb5256800)
    at gstpad.c:3584
3584    gstpad.c: No such file or directory.
(gdb) print *query
$1 = {mini_object = {type = 21345144, refcount = 1, lockstate = 0, flags = 0, 
    copy = 0xb6ed7c15 <_gst_query_copy>, dispose = 0x0, free = 0xb6ed7161
<_gst_query_free>, 
    n_qdata = 0, qdata = 0x0}, type = GST_QUERY_ALLOCATION}

I have been reading the code and the only thing I can think of is a race
condition:

gst_queue_handle_sink_query
queue->srcresult is set to GST_FLOW_OK before g_cond_wait gets invoked
(gstqueue.c:909 and 917)

meanwhile gst_queue_loop updates queue->srcresult (line 1299) and the cond
never gets signaled and we wait forever.

I tried with a few other decoders and I am not sure why my custom decoder is
causing this ;-)

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list