Skip to content

Conversation

@emutavchi
Copy link
Collaborator

The deadlock may occur when UI thread tries to clear pipeline in
AppendPipeline::clearPlayerPrivate() while parser thread tries to change
pipeline state to pause holding the stream lock in
AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread()

The deadlock may occur when UI thread tries to clear pipeline in
AppendPipeline::clearPlayerPrivate() while parser thread tries to change
pipeline state to pause holding the stream lock in
AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread()
@emutavchi
Copy link
Collaborator Author

Backtrace of deadlock:

Thread 9 (LWP 18343):
#0  __lll_lock_wait (futex=0x7b5928, private=0) at ../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:45
#1  0x755c4928 in __GI___pthread_mutex_lock (mutex=0x7b5928) at pthread_mutex_lock.c:114
#2  0x7485bc2c in g_rec_mutex_lock (mutex=0x60f500) at /usr/src/debug/glib-2.0/1_2.48.1-r0/glib-2.48.1/glib/gthread-posix.c:386
#3  0x746b04bc in gst_element_set_state_func (element=0x60f4c0, state=GST_STATE_PAUSED) at gstelement.c:2574
#4  0x746af998 in gst_element_set_state (element=0x60f4c0, state=GST_STATE_PAUSED) at gstelement.c:2550
#5  0x76fe3c8c in connectDemuxerSrcPadToAppsinkFromAnyThread ()
    at git/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp:1102
#6  0x73015cb0 in g_cclosure_marshal_VOID__OBJECTv (closure=0x67ac48, return_value=0x0, instance=0x6148d8, args=0x59d9c924, marshal_data=marshal_data@entry=0x0, n_params=n_params@entry=1, 
    param_types=param_types@entry=0x474df0) at /usr/src/debug/glib-2.0/1_2.48.1-r0/glib-2.48.1/gobject/gmarshal.c:2102
#7  0x73011df0 in _g_closure_invoke_va (closure=0x67ac48, return_value=0x0, instance=0x6148d8, args=0x59d9c924, n_params=1, param_types=0x474df0)
    at /usr/src/debug/glib-2.0/1_2.48.1-r0/glib-2.48.1/gobject/gclosure.c:867
#8  0x73036460 in g_signal_emit_valist (instance=0x6148d8, signal_id=<optimized out>, detail=0, var_args=0x59d9c924) at /usr/src/debug/glib-2.0/1_2.48.1-r0/glib-2.48.1/gobject/gsignal.c:3294
#9  0x73036fdc in g_signal_emit (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>) at /usr/src/debug/glib-2.0/1_2.48.1-r0/glib-2.48.1/gobject/gsignal.c:3441
#10 0x746aae60 in gst_element_add_pad (element=0x6148d8, pad=0x61b180) at gstelement.c:713
#11 0x5a186f70 in gst_qtdemux_add_stream (list=0x5c019a30, stream=0x71775600, qtdemux=0x6148d8) at qtdemux.c:7799
#12 qtdemux_expose_streams (qtdemux=0x6148d8) at qtdemux.c:11248
#13 0x5a1a9384 in gst_qtdemux_process_adapter (demux=0x6148d8, force=0) at qtdemux.c:6384
#14 0x5a1aae0c in gst_qtdemux_chain (sinkpad=0x61bd50, parent=0x6148d8, inbuf=0x5872c298) at qtdemux.c:6196
#15 0x746d2a08 in gst_pad_chain_data_unchecked (data=0x5872c298, type=4112, pad=0x61bd50) at gstpad.c:4202
#16 gst_pad_push_data (pad=0x62a6b0, type=4112, data=<optimized out>) at gstpad.c:4454
#17 0x746ddcc8 in gst_pad_push (pad=0x62a6b0, buffer=0x5872c298) at gstpad.c:4573
#18 0x7418a964 in gst_base_src_loop (pad=0x62a6b0) at gstbasesrc.c:2854
#19 0x7471d15c in gst_task_func (task=0x5c032f60) at gsttask.c:334
#20 0x7471eaa8 in default_func (tdata=<optimized out>, pool=<optimized out>) at gsttaskpool.c:68
#21 0x74832c40 in g_thread_pool_thread_proxy (data=<optimized out>) at /usr/src/debug/glib-2.0/1_2.48.1-r0/glib-2.48.1/glib/gthreadpool.c:307
#22 0x74831ad0 in g_thread_proxy (data=0x5c0127b0) at /usr/src/debug/glib-2.0/1_2.48.1-r0/glib-2.48.1/glib/gthread.c:780
---Type <return> to continue, or q <return> to quit---
#23 0x755c0cdc in start_thread (arg=0x59d9d360) at pthread_create.c:314
#24 0x753b7a40 in __thread_start () at ../ports/sysdeps/unix/sysv/linux/mips/clone.S:150


Thread 1 (LWP 652):
#0  __lll_lock_wait (futex=0x6eb0b0, private=0) at ../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:45
#1  0x755c4928 in __GI___pthread_mutex_lock (mutex=0x6eb0b0) at pthread_mutex_lock.c:114
#2  0x7485bc2c in g_rec_mutex_lock (mutex=0x61bd9c) at /usr/src/debug/glib-2.0/1_2.48.1-r0/glib-2.48.1/glib/gthread-posix.c:386
#3  0x746d861c in post_activate (new_mode=GST_PAD_MODE_NONE, pad=0x61bd50) at gstpad.c:1014
#4  activate_mode_internal (pad=0x61bd50, parent=0x6148d8, mode=GST_PAD_MODE_PUSH, active=0) at gstpad.c:1185
#5  0x746d8f38 in gst_pad_set_active (pad=0x61bd50, active=0) at gstpad.c:1079
#6  0x746a8e10 in activate_pads (vpad=0x7fcff648, ret=0x7fcff6a0, active=0x7fcff724) at gstelement.c:2783
#7  0x746c2a40 in gst_iterator_fold (it=0x71757ad8, func=0x746a8dbc <activate_pads>, ret=0x7fcff6a0, user_data=0x7fcff724) at gstiterator.c:616
#8  0x746a999c in iterator_activate_fold_with_resync (iter=0x71757ad8, user_data=0x7fcff724, func=0x746a8dbc <activate_pads>) at gstelement.c:2807
#9  0x746ac724 in gst_element_pads_activate (element=0x6148d8, active=0) at gstelement.c:2851
#10 0x746acbb0 in gst_element_change_state_func (element=0x6148d8, transition=<optimized out>) at gstelement.c:2917
#11 0x5a186b24 in gst_qtdemux_change_state (element=0x6148d8, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at qtdemux.c:2473
#12 0x746afdb0 in gst_element_change_state (element=0x6148d8, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at gstelement.c:2695
#13 0x746b07fc in gst_element_set_state_func (element=0x6148d8, state=<optimized out>) at gstelement.c:2649
#14 0x746af998 in gst_element_set_state (element=0x6148d8, state=GST_STATE_READY) at gstelement.c:2550
#15 0x7467cdc4 in gst_bin_element_set_state (next=GST_STATE_READY, current=GST_STATE_PAUSED, start_time=0, base_time=44774882891273, element=0x6148d8, bin=0x60f4c0) at gstbin.c:2619
#16 gst_bin_change_state_func (element=0x60f4c0, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at gstbin.c:2961
#17 0x746e4950 in gst_pipeline_change_state (element=0x60f4c0, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at gstpipeline.c:499
#18 0x746afdb0 in gst_element_change_state (element=0x60f4c0, transition=GST_STATE_CHANGE_PAUSED_TO_READY) at gstelement.c:2695
#19 0x746b07fc in gst_element_set_state_func (element=0x60f4c0, state=<optimized out>) at gstelement.c:2649
#20 0x746af998 in gst_element_set_state (element=0x60f4c0, state=GST_STATE_NULL) at gstelement.c:2550
#21 0x76fdef58 in clearPlayerPrivate ()
    at git/Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp:331
#22 0x76d8ca28 in removedFromMediaSource ()
    at git/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:193
#23 0x76d9149c in removedFromMediaSource ()
    at git/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:96
#24 0x768ecb14 in removedFromMediaSource ()
    at git/Source/WebCore/Modules/mediasource/SourceBuffer.cpp:416
#25 0x768e8690 in removeSourceBuffer ()
    at git/Source/WebCore/Modules/mediasource/MediaSource.cpp:842
#26 0x768e88a8 in detachFromElement ()
    at git/Source/WebCore/Modules/mediasource/MediaSource.cpp:933
#27 0x7656cd54 in detachMediaSource ()
    at git/Source/WebCore/html/HTMLMediaElement.cpp:3281
#28 0x765d0cf4 in prepareForLoad ()
    at git/Source/WebCore/html/HTMLMediaElement.cpp:1185
#29 0x765d5b44 in load () at git/Source/WebCore/html/HTMLMediaElement.cpp:1145
#30 0x7709b020 in jsHTMLMediaElementPrototypeFunctionLoadCaller () at DerivedSources/WebCore/JSHTMLMediaElement.cpp:1595
#31 callOperation<WebCore::jsHTMLMediaElementPrototypeFunctionLoadCaller, (WebCore::CastedThisErrorBehavior)0> ()
    at git/Source/WebCore/bindings/js/JSDOMBinding.h:362
#32 jsHTMLMediaElementPrototypeFunctionLoad () at DerivedSources/WebCore/JSHTMLMediaElement.cpp:1587
warning: GDB can't find the start of the function at 0x599358ff.
#33 0x59935900 in ?? ()

@eocanha eocanha merged commit 4fe2341 into WebPlatformForEmbedded:master Oct 20, 2017
@eocanha
Copy link
Member

eocanha commented Oct 20, 2017

Thanks a lot for detecting this bug and providing a patch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants