BlinkID / blinkid-android

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

Background ANR at jdk.internal.misc.Unsafe.park #303

Closed vertin closed 3 months ago

vertin commented 9 months ago

Description

We have received several reports regarding a Background ANR issue when the host scanner activity goes to onPause state.

Environment Details

BlinkID version: 6.2.0 - 6.2.2

Device model: Samsung SM-G991B, SM-N980F, SM-S901B Xiaomi M2103K19G

Device Android version: Android 11 - Android -13

Device ABI (processor architecture, e.g. ARMv7): arm64-v8a, armeabi-v7a, armeabi

Log file

microblink_anr.txt

Also in the report we have a potential cause, a stacktrace from a blocked thread named Camera2Control: at android.os.MessageQueue.next(MessageQueue.java:351) at android.os.Looper.loopOnce(Looper.java:186) at android.os.Looper.loop(Looper.java:351) at com.microblink.blinkid.secured.p3.run(unavailable:36)

Brankacro commented 9 months ago

Hello @vertin! Could you please provide a detailed step-by-step guide on how to reproduce the mentioned behaviour? If it is possible, it would be of great help to share a minimal code sample of the behavior so we can run it on our end.In case of any additional questions, feel free to ask. Best regards.

vertin commented 9 months ago

@Brankacro thank you for the response. Here is a sample implementation of our scanner activity Sample.txt

Unfortunately, our team has only crash reports collected from customers' devices, and we could not find a way to reproduce the issue

Brankacro commented 9 months ago

Thank you @vertin for providing the data. Can you please let us know where exactly are you setting the license key? Did you follow the steps described here and set the license key before using any other classes from the SDK? Please make sure that the license key is always set before using any method from our SDK, because .onCreate() is always called on application startup.

Also, wanted to ask you if you could set the setIntentDataTransferMode method to PERSISTED_OPTIMISED as shown here, and let us know how it goes. More info about passing Recognizer objects between activities can be found on the following link. In case of any additional questions, feel free to reach out. Best regards.

vertin commented 9 months ago

@Brankacro Have these two lines MicroblinkSDK.setLicenseKey(<microblink_key>, applicationContext) MicroblinkSDK.setIntentDataTransferMode(IntentDataTransferMode.PERSISTED_OPTIMISED)

right before super.onCreate() line in our ScannerActivity class, but unfortunately still struggling with the ANR from time to time

krizaa commented 5 months ago

Hi @vertin, do you have any additional info about the ANR that could help us reproduce it? Also, how are you implementing BlinkID in your app (integration level: https://github.com/BlinkID/blinkid-android?tab=readme-ov-file#-blinkid-sdk-integration-levels)?

arunprasath218 commented 4 months ago

I am also having this issue.. I code is based on the Custom UX sample and it follows all the recommended coding structure. Any Update regarding this ANR please. This also only affect our customer devices and only a few devices having this issue. Not All

krizaa commented 4 months ago

Thanks for reaching out @arunprasath218. We managed to reproduce the issue and the fix will be released in the next version of BlinkID.

krizaa commented 3 months ago

Will be closing this issue, if the ANR persists in the new version of BlinkID 6.6, feel free to reopen the issue.

arunprasath218 commented 3 months ago

Hi @krizaa but BlinkID 6.6 is not yet released?

krizaa commented 3 months ago

Sorry @arunprasath218 for my wording. It will be fixed in v6.6 which will come out this week!