[Bug 776039] New: queue: deadlock between sink query and state change

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Tue Dec 13 10:30:55 UTC 2016


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

            Bug ID: 776039
           Summary: queue: deadlock between sink query and state change
    Classification: Platform
           Product: GStreamer
           Version: git master
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gstreamer (core)
          Assignee: gstreamer-bugs at lists.freedesktop.org
          Reporter: knorr.jesper at gmail.com
        QA Contact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---

Created attachment 341864
  --> https://bugzilla.gnome.org/attachment.cgi?id=341864&action=edit
Test case

A queue can deadlock, if it is handling a sink query and a state change at the
same time.

This seems to be a regression introduced by
722ad087338520047241a319a506e464017bf0da discussed in
https://bugzilla.gnome.org/show_bug.cgi?id=763496

I have attached a test application. With the current master (49f1f35), I hit a
repeatable deadlock within seconds. If I revert
722ad087338520047241a319a506e464017bf0da the deadlock does not happen.

A trace of the deadlock with gstreamer sources on 49f1f35:

Thread 169 (Thread 0x7fffeffff700 (LWP 26643)):
#0  __lll_lock_wait () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
#1  0x00007ffff7328f3a in __GI___pthread_mutex_lock (mutex=0x555555934bd0) at
../nptl/pthread_mutex_lock.c:115
#2  0x00007ffff51e21c8 in gst_queue_sink_activate_mode (pad=0x555555a90280,
parent=<optimized out>, mode=<optimized out>, active=0) at gstqueue.c:1687
#3  0x00007ffff7b1967d in activate_mode_internal (pad=pad at entry=0x555555a90280,
parent=parent at entry=0x555555a921f0, mode=mode at entry=GST_PAD_MODE_PUSH,
active=active at entry=0) at gstpad.c:1178
#4  0x00007ffff7b19e1a in gst_pad_set_active (pad=pad at entry=0x555555a90280,
active=0) at gstpad.c:1079
#5  0x00007ffff7af89bd in activate_pads (vpad=<optimized out>,
ret=0x7fffefffec40, active=0x7fffefffec9c) at gstelement.c:2828
#6  0x00007ffff7b0a82c in gst_iterator_fold (it=it at entry=0x7fffdc0029e0,
func=func at entry=0x7ffff7af89a0 <activate_pads>, ret=ret at entry=0x7fffefffec40,
user_data=user_data at entry=0x7fffefffec9c)
    at gstiterator.c:616
#7  0x00007ffff7af93bf in iterator_activate_fold_with_resync
(iter=iter at entry=0x7fffdc0029e0, user_data=user_data at entry=0x7fffefffec9c,
func=0x7ffff7af89a0 <activate_pads>) at gstelement.c:2852
#8  0x00007ffff7afb186 in gst_element_pads_activate
(element=element at entry=0x555555a921f0, active=<optimized out>, active at entry=0)
at gstelement.c:2896
#9  0x00007ffff7afb44e in gst_element_change_state_func
(element=0x555555a921f0, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at
gstelement.c:2962
#10 0x00007ffff7afd37e in gst_element_change_state
(element=element at entry=0x555555a921f0,
transition=transition at entry=GST_STATE_CHANGE_PAUSED_TO_READY) at
gstelement.c:2740
#11 0x00007ffff7afdaef in gst_element_set_state_func (element=0x555555a921f0,
state=GST_STATE_READY) at gstelement.c:2694
#12 0x00007ffff7adb9bd in gst_bin_element_set_state (next=GST_STATE_READY,
current=GST_STATE_PAUSED, start_time=0, base_time=6564948943835,
element=0x555555a921f0, bin=0x555555aa0200) at gstbin.c:2619
#13 gst_bin_change_state_func (element=0x555555aa0200,
transition=GST_STATE_CHANGE_PAUSED_TO_READY) at gstbin.c:2961
#14 0x00007ffff7afd37e in gst_element_change_state
(element=element at entry=0x555555aa0200,
transition=transition at entry=GST_STATE_CHANGE_PAUSED_TO_READY) at
gstelement.c:2740
#15 0x00007ffff7afdaef in gst_element_set_state_func (element=0x555555aa0200,
state=GST_STATE_NULL) at gstelement.c:2694
#16 0x0000555555554ca0 in close_func ()
#17 0x00007ffff75af7d5 in g_thread_proxy (data=0x5555557c3370) at gthread.c:784
#18 0x00007ffff73266ca in start_thread (arg=0x7fffeffff700) at
pthread_create.c:333
#19 0x00007ffff70600af in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:105

Thread 6 (Thread 0x7fffef7fe700 (LWP 26480)):
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007ffff75cd9ba in g_cond_wait_until (cond=cond at entry=0x555555764218,
mutex=mutex at entry=0x555555764210, end_time=end_time at entry=6580449054) at
gthread-posix.c:1442
#2  0x00007ffff755be89 in g_async_queue_pop_intern_unlocked
(queue=queue at entry=0x555555764210, wait=wait at entry=1,
end_time=end_time at entry=6580449054) at gasyncqueue.c:422
#3  0x00007ffff755c4ab in g_async_queue_timeout_pop (queue=0x555555764210,
timeout=timeout at entry=15000000) at gasyncqueue.c:543
#4  0x00007ffff75b022a in g_thread_pool_wait_for_new_pool () at
gthreadpool.c:167
#5  g_thread_pool_thread_proxy (data=<optimized out>) at gthreadpool.c:364
#6  0x00007ffff75af7d5 in g_thread_proxy (data=0x7ffff0001d40) at gthread.c:784
#7  0x00007ffff73266ca in start_thread (arg=0x7fffef7fe700) at
pthread_create.c:333
#8  0x00007ffff70600af in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:105

Thread 3 (Thread 0x7ffff49ad700 (LWP 26477)):
#0  __lll_lock_wait () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
#1  0x00007ffff7328f3a in __GI___pthread_mutex_lock (mutex=0x555555934bd0) at
../nptl/pthread_mutex_lock.c:115
#2  0x00007ffff7b13758 in gst_pad_send_event_unchecked
(pad=pad at entry=0x555555a90280, event=<optimized out>,
event at entry=0x7fffe8003ca0,
type=type at entry=GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM) at gstpad.c:5570
#3  0x00007ffff7b1441e in gst_pad_push_event_unchecked
(pad=pad at entry=0x555555a90040, event=0x7fffe8003ca0,
type=type at entry=GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM) at gstpad.c:5262
#4  0x00007ffff7b14830 in push_sticky (pad=pad at entry=0x555555a90040,
ev=ev at entry=0x7ffff49acce0, user_data=user_data at entry=0x7ffff49acd50) at
gstpad.c:3805
#5  0x00007ffff7b1241f in events_foreach (pad=pad at entry=0x555555a90040,
func=func at entry=0x7ffff7b146e0 <push_sticky>,
user_data=user_data at entry=0x7ffff49acd50) at gstpad.c:603
#6  0x00007ffff7b1ed11 in check_sticky (event=0x7fffe8003ca0,
pad=0x555555a90040) at gstpad.c:3862
#7  gst_pad_push_event (pad=0x555555a90040, event=event at entry=0x7fffe8003ca0)
at gstpad.c:5393
#8  0x00007ffff5b16e28 in gst_base_src_send_stream_start
(src=src at entry=0x555555a8c0d0) at gstbasesrc.c:886
#9  0x00007ffff5b19d10 in gst_base_src_send_stream_start (src=0x555555a8c0d0)
at gstbasesrc.c:2703
#10 gst_base_src_loop (pad=0x555555a90040) at gstbasesrc.c:2693
#11 0x00007ffff7b49b91 in gst_task_func (task=0x555555aa35f0) at gsttask.c:334
#12 0x00007ffff75b016e in g_thread_pool_thread_proxy (data=<optimized out>) at
gthreadpool.c:307
#13 0x00007ffff75af7d5 in g_thread_proxy (data=0x555555a9f2d0) at gthread.c:784
#14 0x00007ffff73266ca in start_thread (arg=0x7ffff49ad700) at
pthread_create.c:333
#15 0x00007ffff70600af in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:105

Thread 1 (Thread 0x7ffff7fc6700 (LWP 26471)):
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007ffff75cd89f in g_cond_wait (cond=cond at entry=0x555555a924c0,
mutex=mutex at entry=0x555555a92470) at gthread-posix.c:1395
#2  0x00007ffff51de42b in gst_queue_handle_sink_query (pad=<optimized out>,
parent=0x555555a921f0, query=0x5555557c30f0) at gstqueue.c:1048
#3  0x00007ffff7b1b978 in gst_pad_query (pad=0x555555a90280,
query=0x5555557c30f0) at gstpad.c:3948
#4  0x0000555555554e05 in main ()

-- 
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