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 316809 - bug in gstinfo.c -> _gst_debug_register_funcptr
bug in gstinfo.c -> _gst_debug_register_funcptr
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.8.7
Other Linux
: Normal normal
: 0.8.12
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2005-09-20 20:15 UTC by Francis Labonte
Modified: 2005-09-21 21:39 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Francis Labonte 2005-09-20 20:15:32 UTC
I'me running 4 gst-launch at the same time in a loop, with all the same pipeline
having 2 spiders in 2 thread (1 spider / thread).  

somthing like:
gst-launch {src ! spider ... ! queue} mux {src ! spider .. ! queue } mux

I found that sometimes, my process is stuck somewhere and take 100% of it's
current CPU. 

I think this is cause by the fact that we should have a mutex to serialize the
_gst_debug_register_funcptr.  If I add a new mutex that lock/unlock at the
begin/end of this function, it fix the problem.

Does it make sens?

Francis


_______________
This addition fix the problem
_______________
...
GHashTable *__gst_function_pointers = NULL;
+static GStaticMutex __dbg_functions = G_STATIC_MUTEX_INIT;
...
..

void *
_gst_debug_register_funcptr (void *ptr, gchar * ptrname)
{
                                                                               
                                  
+  g_static_mutex_lock(&__dbg_functions);
                                                                               
                                  
  if (!__gst_function_pointers)
    __gst_function_pointers = g_hash_table_new (g_direct_hash, g_direct_equal);
  if (!g_hash_table_lookup (__gst_function_pointers, ptr))
    g_hash_table_insert (__gst_function_pointers, ptr, ptrname);
                                                                               
                                  
+  g_static_mutex_unlock(&__dbg_functions);
                                                                               
                                  
  return ptr;
}



_______________________________________________________
backtrace if I attach gdb when gst-launch run at 100%
______________________________________________________

  • #0 g_direct_equal
    at gutils.c line 1039
  • #1 g_hash_table_lookup
    at ghash.c line 201
  • #2 _gst_debug_register_funcptr
    at gstinfo.c line 1074
  • #3 gst_ffmpegdec_init
    at gstffmpegdec.c line 269
  • #4 g_type_create_instance
    at gtype.c line 1441
  • #5 g_object_constructor
    at gobject.c line 860
  • #6 gst_object_constructor
    at gstobject.c line 197
  • #7 g_object_newv
    at gobject.c line 758
  • #8 g_object_new_valist
    at gobject.c line 797
  • #9 g_object_new
    at gobject.c line 651
  • #10 gst_element_factory_create
    at gstelementfactory.c line 315
  • #11 gst_spider_create_and_plug
    at gstspider.c line 576
  • #12 gst_spider_plug_from_srcpad
    at gstspider.c line 736
  • #13 gst_spider_plug
    at gstspider.c line 665
  • #14 gst_spider_identity_plug
    at gstspider.c line 513
  • #15 gst_spider_identity_change_state
    at gstspideridentity.c line 400

Comment 1 Tim-Philipp Müller 2005-09-21 21:39:13 UTC
Thanks, committed to HEAD and 0.8 branch.

2005-09-21  Francis Labonte  <francis_labonte at hotmail dot com>

        Reviewed by: Tim-Philipp Muller  <tim at centricular dot net>

        * gst/gstinfo.c: (_gst_debug_nameof_funcptr),
        (_gst_debug_register_funcptr):
          Add mutex to serialise access to the hash table with
          the function pointer => function name string mapping;
          make that hash table static scope (#316809).

Cheers
 -Tim