[gst-devel] A hang inside gst_task_join()

Wim Taymans wim.taymans at gmail.com
Sat Jun 5 09:52:57 CEST 2010

On Fri, 2010-06-04 at 19:33 -0700, Loc Nguyen wrote:
> Hi,
> We've found a rare hang that occurs on unreferencing a pipeline.  We set 
> the pipeline to GST_STATE_NULL then unref it.  The hang occurs inside of 
> gst_task_join().  I'm happy to debug and fix it, but I am trying to 
> understand the intent of some code here.  Inside of gst_task_join(), 
> there is the following code:
>   task->state = GST_TASK_STOPPED;
>   /* signal the state change for when it was blocked in PAUSED. */
>   GST_TASK_SIGNAL (task);
>   /* we set the running flag when pushing the task on the thread pool.
>    * This means that the task function might not be called when we try
>    * to join it here. */
>   while (G_LIKELY (task->running))
>     GST_TASK_WAIT (task);
> It so happens the task is already running so the join function waits on 
> the task to finish.  However, the task is running gst_queue_loop() and 
> waiting for queue->item_add cond variable.  There must be some intent on 
> signaling the queue so it can break out of this wait.  I just cannot 
> figure out how gstreamer intended to do this.  Any ideas?  Btw, this 

When the queue is asked to do a state change to READY, it first sets its
state to flushing and then it signals the item_add cond variable (see
gst_queue_src_activate_push(). This makes the task go into paused where
the core does a join on it.

> hang does not always occur.  It's rare, but on my specific machine, it 
> occurs frequent enough for me to trace it down to this.

I have no idea why you would see this.

> Thanks,
> -Loc
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate 
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
> lucky parental unit.  See the prize list and enter to win: 
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

More information about the gstreamer-devel mailing list