microsoft-authentication-library-for-android icon indicating copy to clipboard operation
microsoft-authentication-library-for-android copied to clipboard

Significant Increase in ANRs after Updating to API 34 (Android 14) Related to MSAL Library

Open Gorebar opened this issue 1 year ago • 0 comments

Describe the bug

We recently updated our app dependencies to target API 34 (Android 14). After deploying this version to production, we observed a 55% increase in ANRs (Application Not Responding). Upon preliminary investigation, we identified that the majority of these ANRs are directly associated with the MSAL .

Actions Taken:

  1. As an initial step, we upgraded the MSAL library to the latest available version, ensuring that the integration was correct and that all authentication functionalities were working as expected.

  2. We conducted thorough testing in both development and staging environments without encountering any apparent issues.

  3. We then proceeded to roll out the update to production to a small percentage of users.

Result:

Despite updating the MSAL library and conducting all necessary checks, the ANRs persist in the new version of the app. The behavior remains the same as before the update, significantly impacting the stability and user experience.

Smartphone (please complete the following information):

  • Devices: We cannot identify an specific device, we are talking about thousands of devices.

  • Android Version: API 34 (Android 14) but here is the graphic to check the different versions

    image

  • MSAL Version: Recently updated to 'com.microsoft.identity.client:msal:5.5.0'

Stacktrace

A basic stacktrace could be:

"main" tid=1 Blocked
  at com.microsoft.identity.common.java.providers.microsoft.azureactivedirectory.AzureActiveDirectory.setEnvironment (unavailable:2)
  at com.microsoft.identity.client.PublicClientApplication.initializeApplication (PublicClientApplication.java:1066)
  at com.microsoft.identity.client.PublicClientApplication.<init> (PublicClientApplication.java:1057)
  at com.microsoft.identity.client.MultipleAccountPublicClientApplication.<init> (MultipleAccountPublicClientApplication.java:67)
  at com.microsoft.identity.client.PublicClientApplication$9.onTaskCompleted (PublicClientApplication.java:939)
  at com.microsoft.identity.client.PublicClientApplication$9.onTaskCompleted (PublicClientApplication.java:925)
  at com.microsoft.identity.common.java.controllers.CommandDispatcher.commandCallbackOnTaskCompleted (CommandDispatcher.java:562)
  at com.microsoft.identity.common.java.controllers.CommandDispatcher.access$1000 (CommandDispatcher.java:86)
  at com.microsoft.identity.common.java.controllers.CommandDispatcher$4.run (CommandDispatcher.java:538)
  at android.os.Handler.handleCallback (Handler.java:1013)
  at android.os.Handler.dispatchMessage (Handler.java:101)
  at android.os.Looper.loopOnce (Looper.java:226)
  at android.os.Looper.loop (Looper.java:328)
  at android.app.ActivityThread.main (ActivityThread.java:9223)
  at java.lang.reflect.Method.invoke (Native method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:594)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1099)

Or you can download the full stacktrace HERE

To Reproduce

We have not been able to reproduce the error on any of our test devices, making it challenging to identify the root cause through internal testing alone

If related to development, please provide relevant configuration details necessary to understand your problem including any relevant traces, logs, or otherwise.

Screenshots

Here you can see the increase on the different version:

  1. Version 3.8.1 - New update API 34 (the problem started)
  2. Version 3.8.2 - New MSAL update to v5.5.0 on API 34 (upload just for a few users to check)
  3. Version 3.8.0 - OLD versions

image

Gorebar avatar Aug 22 '24 09:08 Gorebar