microsoftconnect / ms-intune-app-sdk-android

Intune App SDK for Android enables data protection features and mobile app management via Microsoft Intune
45 stars 18 forks source link

ANR: com.microsoft.intune.mam.client.app.offline.OfflineContentProviderBehavior.attachInfo #164

Closed shashank-msra closed 1 year ago

shashank-msra commented 1 year ago

Summary

We are observing scattered occurrences of this ANR when application is getting instantiated via different touch-points like

Repro Steps

The issue is non-reproducible locally, we are receiving

Details

Logs

Instance 1

"main" tid=1 Native
  at libcore.io.Linux.access (Native method)
  at libcore.io.ForwardingOs.access (ForwardingOs.java:72)
  at libcore.io.BlockGuardOs.access (BlockGuardOs.java:73)
  at libcore.io.ForwardingOs.access (ForwardingOs.java:72)
  at android.app.ActivityThread$AndroidOs.access (ActivityThread.java:7839)
  at java.io.UnixFileSystem.checkAccess (UnixFileSystem.java:281)
  at java.io.File.exists (File.java:815)
  at android.app.ContextImpl.ensureExternalDirsExistOrFilter (ContextImpl.java:2875)
  at android.app.ContextImpl.getExternalFilesDirs (ContextImpl.java:763)
  at android.content.ContextWrapper.getExternalFilesDirs (ContextWrapper.java:278)
  at androidx.core.content.ContextCompat$Api19Impl.getExternalFilesDirs (ContextCompat.java)
  at androidx.core.content.ContextCompat.getExternalFilesDirs (ContextCompat.java)
  at androidx.core.content.FileProvider.parsePathStrategy (FileProvider.java:716)
  at androidx.core.content.FileProvider.getPathStrategy (FileProvider.java:645)
  at androidx.core.content.FileProvider.attachInfoMAM (FileProvider.java:424)
  at com.microsoft.intune.mam.client.app.offline.OfflineContentProviderBehavior.attachInfo (OfflineContentProviderBehavior.java)
  at com.microsoft.intune.mam.client.content.MAMContentProvider.attachInfo (MAMContentProvider.java:68)
  at android.app.ActivityThread.installProvider (ActivityThread.java:7524)
  at android.app.ActivityThread.installContentProviders (ActivityThread.java:7024)
  at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6937)
  at android.app.ActivityThread.access$1300 (ActivityThread.java:263)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1991)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:240)
  at android.app.ActivityThread.main (ActivityThread.java:8000)
  at java.lang.reflect.Method.invoke (Native method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:603)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:947)

Instance 2

"main" tid=1 Native
  #00  pc 0x00000000000c7df8  /apex/com.android.runtime/lib64/bionic/libc.so (__faccessat+8)
  #01  pc 0x0000000000022200  /apex/com.android.art/lib64/libjavacore.so (Linux_access(_JNIEnv*, _jobject*, _jstring*, int)+76)
  #02  pc 0x0000000000461554  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+148)
  #03  pc 0x0000000002487c3c  /memfd:jit-zygote-cache (libcore.io.BlockGuardOs.access+252)
  #04  pc 0x0000000002591a20  /memfd:jit-zygote-cache (android.app.ActivityThread$AndroidOs.access+224)
  #05  pc 0x0000000002117558  /memfd:jit-zygote-cache (java.io.UnixFileSystem.checkAccess+600)
  #06  pc 0x00000000020d6f44  /memfd:jit-zygote-cache (java.io.File.exists+276)
  #07  pc 0x00000000025efba0  /memfd:jit-zygote-cache (android.app.ContextImpl.ensureExternalDirsExistOrFilter+320)
  #08  pc 0x00000000025f284c  /memfd:jit-zygote-cache (android.app.ContextImpl.getExternalFilesDirs+460)
  #09  pc 0x0000000002741df4  /memfd:jit-zygote-cache (android.content.ContextWrapper.getExternalFilesDirs+68)
  at libcore.io.Linux.access (Native method)
  at libcore.io.ForwardingOs.access (ForwardingOs.java:128)
  at libcore.io.BlockGuardOs.access (BlockGuardOs.java:76)
  at libcore.io.ForwardingOs.access (ForwardingOs.java:128)
  at android.app.ActivityThread$AndroidOs.access (ActivityThread.java:8120)
  at java.io.UnixFileSystem.checkAccess (UnixFileSystem.java:281)
  at java.io.File.exists (File.java:813)
  at android.app.ContextImpl.ensureExternalDirsExistOrFilter (ContextImpl.java:3336)
  at android.app.ContextImpl.getExternalFilesDirs (ContextImpl.java:829)
  at android.content.ContextWrapper.getExternalFilesDirs (ContextWrapper.java:296)
  at androidx.core.content.ContextCompat$Api19Impl.getExternalFilesDirs (ContextCompat.java)
  at androidx.core.content.ContextCompat.getExternalFilesDirs (ContextCompat.java)
  at androidx.core.content.FileProvider.parsePathStrategy (FileProvider.java:716)
  at androidx.core.content.FileProvider.getPathStrategy (FileProvider.java:645)
  at androidx.core.content.FileProvider.attachInfoMAM (FileProvider.java:424)
  at com.microsoft.intune.mam.client.app.offline.OfflineContentProviderBehavior.attachInfo (OfflineContentProviderBehavior.java:44)
  at com.microsoft.intune.mam.client.content.MAMContentProvider.attachInfo (MAMContentProvider.java:68)
  at android.app.ActivityThread.installProvider (ActivityThread.java:7806)
  at android.app.ActivityThread.installContentProviders (ActivityThread.java:7323)
  at android.app.ActivityThread.handleBindApplication (ActivityThread.java:7085)
  at android.app.ActivityThread.access$1800 (ActivityThread.java:259)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2208)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:233)
  at android.os.Looper.loop (Looper.java:344)
  at android.app.ActivityThread.main (ActivityThread.java:8249)
  at java.lang.reflect.Method.invoke (Native method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:589)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1071)

Screenshots of the occurences on Playstore Dashboard https://drive.google.com/file/d/1D8PBB9Hk0_7Ijr0JmVOIbRu0RCdh7Ifk/view?usp=sharing https://drive.google.com/file/d/1cLQMrxr66_M_JjyQ0Z5Ls4Em1a_qEDcd/view?usp=sharing

Complete stack trace from Play-store https://drive.google.com/file/d/1NdzIVsV_jFYRDU1NspsFEBBYrDbUrsY9/view?usp=sharing https://drive.google.com/file/d/1OfO_95Q4jQYPnaxAh5ROnQH7KEbBzZz2/view?usp=sharing

AndroidX Dependencies

androidxCore = "1.6.0" androidxLifecycle = "2.3.1" androidxWorkManager = "2.7.0" androidxNavigation = "2.5.2" androidxStartupRuntime = "1.1.0" androidxDatastore = "1.0.0"

Third-Party Library Dependencies

If your app includes any third-party libraries, please list them here, along with the version info:

boyzhang-msft commented 1 year ago

Hi @shashank-ADOBE ,

Thank you for reporting. I checked the code around these lines, and it does not look like a MAM issue. I.e. without MAM integration, your app is likely to see the same ANR. MAM is being in the stack trace only because we are a wrapper around the actual Android API call.

Do you have an app without MAM integration that you can check for a similar trace?

 at com.microsoft.intune.mam.client.app.offline.OfflineContentProviderBehavior.attachInfo (OfflineContentProviderBehavior.java:44)
  at com.microsoft.intune.mam.client.content.MAMContentProvider.attachInfo (MAMContentProvider.java:68)

MAMContentProvider.attachInfo is calling into OffineContentProviderBase.attachInfo, which just calls the app defined attachInfo method. This is the OffineContentProviderBase.attachInfo method:

    @Override
    public void attachInfo(final Context context, final ProviderInfo info) {
        mContentProvider.attachInfoMAM(context, info);
    }
shashank-msra commented 1 year ago

Thanks for responding. Agreed & although we do not have an builds without Intune MAM but I did find this happening in general with several other clients here: https://issuetracker.google.com/issues/234116801

Will followup from there. Closing this one.