quickstart-unity icon indicating copy to clipboard operation
quickstart-unity copied to clipboard

[Bug] ANR traces are not symbolicated

Open AntonPetrov83 opened this issue 2 years ago • 5 comments

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2020.3.32f1
  • Firebase Unity SDK version: 8.8.0
  • Source you installed the SDK: .unitypackage
  • Problematic Firebase Component: Crashlytics
  • Other Firebase Components in use: Analytics
  • Additional SDKs you are using: Facebook, Singular, AppLovin MAX SDK, AdMob, ironSource, AdColony,
  • Platform you are using the Unity editor on: Windows 11 Pro
  • Platform you are targeting: Android
  • Scripting Runtime: IL2CPP

[REQUIRED] Please describe the issue here:

I can see my ANR in the Crashlytics but it is not symbolicated: image

As a text: image

Steps to reproduce:

It is 100% reproducible.

  1. I am building the game locally;
  2. Then I upload symbols using Firebase CLI and it works as expected: Crashlytics symbol file uploaded successfully;
  3. Then I run the game and generate an ANR making an infinite loop in the main thread.
  4. I see my ANR report in the Firebase Crashlytics but it is not symbolicated.

The interesting part:

I used Unity's Stacktrace Utility (comes with Android Logcat package) to symbolicate this stack trace using the same symbols I uploaded earlier to Crashlytics and it works as expected: image

Under the hood this utility uses addr2line so I guess this proves that this trace definitely can be symbolicated!

AntonPetrov83 avatar May 23 '22 05:05 AntonPetrov83

Hi @AntonPetrov83,

Thanks for reporting this issue. Version 9.0.0 of the SDK has been released recently. Could you verify if this version makes any difference? Otherwise, please provide a minimal, reproducible example of your implementation along with the complete steps to reproduce the issue so that we can identify what's causing this behavior.

paulinon avatar May 23 '22 16:05 paulinon

Hi @paulinon,

I have upgraded Firebase Crashlytics to 9.0.0, I have upgraded Firebase CLI to 11.0.0, I have successfully uploaded symbols and triggered an ANR - still nothing :(

image

UPDATE:

So, it is 100% reproducible.

  1. Take the test app quickstart-unity/crashlytics/testapp and open it with Unity 2020.3.32f1 (LTS);
  2. Follow general setup instructions to enable Crashlytics in Firebase Console;
  3. Modify UIHandler.cs to add new "Trigger ANR" button like this:
    public void TriggerAnr() {
      DebugLog("Triggering an ANR. Wait for system popup and Close the App");
      AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
      AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
      activity.Call("runOnUiThread", new AndroidJavaRunnable(InfiniteLoopOnMainThread));
    }

    void InfiniteLoopOnMainThread() {
      while (true) ;
    }

    void GUIDisplayControls() {
      ...
        if (GUILayout.Button("Trigger ANR")) {
          TriggerAnr();
        }
      ...
    }
  1. Build Android build with "Create symbols.zip" enabled;
  2. Upload symbols using Firebase CLI;
  3. Run the app, trigger an ANR, wait for ANR dialog and close the app;
  4. Run again to send crashlytics;
  5. See the bug: image

AntonPetrov83 avatar May 24 '22 05:05 AntonPetrov83

Thanks for the additional information, @AntonPetrov83. I've replicated the issue using the steps you provided, and I'll relay this to the team. I also noticed that the ANR isn't reported when it's coming from a device with a lower Android version (in my case, Android 9).

I'll be marking this as a bug for now, but you may refer to this thread for updates.

paulinon avatar May 24 '22 14:05 paulinon

Hey @AntonPetrov83, right now Crashlytics isn't able to symbolicate ANRs, but we are working on it. I don't have a TBD yet but will update here when we get it released.

samedson avatar Jun 13 '22 17:06 samedson

@paulinon There was an announcement at the Games Developer Summit that symbolication of native Android ANRs is now supported. Wouldn't it solve this issue ? What version of Crashlytics has this support?

khambadkone avatar Mar 22 '23 04:03 khambadkone