plaid / plaid-link-android

Plaid Link Android SDK
https://plaid.com/docs/link/android
MIT License
115 stars 48 forks source link

StrictMode DiskReadViolation with 4.1.0 #259

Open eric-labelle opened 9 months ago

eric-labelle commented 9 months ago

The problem

When upgrading to the lastest 4.1.0 version of the SDK, the flow crashes as soon as it tries to launch when StrictMode is enabled.

Environment

Android OS Version 14.0.0 (34)
Android Devices/Emulators Pixel 4 Emulator

Steps to Reproduce

Launch the Plaid bank linking flow with StrictMode enabled.

Expected Result

The first screen of the flow should be shown.

Actual Result

StrictMode policy violation; ~duration=54 ms: android.os.strictmode.DiskReadViolation
    at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1666)
    at libcore.io.BlockGuardOs.access(BlockGuardOs.java:74)
    at libcore.io.ForwardingOs.access(ForwardingOs.java:128)
    at android.app.ActivityThread$AndroidOs.access(ActivityThread.java:8054)
    at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:313)
    at java.io.File.exists(File.java:813)
    at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:790)
    at android.app.ContextImpl.ensurePrivateCacheDirExists(ContextImpl.java:786)
    at android.app.ContextImpl.getCacheDir(ContextImpl.java:897)
    at android.content.ContextWrapper.getCacheDir(ContextWrapper.java:326)
    at com.plaid.internal.p5.get(SourceFile:250)
    at dagger.internal.Providers$1.get(Providers.java:29)
    at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
    at com.plaid.internal.t2$x.a(SourceFile:122)
    at com.plaid.internal.hh.<init>(SourceFile:63)
    at com.plaid.internal.lh.create(SourceFile:2)
    at androidx.lifecycle.ViewModelProvider$Factory.create(ViewModelProvider.kt:83)
    at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.kt:187)
    at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.kt:153)
    at com.plaid.internal.gh.onCreate(SourceFile:4)
    at androidx.fragment.app.Fragment.performCreate(Fragment.java:3094)
    at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:504)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:268)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1839)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
    at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:565)
    at android.os.Handler.handleCallback(Handler.java:958)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:205)
    at android.os.Looper.loop(Looper.java:294)
    at android.app.ActivityThread.main(ActivityThread.java:8177)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
melissaosullivan commented 9 months ago

Hi @eric-labelle ,

Thanks for reporting this. I can reproduce it in 4.1.0. Are you also seeing this issue in 4.0.0?

We will address this in a patch release.

Thanks, Melissa

eric-labelle commented 9 months ago

Hi @eric-labelle ,

Thanks for reporting this. I can reproduce it in 4.1.0. Are you also seeing this issue in 4.0.0?

We will address this in a patch release.

Thanks, Melissa

Thanks @melissaosullivan. 4.0.0 works well for me. Just happens when bumping to 4.1.0.

melissaosullivan commented 9 months ago

Thanks @eric-labelle.

I'm seeing a disk read violation in 4.0.0 as well. Based on the reports it seems likely that 4.1.0 has introduced a new issue, so I'd like address that first, but I'm having trouble isolating it. How are you enabling strict mode -- on the device developer options or with StrictMode.setThreadPolicy()?

eric-labelle commented 9 months ago

Oh wait, you're right, I overlooked that. Seeing DiskReadViolations on 4.0 also. Sorry about that. I'll try to dig deeper, might not be what causes the flow to exit afterall.

melissaosullivan commented 9 months ago

Hi @eric-labelle, I think I've found the issue and addressed this in the 4.1.1 release. Please try out this version. Thanks for reporting this bug!

eric-labelle commented 9 months ago

Hi @eric-labelle, I think I've found the issue and addressed this in the 4.1.1 release. Please try out this version. Thanks for reporting this bug!

Good timing, I was just trying to get more info on the crash. Bumping to 4.1.1 seems to be working well. Is there any plan to eventually address all the DiskReadViolation though?

melissaosullivan commented 9 months ago

@eric-labelle Good to hear this fixes that issue for you! Yes we do plan to address this DiskReadViolation but with a larger timeline. We can keep this open to track the DiskReadViolation progress.