Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Fatal Exception: java.lang.IllegalArgumentException: ... does not encode a valid TensorFlow Lite model: Could not open .... The model allocation is null/empty #7347

Closed
jamesbluecrow opened this issue Sep 25, 2023 · 8 comments
Assignees

Comments

@jamesbluecrow
Copy link

jamesbluecrow commented Sep 25, 2023

Summary

We are seeing some our app crashing sometimes (not many) with the exception below.

Fatal Exception: java.lang.IllegalArgumentException: Contents of /data/user/0/com.package/cache/a8bcf0129dcd29084f6797ede7e0be86f9e11ed5.tflite does not encode a valid TensorFlow Lite model: Could not open '/data/user/0/com.package/cache/a8bcf0129dcd29084f6797ede7e0be86f9e11ed5.tflite'.
The model allocation is null/empty
       at org.tensorflow.lite.NativeInterpreterWrapper.createModel(NativeInterpreterWrapper.java)
       at org.tensorflow.lite.NativeInterpreterWrapper.<init>(NativeInterpreterWrapper.java:57)
       at org.tensorflow.lite.Interpreter.<init>(Interpreter.java:197)
       at com.stripe.android.mlcore.impl.InterpreterWrapperImpl.<init>(InterpreterWrapperImpl.kt:11)
       at com.stripe.android.identity.ml.FaceDetectorAnalyzer.<init>(FaceDetectorAnalyzer.kt:29)
       at com.stripe.android.identity.ml.FaceDetectorAnalyzer$Factory.newInstance(FaceDetectorAnalyzer.kt:98)
       at com.stripe.android.camera.framework.AnalyzerPool$Companion.of(Analyzer.kt:45)
       at com.stripe.android.camera.framework.AnalyzerPool$Companion.of$default(AnalyzerPool.java:39)
       at com.stripe.android.identity.camera.IdentityScanFlow$startFlow$1.invokeSuspend(IdentityScanFlow.kt:95)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:367)
       at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:30)
       at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default(Cancellable.kt:25)
       at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.java:110)
       at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
       at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(BuildersKt__Builders_common.kt:56)
       at kotlinx.coroutines.BuildersKt.launch(Builders.kt:1)
       at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(BuildersKt__Builders_common.kt:47)
       at kotlinx.coroutines.BuildersKt.launch$default(Builders.kt:1)
       at com.stripe.android.identity.camera.IdentityScanFlow.startFlow(IdentityScanFlow.kt:82)
       at com.stripe.android.identity.viewmodel.IdentityScanViewModel.startScan(IdentityScanViewModel.java:48)
       at com.stripe.android.identity.utils.CameraUtilsKt.startScanning(CameraUtils.kt:16)
       at com.stripe.android.identity.ui.SelfieScreenKt$SelfieScanScreen$2$3.invoke(SelfieScreen.kt:202)
       at com.stripe.android.identity.ui.SelfieScreenKt$SelfieScanScreen$2$3.invoke(SelfieScreen.kt:195)
       at com.stripe.android.identity.ui.CameraScreenLaunchedEffectKt$CameraScreenLaunchedEffect$1$1.invoke(CameraScreenLaunchedEffect.kt:57)
       at com.stripe.android.identity.ui.CameraScreenLaunchedEffectKt$CameraScreenLaunchedEffect$1$1.invoke(CameraScreenLaunchedEffect.kt:47)
       at com.stripe.android.identity.ui.CameraScreenLaunchedEffectKt$sam$androidx_lifecycle_Observer$0.onChanged(CameraScreenLaunchedEffect.kt:13)
       at androidx.lifecycle.LiveData.considerNotify(LiveData.java:133)
       at androidx.lifecycle.LiveData.dispatchingValue(LiveData.java:146)
       at androidx.lifecycle.LiveData$ObserverWrapper.activeStateChanged(LiveData.java:483)
       at androidx.lifecycle.LiveData$LifecycleBoundObserver.onStateChanged(LiveData.java:440)
       at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.kt:314)
       at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.kt:192)
       at androidx.lifecycle.LiveData.observe(LiveData.java:205)
       at com.stripe.android.identity.ui.CameraScreenLaunchedEffectKt$CameraScreenLaunchedEffect$1.invokeSuspend(CameraScreenLaunchedEffect.kt:47)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at androidx.compose.ui.platform.AndroidUiDispatcher.performTrampolineDispatch(AndroidUiDispatcher.android.kt:81)
       at androidx.compose.ui.platform.AndroidUiDispatcher.access$performTrampolineDispatch(AndroidUiDispatcher.android.kt:41)
       at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.run(AndroidUiDispatcher.android.kt:57)
       at android.os.Handler.handleCallback(Handler.java:942)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:313)
       at android.app.ActivityThread.main(ActivityThread.java:8757)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

Code to reproduce

No repro steps available. It has happened only to a few users.

Android version

Android 12 & 13

Impacted devices

  • Samsung Galaxy A03s
  • Oppo CPH2211

Installation method

Through a gradle dependency

Dependency Versions

kotlin: 1.9.0
stripe-android: 20.31.0
Android Gradle Plugin: 8.1.1
Gradle: 8.3

@tillh-stripe
Copy link
Collaborator

@ccen-stripe, can you help out here?

@jamesbluecrow jamesbluecrow changed the title [BUG] Fatal Exception: java.lang.IllegalArgumentException: Contents of /data/user/0/com.package/cache/a8bcf0129dcd29084f6797ede7e0be86f9e11ed5.tflite does not encode a valid TensorFlow Lite model: Could not open '/data/user/0/com.ourpackage/cache/a8bcf0129dcd29084f6797ede7e0be86f9e11ed5.tflite'. The model allocation is null/empty [BUG] Fatal Exception: java.lang.IllegalArgumentException: ... does not encode a valid TensorFlow Lite model: Could not open .... The model allocation is null/empty Sep 25, 2023
@ccen-stripe ccen-stripe self-assigned this Sep 26, 2023
@ccen-stripe
Copy link
Contributor

hi @jamesbluecrow the .tflite model is downloaded on the fly, from the log it seems that the file is not correctly downloaded. Is it possible to confirm when the error happens network connection is not stable and the model fails to download?

@jamesbluecrow
Copy link
Author

jamesbluecrow commented Sep 28, 2023

IllegalArgumentException

Yes it is likely due to slow internet connection.

But in no case should the app crash because of it. The SDK should catch that exception if it cannot load the model and maybe emit a IdentityVerificationSheet.VerificationFlowResult.Failed error.

Because it is happening inside the SDK we cannot catch that exception ourselves.

@ccen-stripe
Copy link
Contributor

IllegalArgumentException

Yes it is likely due to slow internet connection.

But in no case should the app crash because of it. The SDK should catch that exception if it cannot load the model and maybe emit a IdentityVerificationSheet.VerificationFlowResult.Failed error.

Because it is happening inside the SDK we cannot catch that exception ourselves.

Will fix this in our upcoming release!

@thedeveloperr
Copy link

Hi, any plans/ETA for the fix for this or is it fixed already ? We are still seeing this. Our version SDK is v20.48

@thedeveloperr
Copy link

IllegalArgumentException

Yes it is likely due to slow internet connection.
But in no case should the app crash because of it. The SDK should catch that exception if it cannot load the model and maybe emit a IdentityVerificationSheet.VerificationFlowResult.Failed error.
Because it is happening inside the SDK we cannot catch that exception ourselves.

Will fix this in our upcoming release!

Hi @ccen-stripe posting again in case last message was missed. Is this fixed yet? We are still facing issues. Which version contains the fix in case it's already fixed?

@Julian-Sam
Copy link

@ccen-stripe @manpreet-stripe Any update here?

@kentwilliams-stripe
Copy link
Contributor

This is fixed! Pending release, most likely in January

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants