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 752623 - concat: Test pipeline with uridecodebin and concat freezes sometimes when setting pipeline to state NULL
concat: Test pipeline with uridecodebin and concat freezes sometimes when set...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other All
: Normal normal
: 1.5.90
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks: 752651
 
 
Reported: 2015-07-20 10:14 UTC by Carlos Rafael Giani
Modified: 2015-08-16 13:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test program showing the freeze (3.28 KB, text/x-csrc)
2015-07-20 10:14 UTC, Carlos Rafael Giani
Details

Description Carlos Rafael Giani 2015-07-20 10:14:43 UTC
Created attachment 307744 [details]
Test program showing the freeze

I stumbled upon a curious problem the other day. I set up a pipeline with a concat element, a sink (can be a fakesink, but sync is set to TRUE), two uridecodebins, two identity elements. The link order goes like this:

uridecodebin1 *-> identity1 -> concat  uridecodebin2 *-> identity2 -> concat  concat -> sink

The uridecodebin-identity connections are marked with a * , since these are not linked immediately. Instead, they are linked in the decodebin's pad-added callback. Only audio is linked.

This is a simple pipeline. Once uridecodebin1 is done playing, uridecodebin2 would take over. Works fine.

However, if I set the pipeline state to NULL immediately after having set it to PLAYING, it sometimes hangs in the gst_element_set_state(pipeline, GST_STATE_NULL); call. It might take quite a while for this deadlock to appear, but it eventually does. A quick check with gdb shows this:


  • #1 _L_lock_953
    from /lib/x86_64-linux-gnu/libpthread.so.0
  • #2 __GI___pthread_mutex_lock
    at ../nptl/pthread_mutex_lock.c line 114
  • #3 post_activate
    at gstpad.c line 999
  • #4 gst_pad_activate_mode
    at gstpad.c line 1187
  • #5 gst_ghost_pad_activate_push_default
    at gstghostpad.c line 379
  • #6 gst_ghost_pad_activate_mode_default
    at gstghostpad.c line 442
  • #7 gst_pad_activate_mode
    at gstpad.c line 1180
  • #8 gst_pad_set_active
    at gstpad.c line 1064
  • #9 activate_pads
    at gstbin.c line 2368
  • #10 gst_iterator_fold
    at gstiterator.c line 614
  • #11 iterator_activate_fold_with_resync
    at gstbin.c line 2387
  • #12 gst_bin_src_pads_activate
    at gstbin.c line 2421
  • #13 gst_bin_change_state_func
    at gstbin.c line 2611
  • #14 gst_decode_bin_change_state
    at gstdecodebin2.c line 4953
  • #15 gst_element_change_state
    at gstelement.c line 2604
  • #16 gst_element_set_state_func
    at gstelement.c line 2560
  • #17 gst_element_set_state
    at gstelement.c line 2461
  • #18 gst_bin_element_set_state
    at gstbin.c line 2328
  • #19 gst_bin_change_state_func
    at gstbin.c line 2676
  • #20 gst_uri_decode_bin_change_state
    at gsturidecodebin.c line 2752
  • #21 gst_element_change_state
    at gstelement.c line 2604
  • #22 gst_element_set_state_func
    at gstelement.c line 2560
  • #23 gst_element_set_state
    at gstelement.c line 2461
  • #24 gst_bin_element_set_state
    at gstbin.c line 2328
  • #25 gst_bin_change_state_func
    at gstbin.c line 2676
  • #26 gst_pipeline_change_state
    at gstpipeline.c line 499
  • #27 gst_element_change_state
    at gstelement.c line 2604
  • #28 gst_element_set_state_func
    at gstelement.c line 2560
  • #29 gst_element_set_state
    at gstelement.c line 2461


I am using the most recent git master (I checked the repositories out yesterday). I also managed to replicate the problem with a small test case, which I attached. It requires one argument, a URI to an audio file. (It has to be an URI, so use file:// ). Most of the time, the deadlock occurs within 30 seconds. I was most successful at replicating it by playing Ogg Vorbis files.

Now, perhaps I am using the uridecodebins incorrectly. I noticed in the playbin code that when shutting down, the playbin is applying all sorts of state locks to the uridecodebin elements and flags to early-exit pad-added callbacks, so maybe I need some of that logic here too.

Also, in uridecodebin, I set async-handling to TRUE, since I need that in my main application to avoid PAUSED states "leaking" into the main pipeline and disrupting gapless playback. I noticed that playbin does that differently; it checks for ASYNC_START and ASYNC_DONE messages, and if these came from uridecodebins, the messages are discarded. Not sure if this is the better approach, or if async-handling=TRUE is at least partially responsible for the problems. I tried running it with async-handling=FALSE, and it didn't change much - the deadlocks still happened.
Comment 1 Thiago Sousa Santos 2015-07-21 03:27:30 UTC
commit 0accb7f700a737646fe3460442cfcfec377ece14
Author: Thiago Santos <thiagoss@osg.samsung.com>
Date:   Tue Jul 21 00:17:28 2015 -0300

    concat: dot not reset pad states too early
    
    Resetting the flushing state of the pads at the end of the
    PAUSED_TO_READY transition will make pads handle serialized
    queries again which will wait for non-active pads and might
    cause deadlocks when stopping the pipeline.
    
    Move the reset to the READY_TO_PAUSED instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=752623