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 773281 - On Android 4.4.4 (api 19) gstreamer crashes when loaded.
On Android 4.4.4 (api 19) gstreamer crashes when loaded.
Status: RESOLVED INCOMPLETE
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
1.8.3
Other Windows
: Normal critical
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-10-20 15:30 UTC by EduardS
Modified: 2018-01-20 11:33 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description EduardS 2016-10-20 15:30:26 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?
Comment 1 Sebastian Dröge (slomo) 2016-10-20 16:05:58 UTC
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?
Comment 2 Sebastian Dröge (slomo) 2016-10-20 16:13:16 UTC
Especially it should never crash with a division by zero (which this probably is), inside the dynamic library loader code :)
Comment 3 EduardS 2016-10-30 15:14:06 UTC
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.
Comment 4 Sebastian Dröge (slomo) 2016-10-30 18:38:21 UTC
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().
Comment 5 EduardS 2016-11-28 13:08:35 UTC
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
Comment 6 Tim-Philipp Müller 2018-01-20 11:33:55 UTC
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!