GNOME Bugzilla – Bug 773281
On Android 4.4.4 (api 19) gstreamer crashes when loaded.
Last modified: 2018-01-20 11:33:55 UTC
Hi All, We get a crash on android emulator x86 Running API 9 (4.4.4): 10-20 11:15:00.804 1130-1130/? I/DEBUG: signal 8 (SIGFPE), code -6 (SI_TKILL), fault addr 000040fd From inspection of the stack trace: 10-20 11:15:00.984 1130-1130/? I/DEBUG: eax 07bdb59d ebx b7784fe4 ecx 0000005f edx 00000000 10-20 11:15:00.984 1130-1130/? I/DEBUG: esi 00000000 edi b7761004 10-20 11:15:00.984 1130-1130/? I/DEBUG: xcs 00000073 xds 0000007b xes 0000007b xfs 00000000 xss 0000007b 10-20 11:15:00.984 1130-1130/? I/DEBUG: eip b776bac8 ebp b6488d54 esp bf990240 flags 00010246 10-20 11:15:00.984 1130-1130/? I/DEBUG: backtrace: 10-20 11:15:00.984 1130-1130/? I/DEBUG: #00 pc 00006ac8 /system/bin/linker (__dl__Z19dlsym_linear_lookupPKcPP6soinfoS2_+216) 10-20 11:15:00.984 1130-1130/? I/DEBUG: #01 pc 00001265 /system/bin/linker (__dl_dlsym+325) 10-20 11:15:00.984 1130-1130/? I/DEBUG: #02 pc 005ad4b2 /data/app-lib/com.reporty.reporty-2/libgstreamer_android.so (g_module_symbol+149) 10-20 11:15:00.984 1130-1130/? I/DEBUG: #03 pc 000a32ea /data/app-lib/com.reporty.reporty-2/libgstreamer_android.so (JNI_OnLoad+330) 10-20 11:15:00.984 1130-1130/? I/DEBUG: #04 pc 0008baff /system/lib/libdvm.so (dvmLoadNativeCode(char const*, Object*, char**)+1295) 10-20 11:15:00.984 1130-1130/? I/DEBUG: #05 pc 000ce63b /system/lib/libdvm.so (Dalvik_java_lang_Runtime_nativeLoad(unsigned int const*, JValue*)+139) 10-20 11:15:00.984 1130-1130/? I/DEBUG: #06 pc 00176a78 /system/lib/libdvm.so 10-20 11:15:00.984 1130-1130/? I/DEBUG: #07 pc 00005bdf <unknown> The problem is in file: gstreamer-android\1-8-3\gstreamer-1.0-android-x86\share\gst-android\ndk-build\gstreamer_android-1.0.c.in In function jint JNI_OnLoad (JavaVM * vm, void * reserved) Disabling the line: if (g_module_symbol (module, "gst_amc_jni_set_java_vm", Solves the problem, this is a workaround. Is there some better solution?
This looks like a bug in the dynamic library loader. It crashes when trying to load a symbol, which it obviously never should. The best would be to report this to Google with a simple testcase that ideally does not involve GStreamer. I assume the same crash also happens when looking for any other symbol there?
Especially it should never crash with a division by zero (which this probably is), inside the dynamic library loader code :)
Hi Sebastian, As far as I know 'g_module_symbol' is Glib function, isn't it? Disabling the code: if (g_module_symbol (module, "gst_amc_jni_set_java_vm", (gpointer *) & set_java_vm) && set_java_vm) { set_java_vm (vm); }*/ In gstreamer-android\1-8-3\gstreamer-1.0-android-arm\share\gst-android\ndk-build\gstreamer-android-1.c.in Solves the problem. All this code is inside the gstreamer_android.so, so it seems like not a Android load problem.
If you look at the backtrace, it goes from GLib to libc / /system/bin/linker. And there it crashes in dlsym(), which calls dlsym_linear_lookup().
Hi Sebastian, I have made a demo (helloJNI) project without using glib. Basically I took those Gstreamer lines: module = g_module_open (NULL, G_MODULE_BIND_LOCAL); if (module) { /*void (*set_java_vm) (JavaVM *) = NULL; if (g_module_symbol (module, "gst_amc_jni_set_java_vm", (gpointer *) & set_java_vm) && set_java_vm) { set_java_vm (vm); and converted it to android native code: void *handle = dlopen(NULL, 2); void *sym = dlsym(handle, "gst_amc_jni_set_java_vm"); Unfortunately there is no crash in this simple project. Is there something else which can influence the dlsym? Regards, Eduard
Not sure what to do about this, it seems unlikely that the actual problem is in GStreamer, doesn't it? And since no one else seems to have run into this you seem to be the only person who can debug this :) I'm closing this for now since there isn't much we can do about this without more information. Or maybe it's already been fixed in the meantime? There have been a fixes in GLib/GModule since, maybe they help? e.g. bug #776876 and bug #788270. Please re-open if you have a fix or more information as to what the problem is, thanks!