BlinkID / blinkid-android

Everything you need to add AI-driven ID scanning into your native Android app.
https://microblink.com/identity/identity-document-scanning/
445 stars 153 forks source link

Intermittent crash on certain devices #74

Closed kennywfl closed 6 years ago

kennywfl commented 6 years ago

Hi guys,

I have experiences some intermittent crashes on some of my test device, but upon uninstall and reinstall, the crash issue gone, could you tell me what's the possible causes? Below are the crash log that I obtained.

A: Fatal signal 7 (SIGBUS), code 1, fault addr 0x9cc8389b in tid 13712 (Recognition)
A: * * * * * * * * * * * * * * * *
A: Build fingerprint: 'samsung/j5xnltedx/j5xnlte:6.0.1/MMB29M/J510GNDXU2AQI1:user/release-keys'
A: Revision: '4'
A: ABI: 'arm'
A: pid: 12397, tid: 13712, name: Recognition  >>> com.maxis.ereload2 <<<
A: signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 0x9cc8389b
A:     r0 9cc8389b  r1 00024320  r2 9c337578  r3 9c337574
A:     r4 00024320  r5 00000000  r6 00000000  r7 9cc8389b
A:     r8 9c337574  r9 b864d1e8  sl 9c337578  fp 00000001
A:     ip b6ca15dc  sp 9c337530  lr 9c81c833  pc 9c8a4304  cpsr 40070030=
A: backtrace:
A:     #00 pc 0016f304  /data/app/com.maxis.ereload2-1/lib/arm/libBlinkID.so
A:     #01 pc 000e782f  /data/app/com.maxis.ereload2-1/lib/arm/libBlinkID.so
A:     #02 pc 000e7591  /data/app/com.maxis.ereload2-1/lib/arm/libBlinkID.so
A:     #03 pc 000e220b  /data/app/com.maxis.ereload2-1/lib/arm/libBlinkID.so
A:     #04 pc 0009b87f  /data/app/com.maxis.ereload2-1/lib/arm/libBlinkID.so
A:     #05 pc 0011be63  /data/app/com.maxis.ereload2-1/lib/arm/libBlinkID.so
A:     #06 pc 0011b3fb  /data/app/com.maxis.ereload2-1/lib/arm/libBlinkID.so
A:     #07 pc 0005439f  /data/app/com.maxis.ereload2-1/lib/arm/libBlinkID.so (Java_com_microblink_recognition_NativeRecognizerWrapper_recognize+350)
A:     #08 pc 014aadb7  /data/app/com.maxis.ereload2-1/oat/arm/base.odex (offset 0xb1a000) (com.microblink.recognizers.BaseRecognitionResult[] com.microblink.recognition.NativeRecognizerWrapper.recognize(long, long, long)+122)
A:     #09 pc 014a9e05  /data/app/com.maxis.ereload2-1/oat/arm/base.odex (offset 0xb1a000) (void com.microblink.recognition.NativeRecognizerWrapper.llIIlIlIIl(com.microblink.recognition.NativeRecognizerWrapper, com.microblink.secured.llIIllIlII, com.microblink.recognition.callback.RecognitionProcessCallback, com.microblink.recognition.NativeRecognizerWrapper$IlIllIlIIl)+760)
A:     #10 pc 014a8037  /data/app/com.maxis.ereload2-1/oat/arm/base.odex (offset 0xb1a000) (void com.microblink.recognition.NativeRecognizerWrapper$3.run()+1146)
A:     #11 pc 0377c9df  /system/framework/arm/boot.oat (offset 0x2f5e000)

I also notice that only Samsung device will encounter this issue, had tested with Xperia XZs, Nexus 5, and some Xiaomi devices and have no issue so far. Update: now it crashed on device from Vivo also, so it no longer limited to Samsung.

Device that I have tested with crash: Samsung Galaxy C9 Pro (Android ver. 6.0.1) Samsung Galaxy J5 (2016) (Android ver. 6.0.1) Samsung Galaxy Mega 2 (Android ver. 4.4.4) *new Vivo Y55s (Android ver. 6.0.1)

DoDoENT commented 6 years ago

Hi @kennywfl, from which of the mentioned device is the reported stack trace? SIGBUS is very unusual on 64-bit platform and can possibly indicate hardware fault.

DoDoENT commented 6 years ago

Also, please tell us which recognizers were active at the time of the crash?

DoDoENT commented 6 years ago

Also, which exact version of BlinkID SDK was running at the time of crash? Symbolification of the crash with symbols from BlinkID v3.14 (the latest) show invalid stack trace - this can be for two reasons:

kennywfl commented 6 years ago

Hi @DoDoENT

Hi @kennywfl, from which of the mentioned device is the reported stack trace? SIGBUS is very unusual on 64-bit platform and can possibly indicate hardware fault.

The stack trace is obtained from the Samsung Galaxy J5, I encounter this also on the Samsung Galaxy C9 Pro phone. For some reason, my app has excluded 64-bit library from the build currently, will that cause any issue?

Also, please tell us which recognizers were active at the time of the crash?

The current active recognizer is MyKadRecognizerSettings only.

Also, which exact version of BlinkID SDK was running at the time of crash?

The current version of BlinkID SDK that we're running was v3.13.

DoDoENT commented 6 years ago

Hi @kennywfl!

For some reason, my app has excluded 64-bit library from the build currently, will that cause any issue?

I've managed to rebuild the usable stack trace using the 32-bit binary symbols from BlinkID v3.13. Unfortunately, the crash appears to be 32-bit specific (and not so easy fixable) and should not happen while using BlinkID SDK in 64-bit mode - it appears that this device in 32-bit mode requires 64-bit-mode data alignment when accessing data (which is logical, considering it has 64-bit processor) which we do not ensure for 32-bit versions of our SDK (the SDK should work correctly on native 32-bit ARM processors and ensuring 64-bit mode data alignment compatibility in 32-bit mode is easier said than done).

Can you try reproducing the crash by using MyKad scanning with our showcase app? - the app will automatically send crash report to us via crashlytics and we ensured that this app works in 64-bit mode. If my hypothesis is correct, the app should work correctly in 64-bit mode.

Google has announced that until August 2019 all apps on PlayStore will need to have 64-bit support, so if adding 64-bit binary solves your problem, you can kill two birds with one stone. If app size is a problem, we recommend using APK splits - we use that for all our apps that are published on PlayStore.

kennywfl commented 6 years ago

Hi @DoDoENT !

Can you try reproducing the crash by using MyKad scanning with our showcase app? - the app will automatically send crash report to us via crashlytics and we ensured that this app works in 64-bit mode. If my hypothesis is correct, the app should work correctly in 64-bit mode.

I already tried that and it's actually working fine, guess I'll need to work with the 64-bit library to see if it crash again in those devices, I'll update here again if there's any issue. Thanks for the help!