gst_discoverer_new() trouble with pthread

defunked ethan at
Wed Mar 13 17:23:42 UTC 2019

I am having a strange problem with gst_discoverer_new(), and
gst_discoverer_discover_uri() which I suspect has something to do with
pthread interaction.

In short, when I call gst_discoverer_new() from my program on the original
thread, there is no problem with that call.  When I call it in a thread
created after the program is up and running, I get crash. (see GDB
back-trace below, on Ubuntu 18.10)

(gdb) bt
#0  0x00007ffff6741e97 in __GI_raise (sig=sig at entry=6) at
#1  0x00007ffff6743801 in __GI_abort () at abort.c:79
#2  0x00007ffff678c897 in __libc_message (action=action at entry=do_abort,
fmt=fmt at entry=0x7ffff68b9b9a "%s\n")
    at ../sysdeps/posix/libc_fatal.c:181
#3  0x00007ffff679390a in malloc_printerr (str=str at entry=0x7ffff68bb3f0
"malloc_consolidate(): invalid chunk size")
    at malloc.c:5350
#4  0x00007ffff6793bae in malloc_consolidate (av=av at entry=0x7ffff6aeec40
<main_arena>) at malloc.c:4441
#5  0x00007ffff67977d8 in _int_malloc (av=av at entry=0x7ffff6aeec40
<main_arena>, bytes=bytes at entry=2049) at malloc.c:3703
#6  0x00007ffff67988f5 in _int_realloc (av=av at entry=0x7ffff6aeec40
<main_arena>, oldp=oldp at entry=0x5555557d0330, oldsize=oldsize at entry=1040,
nb=nb at entry=2064) at malloc.c:4570
#7  0x00007ffff679bf9b in __GI___libc_realloc (oldmem=0x5555557d0340,
bytes=2048) at malloc.c:3230
#8  0x00007ffff6b45ae0 in g_realloc () at
#9  0x00007ffff6e307ff in g_signal_newv () at
#10 0x00007ffff6e30c9d in g_signal_new_valist () at
#11 0x00007ffff6e30d8e in g_signal_new () at
#12 0x00007ffff0389b8f in  () at
#13 0x00007ffff6e3b419 in g_type_class_ref () at
#14 0x00007ffff6e20ef8 in g_object_new_with_properties () at
#15 0x00007ffff6e21961 in g_object_new () at
#16 0x00007ffff70bd432 in gst_element_factory_create () at
#17 0x00007ffff70bd51e in gst_element_factory_make () at
#18 0x00007ffff73ba2c1 in  () at
#19 0x00007ffff6e3e9c5 in g_type_create_instance () at
#20 0x00007ffff6e1f748 in  () at
#21 0x00007ffff6e215c0 in g_object_new_valist () at
#22 0x00007ffff6e21939 in g_object_new () at
#23 0x00007ffff73badd7 in gst_discoverer_new () at

So I tried to move the gst_discoverer_new call near the start of the
thread's code, and the crash goes away if it is called prior
 to a call to pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);  If it
move the gst_discoverer_new() call just 
after the ptherad call, I get a crash again, similar back-trace.

As a side note, gst_discoverer_discover_uri() call fails in a thread, same
sort of back-trace, even when the 
gst_discoverer_new call succeeds when called in the main thread and when the
discoverer object is protected my a 
pthread mutex. Note that I am NOT using the glib main-loop at all in my
program, and it has a lot of threads running, unrelated to gstreamer. 

Is there something I am missing with respect to pthread use with the
discoverer object?

Ethan Funk

Sent from:

More information about the gstreamer-devel mailing list