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 787878 - adaptivedemux: Deadlock between Stream Pad and Manifest lock
adaptivedemux: Deadlock between Stream Pad and Manifest lock
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.12.2
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-09-19 09:19 UTC by davecraig
Modified: 2018-11-03 14:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (3.24 KB, patch)
2017-09-20 11:24 UTC, davecraig
none Details | Review
Proposed patch (2.89 KB, patch)
2017-09-20 14:29 UTC, davecraig
none Details | Review

Description davecraig 2017-09-19 09:19:16 UTC
This deadlock happens fairly regularly whilst trying to play a variant HLS with multiple audio renditions (http://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8 in my case). 

One of the gst_adaptive_demux_stream_download_loop threads calls gst_pad_set_active with the manifest lock taken and that blocks waiting for GST_PAD_STREAM_LOCK. The other implicated thread has called into _src_chain of adaptivedemux with the Pad Stream lock taken and is waiting for the manifest lock. Deadlock ensues.

Thread 26 (LWP 1536)

  • #0 __libc_do_syscall
    at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S line 46
  • #1 __lll_lock_wait
    at lowlevellock.c line 46
  • #2 __GI___pthread_mutex_lock
    at pthread_mutex_lock.c line 115
  • #3 post_activate
    at ../../clone/gst/gstpad.c line 1015
  • #4 activate_mode_internal
    at ../../clone/gst/gstpad.c line 1186
  • #5 gst_pad_set_active
    at ../../clone/gst/gstpad.c line 1080
  • #6 gst_adaptive_demux_stream_download_uri
    at ../../../../clone/gst-libs/gst/adaptivedemux/gstadaptivedemux.c line 3164
  • #7 gst_adaptive_demux_stream_download_fragment
    at ../../../../clone/gst-libs/gst/adaptivedemux/gstadaptivedemux.c line 3320
  • #8 gst_adaptive_demux_stream_download_loop
    at ../../../../clone/gst-libs/gst/adaptivedemux/gstadaptivedemux.c line 3634
  • #9 gst_task_func
    at ../../clone/gst/gsttask.c line 335
  • #10 g_thread_pool_thread_proxy
    at ../../glib-2.50.2/glib/gthreadpool.c line 307
  • #11 g_thread_proxy
    at ../../glib-2.50.2/glib/gthread.c line 784
  • #12 start_thread
    at pthread_create.c line 335
  • #13 ??
    at ../sysdeps/unix/sysv/linux/arm/clone.S line 86

Thread 22 (LWP 1532)

  • #0 __libc_do_syscall
    at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S line 46
  • #1 __lll_lock_wait
    at lowlevellock.c line 43
  • #2 __GI___pthread_mutex_lock
    at pthread_mutex_lock.c line 115
  • #3 _src_chain
    at ../../../../clone/gst-libs/gst/adaptivedemux/gstadaptivedemux.c line 2460
  • #4 gst_pad_chain_data_unchecked
    at ../../clone/gst/gstpad.c line 4205
  • #5 gst_pad_push_data
    at ../../clone/gst/gstpad.c line 4464
  • #6 gst_pad_push
    at ../../clone/gst/gstpad.c line 4583
  • #7 gst_proxy_pad_chain_default
    at ../../clone/gst/gstghostpad.c line 127
  • #8 gst_pad_chain_data_unchecked
    at ../../clone/gst/gstpad.c line 4205
  • #9 gst_pad_push_data
    at ../../clone/gst/gstpad.c line 4464
  • #10 gst_pad_push
    at ../../clone/gst/gstpad.c line 4583
  • #11 gst_queue_push_one
    at ../../../clone/plugins/elements/gstqueue.c line 1365
  • #12 gst_queue_loop
    at ../../../clone/plugins/elements/gstqueue.c line 1517
  • #13 gst_task_func
    at ../../clone/gst/gsttask.c line 335
  • #14 g_thread_pool_thread_proxy
    at ../../glib-2.50.2/glib/gthreadpool.c line 307
  • #15 g_thread_proxy
    at ../../glib-2.50.2/glib/gthread.c line 784
  • #16 start_thread
    at pthread_create.c line 335
  • #17 ??
    at ../sysdeps/unix/sysv/linux/arm/clone.S line 86

Looking through adaptivedemux.c there are numerous places where gst_pad_set_active is called with the Manifest lock held, though in gst_adaptive_demux_expose_streams it appears to be deliberately dropped. However, gst_adaptive_demux_reset which has near identical code doesn't drop the Manifest lock. 
I'll work on a patch.
Comment 1 davecraig 2017-09-20 11:24:38 UTC
Created attachment 360123 [details] [review]
Proposed patch

As well as moving gst_pad_set_active calls outside of manifest locks there were a couple of missing manifest lock calls that caused other deadlocks.
Comment 2 davecraig 2017-09-20 14:29:42 UTC
Created attachment 360134 [details] [review]
Proposed patch
Comment 3 GStreamer system administrator 2018-11-03 14:13:35 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/611.