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 739312 - gst_init segmentation fault
gst_init segmentation fault
Status: RESOLVED INCOMPLETE
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
1.4.3
Other Linux
: Normal normal
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-10-28 18:22 UTC by carl
Modified: 2016-03-16 17:45 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description carl 2014-10-28 18:22:09 UTC
gst_init is generating a segmentation fault when I attempt to incorporate gstreamer into a much larger application.

It works fine if gst_init is used in a much smaller application.

With GST_DEBUG=9 I get the following GST messages:

0:00:00.007413074  1381  0x2422600 INFO                GST_INIT gst.c:499:init_pre: (null)
0:00:00.014728296  1381  0x2422600 INFO                GST_INIT gst.c:500:init_p
re: (null)
0:00:00.015514185 @0 1381  0x2422600 INFO                GST_INIT gst.c:511:init_pre: (null)
0:00:00.031426148  1381  0x2422600 DEBUG             GST_MEMORY gstallocator.c:5
85:_priv_gst_allocator_initialize: (null)
Aborted

As you can see instead of the normal debug messages after the routine name you see (null).

It looks to me as if the memory associated with gstreamer has been corrupted in some manner so that even debug messages cannot display correctly.

Has anybody seen something like this before?  I'm stumped right now.
Comment 1 Tim-Philipp Müller 2014-10-28 18:35:09 UTC
Have you tried running it in valgrind?

Is it possible you might be calling gst_init() from multiple threads? (at the same time roughly)
Comment 2 carl 2014-10-28 19:05:52 UTC
I'm running this on an Arm 7 based system which doesn't have valgrind ported to it, so no I haven't tried running it in valgrind.  I'll have to look into that.

For testing purposes I'm calling gst_init at the very beginning of my program before anything else is done.  So I'm not calling gst_init from multiple threads.
Comment 3 Tim-Philipp Müller 2014-10-28 19:10:29 UTC
Ok. Which libc library are you using? (I'm just guessing at this point)
Comment 4 carl 2014-10-28 19:55:58 UTC
Looks like it's glibc 2.8.  Does that make sense?  It's a little hard to determine. That's pretty old since the latest glibc is 2.20.  It came with the development environment.
Comment 5 Tim-Philipp Müller 2014-10-29 16:37:16 UTC
That should be fine, just checking it's not dietlibc or somesuch.

I don't know, I suppose you'll have to debug it then :)

Do you have a stack trace with debugging symbols for the crash?
Comment 6 carl 2014-10-30 15:51:05 UTC
Unfortunately, I'm debugging an embedded system and gdb will not support debugging shared libraries so the instant my code enters gst_init my stack becomes invalid to the debugger.  That means I can't get a valid stack trace when it crashes.  gdb is reporting:

warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.

I'm looking around trying to find a solution to this so then I might be able to further debug my actual problem.
Comment 7 Tim-Philipp Müller 2014-10-31 17:00:40 UTC
Could you check if any code is calling g_mem_set_vtable(), in which case you might be running into bug #701694.
Comment 8 Tim-Philipp Müller 2015-04-01 16:12:52 UTC
Closing this bug report as no further information has been provided. Please feel free to reopen this bug report if you can provide the information that was asked for in a previous comment.
Thanks!
Comment 9 GstBlub 2016-03-16 17:18:44 UTC
I just ran into this bug with 1.6.3 on an x86 based box with glibc 2.19 and glib2 2.40.0:

Program received signal SIGSEGV, Segmentation fault.
0xb7697cf0 in g_datalist_id_dup_data (datalist=datalist@entry=0x8295438, key_id=key_id@entry=233, dup_func=dup_func@entry=0x0, user_data=user_data@entry=0x0) at gdataset.c:864
864	gdataset.c: No such file or directory.
(gdb) bt
  • #0 g_datalist_id_dup_data
    at gdataset.c line 864
  • #1 g_datalist_id_get_data
    at gdataset.c line 798
  • #2 g_object_new_internal
    at gobject.c line 1731
  • #3 g_object_newv
    at gobject.c line 1868
  • #4 g_object_new
    at gobject.c line 1568
  • #5 _priv_gst_allocator_initialize
    at gstallocator.c line 587
  • #6 init_post
    at gst.c line 580
  • #7 g_option_context_parse
    at goption.c line 2085
  • #8 gst_init_check
    at gst.c line 352
  • #9 gst_init
    at gst.c line 398

A breakpoint on g_mem_set_vtable() did not hit prior to this crash.  I run into it 100% of the time when I use glibc's __malloc_hook/__free_hook/__realloc_hook to track memory allocations.  Running it with valgrind (without using using these hooks) has not yielded any complaints.
Comment 10 GstBlub 2016-03-16 17:45:29 UTC
Turns out my malloc hook did not guarantee 8 byte aligned pointers, which ended up causing this crash because the code in gdataset depends on this (using the lower bits of pointers for flags).