Crashes on gst_bus_add_watch

Duzy Chan geek at duzy.info
Fri Jan 25 03:09:45 PST 2013


The worker in this case is wrapping a pipeline and watching the bus of the
pipeline. And the crash was happened while creating the worker and
preparing for further usage.

While repeatedly creating many workers and each worker may exist only for a
short time (maybe less than 1 second), and then be stopped
(gst_element_set_state to null state), and then unref (including the
pipeline). After repeat for a while, the problem occurs.


On Fri, Jan 25, 2013 at 5:44 PM, Duzy Chan <geek at duzy.info> wrote:

> Greeting, all
>
> I'm currently working on a app. But I'm now confronting a crash
> while repeatedly creating a pipeline very quickly. And I found that it was
> caused by a gst_bus_add_watch (http://pastebin.com/b2DVmHnQ). The code in
> *gst_bus_add_watch_full_unlocked* was trying to creating a new GSource by
> calling *gst_bus_create_watch*, yet it turned out a NULL source. This is
> the final end point of the cause. And the code in *gstbus.c* looks like
> this:
>
> static guint
> *gst_bus_add_watch_full_unlocked* (GstBus * bus, gint priority,
>     GstBusFunc func, gpointer user_data, GDestroyNotify notify)
> {
>   GMainContext *ctx;
>   guint id;
>   GSource *source;
>
>   if (bus->priv->watch_id) {
>     GST_ERROR_OBJECT (bus,
>         "Tried to add new watch while one was already there");
>     return 0;
>   }
>
>   *source* = *gst_bus_create_watch* (bus);
>
>   if (priority != G_PRIORITY_DEFAULT)
>     g_source_set_priority (*source*, priority);
>
>   g_source_set_callback (*source*, (GSourceFunc) func, user_data, notify);
>
>   ctx = g_main_context_get_thread_default ();
>   id = g_source_attach (source, ctx);
>   g_source_unref (source);
>
>   if (id) {
>     bus->priv->watch_id = source;
>   }
>
>   GST_DEBUG_OBJECT (bus, "New source %p with id %u", source, id);
>   return id;
> }
>
>
> And the client code from my app looks like this:
>
>   worker->pipeline = workerclass->create_pipeline (worker);
>   if (!worker->pipeline)
>     goto error_create_pipeline;
>
>   gst_pipeline_set_auto_flush_bus (GST_PIPELINE (worker->pipeline), FALSE);
>
>   worker->bus = gst_pipeline_get_bus (GST_PIPELINE (worker->pipeline));
>   worker->watch = *gst_bus_add_watch* (worker->bus, gst_worker_message,
> worker);
>
>
> Part of the stack when it crashed is like this:
>
> #0  0x00007ffff728ef56 in *g_source_attach* () from
> /lib/x86_64-linux-gnu/libglib-2.0.so.0
> #1  0x00007ffff7b1e228 in *gst_bus_add_watch_full_unlocked*(notify=<optimized out>, user_data=0x7fffc801a0c0, func=0x403d50
> <gst_worker_message>, priority=<optimized out>, bus=<optimized out>) at
> gstbus.c:867
> #2  gst_bus_add_watch_full_unlocked (bus=<optimized out>,
> priority=<optimized out>, func=0x403d50 <gst_worker_message>,
> user_data=0x7fffc801a0c0, notify=<optimized out>) at gstbus.c:846
> #3  0x00007ffff7b1e367 in gst_bus_add_watch_full (bus=0x991c10,
> priority=priority at entry=0, func=func at entry=0x403d50 <gst_worker_message>,
> user_data=user_data at entry=0x7fffc801a0c0, notify=notify at entry=0x0) at
> gstbus.c:916
> #4  0x00007ffff7b1e390 in *gst_bus_add_watch* (bus=<optimized out>,
> func=func at entry=0x403d50 <gst_worker_message>, user_data=user_data at entry=0x7fffc801a0c0)
> at gstbus.c:948
> #5  0x00000000004041b1 in gst_worker_prepare (worker=0x7fffc801a0c0) at
> gstworker.c:480
>
>
> Do you have any ideas about this? I've been tracking on it for long time,
> still have no lucks.
>
> Regards
> Duzy Chan
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130125/415ff5d9/attachment.html>


More information about the gstreamer-devel mailing list