[Bug 796935] parsebin: Add missing locks/unlocks of the chain mutex

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Thu Aug 9 10:12:56 UTC 2018


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

--- Comment #3 from Sebastian Dröge (slomo) <slomo at coaxion.net> ---
The patch seems to cause deadlocks sometimes. Holding the chain mutex is a bad
idea while adding pads or otherwise emitting signals or taking any stream lock.

Thread 4 (Thread 0x7f6484dfa700 (LWP 16253)):
#0  0x00007f6487385a79 in syscall () at
../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007f6487502e0f in g_cond_wait (cond=cond at entry=0x56254c672f50,
mutex=mutex at entry=0x56254c672f08)
    at ../../../../glib/gthread-posix.c:1402
#2  0x00007f6487acb58b in gst_task_func (task=0x56254c672ef0 [GstTask]) at
gsttask.c:313
#3  0x00007f64874e57d0 in g_thread_pool_thread_proxy (data=<optimized out>)
    at ../../../../glib/gthreadpool.c:307
#4  0x00007f64874e4e05 in g_thread_proxy (data=0x56254c46ef20) at
../../../../glib/gthread.c:784
#5  0x00007f6487457f2a in start_thread (arg=0x7f6484dfa700) at
pthread_create.c:463
#6  0x00007f648738aedf in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 3 (Thread 0x7f64855fb700 (LWP 16252)):
#0  0x00007f6487385a79 in syscall () at
../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007f648750245c in g_mutex_lock_slowpath (mutex=0x56254c6700a0)
    at ../../../../glib/gthread-posix.c:1320
#2  0x00007f6487502ce2 in g_mutex_lock (mutex=<optimized out>) at
../../../../glib/gthread-posix.c:1344
#3  0x00007f6486b338a8 in gst_parse_pad_query (pad=0x56254c6802d0
[GstProxyPad], parent=0x7f64800377b0 [GstParsePad], query=0x56254c478e30) at
gstparsebin.c:4167
#4  0x00007f6487a9d1f0 in gst_pad_query (pad=pad at entry=0x56254c6802d0
[GstProxyPad], query=query at entry=0x56254c478e30) at gstpad.c:4067
#5  0x00007f6487ad99ac in gst_pad_query_accept_caps
(pad=pad at entry=0x56254c6802d0 [GstProxyPad], caps=<optimized out>) at
gstutils.c:3126
#6  0x00007f6487a95cea in pre_eventfunc_check (event=0x7f64780238a0,
pad=0x56254c6802d0 [GstProxyPad])
    at gstpad.c:5597
#7  0x00007f6487a95cea in gst_pad_send_event_unchecked
(pad=pad at entry=0x56254c6802d0 [GstProxyPad], event=event at entry=0x7f64780238a0,
type=<optimized out>, type at entry=GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM)
---Type <return> to continue, or q <return> to quit---
    at gstpad.c:5731
#8  0x00007f6487a961a3 in gst_pad_push_event_unchecked
(pad=pad at entry=0x56254c668050 [GstPad], event=0x7f64780238a0,
type=type at entry=GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM) at gstpad.c:5396
#9  0x00007f6487a96614 in push_sticky (pad=pad at entry=0x56254c668050 [GstPad],
ev=ev at entry=0x7f64855faa10, user_data=user_data at entry=0x7f64855faa70) at
../gst/gstevent.h:438
#10 0x00007f6487a94028 in events_foreach (pad=pad at entry=0x56254c668050
[GstPad], func=func at entry=0x7f6487a965c0 <push_sticky>,
user_data=user_data at entry=0x7f64855faa70) at gstpad.c:608
#11 0x00007f6487a9f3a1 in check_sticky (event=0x7f64780238a0,
pad=0x56254c668050 [GstPad]) at gstpad.c:3981
#12 0x00007f6487a9f3a1 in gst_pad_push_event (pad=pad at entry=0x56254c668050
[GstPad], event=0x7f64780238a0)
    at gstpad.c:5527
#13 0x00007f6485ca4f4b in gst_pad_set_caps (caps=0x56254c66c0a0,
pad=0x56254c668050 [GstPad])
    at /home/slomo/Projects/gstreamer/head/gstreamer/gst/gstcompat.h:59
#14 0x00007f6485ca4f4b in gst_mpeg_audio_parse_handle_frame (parse=<optimized
out>, frame=0x56254c47d800, skipsize=0x7f64855fad94) at gstmpegaudioparse.c:724
#15 0x00007f6486baaeb2 in gst_base_parse_handle_buffer
(parse=parse at entry=0x7f64800affa0 [GstMpegAudioParse], buffer=<optimized out>,
skip=skip at entry=0x7f64855fad94, flushed=flushed at entry=0x7f64855fad90)
    at gstbaseparse.c:2202
#16 0x00007f6486bab58f in gst_base_parse_scan_frame
(parse=parse at entry=0x7f64800affa0 [GstMpegAudioParse], klass=<optimized out>)
at gstbaseparse.c:3509
#17 0x00007f6486baea82 in gst_base_parse_loop (pad=<optimized out>) at
gstbaseparse.c:3588
#18 0x00007f6487acb3b1 in gst_task_func (task=0x7f647800b290 [GstTask]) at
gsttask.c:328
#19 0x00007f64874e57d0 in g_thread_pool_thread_proxy (data=<optimized out>)
    at ../../../../glib/gthreadpool.c:307
#20 0x00007f64874e4e05 in g_thread_proxy (data=0x7f6480071b20) at
../../../../glib/gthread.c:784
#21 0x00007f6487457f2a in start_thread (arg=0x7f64855fb700) at
pthread_create.c:463
#22 0x00007f648738aedf in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:95

---Type <return> to continue, or q <return> to quit---
Thread 2 (Thread 0x7f64864b4700 (LWP 16251)):
#0  0x00007f648746111c in __lll_lock_wait () at
../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
#1  0x00007f648745a6c6 in __GI___pthread_mutex_lock (mutex=0x7f647c002b50)
    at ../nptl/pthread_mutex_lock.c:113
#2  0x00007f6487a9acd8 in post_activate (new_mode=GST_PAD_MODE_NONE,
pad=0x56254c6802d0 [GstProxyPad])
    at gstpad.c:1049
#3  0x00007f6487a9acd8 in activate_mode_internal (pad=pad at entry=0x56254c6802d0
[GstProxyPad], parent=parent at entry=0x7f64800377b0 [GstParsePad],
mode=mode at entry=GST_PAD_MODE_PUSH, active=active at entry=0)
    at gstpad.c:1227
#4  0x00007f6487a9b879 in gst_pad_activate_mode (pad=pad at entry=0x56254c6802d0
[GstProxyPad], mode=mode at entry=GST_PAD_MODE_PUSH, active=active at entry=0) at
gstpad.c:1325
#5  0x00007f6487a85231 in gst_ghost_pad_activate_push_default (pad=<optimized
out>, parent=<optimized out>, active=0) at gstghostpad.c:380
#6  0x00007f6487a9ac96 in activate_mode_internal (pad=pad at entry=0x7f64800377b0
[GstParsePad], parent=parent at entry=0x0, mode=mode at entry=GST_PAD_MODE_PUSH,
active=active at entry=0) at gstpad.c:1220
#7  0x00007f6487a9b6f5 in gst_pad_set_active (pad=pad at entry=0x7f64800377b0
[GstParsePad], active=active at entry=0) at gstpad.c:1118
#8  0x00007f6486b2a1f6 in gst_parse_pad_set_blocked (parsepad=0x7f64800377b0
[GstParsePad], blocked=1)
    at gstparsebin.c:4123
#9  0x00007f6486b2c47e in gst_parse_pad_activate (chain=0x56254c670090,
parsepad=0x7f64800377b0 [GstParsePad]) at gstparsebin.c:4152
#10 0x00007f6486b2c47e in expose_pad (parsebin=<optimized out>,
parsepad=0x7f64800377b0 [GstParsePad], pad=pad at entry=0x56254c668050 [GstPad],
caps=caps at entry=0x0, chain=chain at entry=0x56254c670090, src=0x7f64800affa0
[GstMpegAudioParse]) at gstparsebin.c:2364
#11 0x00007f6486b2d945 in gst_parse_chain_expose (chain=0x56254c670090,
endpads=endpads at entry=0x7f64864b3628,
missing_plugin=missing_plugin at entry=0x7f64864b3614,
missing_plugin_details=missing_plugin_details at entry=0x7f6478025860,
last_group=last_group at entry=0x7f64864b3618,
uncollected_streams=uncollected_streams at entry=0x7f---Type <return> to continue,
or q <return> to quit---
64864b361c) at gstparsebin.c:3698
#12 0x00007f6486b2de36 in gst_parse_bin_expose
(parsebin=parsebin at entry=0x56254c66e4c0 [GstParseBin])
    at gstparsebin.c:3473
#13 0x00007f6486b32fe7 in pad_added_cb (element=0x56254c66e360 [GstID3Demux],
pad=0x56254c669520 [GstPad], chain=0x56254c670090) at gstparsebin.c:2468
#14 0x00007f6486b3322f in caps_notify_cb (pad=0x56254c669520 [GstPad],
unused=<optimized out>, chain=0x56254c670090) at gstparsebin.c:2576
#18 0x00007f64877b2e0f in <emit signal notify:caps on instance 0x56254c669520
[GstPad]> (instance=instance at entry=0x56254c669520, signal_id=<optimized out>,
detail=<optimized out>)
    at ../../../../gobject/gsignal.c:3447
    #15 0x00007f6487796f6d in g_closure_invoke (closure=0x7f647c025280,
return_value=0x0, n_param_values=2, param_values=0x7f64864b38b0,
invocation_hint=0x7f64864b3830) at ../../../../gobject/gclosure.c:804
    #16 0x00007f64877a9d3e in signal_emit_unlocked_R
(node=node at entry=0x56254c410a90, detail=detail at entry=159,
instance=instance at entry=0x56254c669520,
emission_return=emission_return at entry=0x0,
instance_and_params=instance_and_params at entry=0x7f64864b38b0) at
../../../../gobject/gsignal.c:3635
    #17 0x00007f64877b23f5 in g_signal_emit_valist (instance=<optimized out>,
signal_id=<optimized out>, detail=<optimized out>,
var_args=var_args at entry=0x7f64864b3a80) at ../../../../gobject/gsignal.c:3391
#19 0x00007f648779b424 in g_object_dispatch_properties_changed
(object=0x56254c669520 [GstPad], n_pspecs=<optimized out>, pspecs=<optimized
out>) at ../../../../gobject/gobject.c:1082
#20 0x00007f6487a510d4 in gst_object_dispatch_properties_changed
(object=0x56254c669520 [GstPad], n_pspecs=1, pspecs=0x7f64864b3c00) at
gstobject.c:430
#21 0x00007f648779d969 in g_object_notify_by_spec_internal
(pspec=0x56254c4160a0 [GParamBoxed], object=0x56254c669520 [GstPad]) at
../../../../gobject/gobject.c:1175
#22 0x00007f648779d969 in g_object_notify_by_pspec
(object=object at entry=0x56254c669520 [GstPad], pspec=0x56254c4160a0
[GParamBoxed]) at ../../../../gobject/gobject.c:1285
#23 0x00007f6487a946ac in store_sticky_event (pad=pad at entry=0x56254c669520
[GstPad], event=event at entry=0x7f6478008270) at gstpad.c:5226
---Type <return> to continue, or q <return> to quit---
#24 0x00007f6487a9f648 in gst_pad_push_event (pad=pad at entry=0x56254c669520
[GstPad], event=0x7f6478008270)
    at gstpad.c:5515
#25 0x00007f64869c4e0b in gst_pad_set_caps (caps=0x56254c487c00,
pad=0x56254c669520 [GstPad])
    at /home/slomo/Projects/gstreamer/head/gstreamer/gst/gstcompat.h:59
#26 0x00007f64869c4e0b in gst_tag_demux_set_src_caps (tagdemux=<optimized out>,
new_caps=<optimized out>)
    at gsttagdemux.c:372
#27 0x00007f64869c5182 in gst_tag_demux_element_find (demux=0x56254c66e360
[GstID3Demux])
    at gsttagdemux.c:1388
#28 0x00007f64869c6365 in gst_tag_demux_element_loop (demux=0x56254c66e360
[GstID3Demux])
    at gsttagdemux.c:1449
#29 0x00007f6487acb3b1 in gst_task_func (task=0x7f647800b3b0 [GstTask]) at
gsttask.c:328
#30 0x00007f64874e57d0 in g_thread_pool_thread_proxy (data=<optimized out>)
    at ../../../../glib/gthreadpool.c:307
#31 0x00007f64874e4e05 in g_thread_proxy (data=0x56254c66c230) at
../../../../glib/gthread.c:784
#32 0x00007f6487457f2a in start_thread (arg=0x7f64864b4700) at
pthread_create.c:463
#33 0x00007f648738aedf in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7f6486c68740 (LWP 16250)):
#0  0x00007f648746111c in __lll_lock_wait () at
../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
#1  0x00007f648745a6c6 in __GI___pthread_mutex_lock (mutex=0x7f647c011660)
    at ../nptl/pthread_mutex_lock.c:113
#2  0x00007f6487aa08ce in gst_pad_pause_task (pad=0x56254c669080 [GstPad]) at
gstpad.c:6194
#3  0x00007f64869c6963 in gst_tag_demux_src_activate_mode (pad=<optimized out>,
parent=<optimized out>, mode=GST_PAD_MODE_PULL, active=0) at gsttagdemux.c:1618
#4  0x00007f6487a9ac96 in activate_mode_internal (pad=pad at entry=0x56254c669520
[GstPad], parent=parent at entry=0x56254c66e360 [GstID3Demux],
mode=mode at entry=GST_PAD_MODE_PULL, active=active at entry=0) at gstpad.c:1220
#5  0x00007f6487a9b879 in gst_pad_activate_mode (pad=pad at entry=0x56254c669520
[GstPad], mode=mode at entry=GST_---Type <return> to continue, or q <return> to
quit---
PAD_MODE_PULL, active=active at entry=0) at gstpad.c:1325
#6  0x00007f6487a9b11d in activate_mode_internal (pad=pad at entry=0x56254c668740
[GstPad], parent=parent at entry=0x7f64800affa0 [GstMpegAudioParse],
mode=mode at entry=GST_PAD_MODE_PULL, active=active at entry=0)
    at gstpad.c:1188
#7  0x00007f6487a9b6f5 in gst_pad_set_active (pad=pad at entry=0x56254c668740
[GstPad], active=0)
    at gstpad.c:1118
#8  0x00007f6487a78ced in activate_pads (vpad=<optimized out>,
ret=0x7fffe4413a00, active=0x7fffe4413a5c)
    at gstelement.c:3040
#9  0x00007f6487a8b5ac in gst_iterator_fold (it=it at entry=0x56254c46a400,
func=func at entry=0x7f6487a78cd0 <activate_pads>, ret=ret at entry=0x7fffe4413a00,
user_data=user_data at entry=0x7fffe4413a5c) at gstiterator.c:617
#10 0x00007f6487a79686 in iterator_activate_fold_with_resync
(iter=iter at entry=0x56254c46a400, user_data=user_data at entry=0x7fffe4413a5c,
func=0x7f6487a78cd0 <activate_pads>) at gstelement.c:3064
#11 0x00007f6487a7b6ce in gst_element_pads_activate
(element=element at entry=0x7f64800affa0 [GstMpegAudioParse], active=<optimized
out>, active at entry=0) at gstelement.c:3108
#12 0x00007f6487a7b921 in gst_element_change_state_func (element=0x7f64800affa0
[GstMpegAudioParse], transition=GST_STATE_CHANGE_PAUSED_TO_READY) at
gstelement.c:3174
#13 0x00007f6486baa23d in gst_base_parse_change_state (element=0x7f64800affa0
[GstMpegAudioParse], transition=GST_STATE_CHANGE_PAUSED_TO_READY) at
gstbaseparse.c:4906
#14 0x00007f6487a7da7e in gst_element_change_state
(element=element at entry=0x7f64800affa0 [GstMpegAudioParse],
transition=transition at entry=GST_STATE_CHANGE_PAUSED_TO_READY) at
gstelement.c:2952
#15 0x00007f6487a7e19e in gst_element_set_state_func (element=0x7f64800affa0
[GstMpegAudioParse], state=GST_STATE_READY) at gstelement.c:2906
#16 0x00007f6487a5b8c7 in gst_bin_element_set_state (next=GST_STATE_READY,
current=GST_STATE_PAUSED, start_time=0, base_time=36288981288020,
element=0x7f64800affa0 [GstMpegAudioParse], bin=0x56254c66e4c0 [GstParseBin])
at gstbin.c:2599
#17 0x00007f6487a5b8c7 in gst_bin_change_state_func (element=0x56254c66e4c0
[GstParseBin], transition=GST_STATE_CHANGE_PAUSED_TO_READY) at gstbin.c:2941
---Type <return> to continue, or q <return> to quit---
#18 0x00007f6486b2ced7 in gst_parse_bin_change_state (element=0x56254c66e4c0
[GstParseBin], transition=<optimized out>) at gstparsebin.c:4328
#19 0x00007f6487a7da7e in gst_element_change_state
(element=element at entry=0x56254c66e4c0 [GstParseBin],
transition=transition at entry=GST_STATE_CHANGE_PAUSED_TO_READY) at
gstelement.c:2952
#20 0x00007f6487a7e19e in gst_element_set_state_func (element=0x56254c66e4c0
[GstParseBin], state=GST_STATE_READY) at gstelement.c:2906
#21 0x00007f6487a5b8c7 in gst_bin_element_set_state (next=GST_STATE_READY,
current=GST_STATE_PAUSED, start_time=0, base_time=36288981288020,
element=0x56254c66e4c0 [GstParseBin], bin=0x56254c676340 [GstPipeline])
    at gstbin.c:2599
#22 0x00007f6487a5b8c7 in gst_bin_change_state_func (element=0x56254c676340
[GstPipeline], transition=GST_STATE_CHANGE_PAUSED_TO_READY) at gstbin.c:2941
#23 0x00007f6487a7da7e in gst_element_change_state
(element=element at entry=0x56254c676340 [GstPipeline],
transition=GST_STATE_CHANGE_PAUSED_TO_READY) at gstelement.c:2952
#24 0x00007f6487a7e47e in gst_element_continue_state
(element=element at entry=0x56254c676340 [GstPipeline],
ret=ret at entry=GST_STATE_CHANGE_SUCCESS) at gstelement.c:2660
#25 0x00007f6487a7dc65 in gst_element_change_state
(element=element at entry=0x56254c676340 [GstPipeline],
transition=transition at entry=GST_STATE_CHANGE_PLAYING_TO_PAUSED) at
gstelement.c:2991
#26 0x00007f6487a7e19e in gst_element_set_state_func (element=0x56254c676340
[GstPipeline], state=GST_STATE_NULL) at gstelement.c:2906
#27 0x000056254b9845ff in on_timeout_stop (pipeline=0x56254c676340
[GstPipeline], 
    pipeline at entry=<error reading variable: value has been optimized out>) at
parsebin.c:77
#28 0x00007f64874bdb73 in g_timeout_dispatch
(source=source at entry=0x56254c66d4c0, callback=<optimized out>,
user_data=<optimized out>) at ../../../../glib/gmain.c:4650
#29 0x00007f64874bd0f5 in g_main_dispatch (context=0x56254c436520) at
../../../../glib/gmain.c:3177
#30 0x00007f64874bd0f5 in g_main_context_dispatch
(context=context at entry=0x56254c436520)
    at ../../../../glib/gmain.c:3830
#31 0x00007f64874bd4c0 in g_main_context_iterate (context=0x56254c436520,
block=block at entry=1, dispatch=disp---Type <return> to continue, or q <return>
to quit---
atch at entry=1, self=<optimized out>) at ../../../../glib/gmain.c:3903
#32 0x00007f64874bd7d2 in g_main_loop_run (loop=0x56254c485350) at
../../../../glib/gmain.c:4099

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