Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Lots of Crashes/ANRs (libunity.so (???))

Discussion in 'Android' started by Maisey, Feb 3, 2021.

  1. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    300
    I'm seeing tons (currently counted to: 2236) ANRs the last 7 days. Can someone help decipher this stacktrace? (We can't repro this ourselves). On Crashlytics these appear as crashes, while in Google Play they appear as ANRs. :confused:

    I've uploaded the debug symbols on Google Play, but for some reason the line number is not specified in libunity.so (it's marked with ???).

    This game was built with Unity 2017.4.40f1. ANRs occur only on Android 11. Could this be this issue just appearing in another shape?

    Someone might say: "Hey, there's Firebase being mentioned in the stacktrace, it must be the issue", but it's simply Firebase messaging Activity which wraps Unity's own Activity (doesn't mean it isn't Firebase, but doesn't mean it is either).


    This is the Stacktrace from the main-thread (it seems like a deadlock somewhere, but the other threads don't really provide much insight):
    Code (CSharp):
    1.  #00  pc 000000000004accc  /apex/com.android.runtime/lib64/bionic/libc.so (syscall+28)
    2.   #00  pc 000000000004e968  /apex/com.android.runtime/lib64/bionic/libc.so (__futex_wait_ex(void volatile*, bool, int, bool, timespec const*)+144)
    3.   #00  pc 00000000000b5ef4  /apex/com.android.runtime/lib64/bionic/libc.so (NonPI::MutexLockWithTimeout(pthread_mutex_internal_t*, bool, timespec const*)+584)
    4.   #00  pc 0000000000165b28  /data/app/~~8-ag6b3qSU7wWJvazVNdVQ==/com.censored.game-EAzEiNb1Fuu9gH4aeMhxpg==/lib/arm64/libunity.so (???)
    5.   #00  pc 0000000000165aec  /data/app/~~8-ag6b3qSU7wWJvazVNdVQ==/com.censored.game-EAzEiNb1Fuu9gH4aeMhxpg==/lib/arm64/libunity.so (???)
    6.   #00  pc 0000000000162e58  /data/app/~~8-ag6b3qSU7wWJvazVNdVQ==/com.censored.game-EAzEiNb1Fuu9gH4aeMhxpg==/lib/arm64/libunity.so (???)
    7.   #00  pc 000000000013f474  /data/app/~~8-ag6b3qSU7wWJvazVNdVQ==/com.censored.game-EAzEiNb1Fuu9gH4aeMhxpg==/lib/arm64/libunity.so (???)
    8.   #00  pc 0000000000139750  /data/app/~~8-ag6b3qSU7wWJvazVNdVQ==/com.censored.game-EAzEiNb1Fuu9gH4aeMhxpg==/lib/arm64/libunity.so (???)
    9.   at com.unity3d.player.UnityPlayer.nativeInjectEvent (Native method)
    10.   at com.unity3d.player.UnityPlayer.injectEvent (unavailable)
    11.   at com.unity3d.player.UnityPlayer.onTouchEvent (unavailable)
    12.   at android.view.View.dispatchTouchEvent (View.java:14441)
    13.   at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3142)
    14.   at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2799)
    15.   at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3148)
    16.   at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2756)
    17.   at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3148)
    18.   at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2756)
    19.   at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3148)
    20.   at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2756)
    21.   at com.android.internal.policy.DecorView.superDispatchTouchEvent (DecorView.java:564)
    22.   at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent (PhoneWindow.java:1945)
    23.   at android.app.Activity.dispatchTouchEvent (Activity.java:4217)
    24.   at com.google.firebase.MessagingUnityPlayerActivity.dispatchTouchEvent (MessagingUnityPlayerActivity.java)
    25.   at com.android.internal.policy.DecorView.dispatchTouchEvent (DecorView.java:517)
    26.   at android.view.View.dispatchPointerEvent (View.java:14713)
    27.   at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent (ViewRootImpl.java:6216)
    28.   at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess (ViewRootImpl.java:5999)
    29.   at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:5467)
    30.   at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:5534)
    31.   at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:5495)
    32.   at android.view.ViewRootImpl$AsyncInputStage.forward (ViewRootImpl.java:5657)
    33.   at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:5503)
    34.   at android.view.ViewRootImpl$AsyncInputStage.apply (ViewRootImpl.java:5714)
    35.   at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:5471)
    36.   at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:5534)
    37.   at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:5495)
    38.   at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:5503)
    39.   at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:5471)
    40.   at android.view.ViewRootImpl.deliverInputEvent (ViewRootImpl.java:8299)
    41.   at android.view.ViewRootImpl.doProcessInputEvents (ViewRootImpl.java:8250)
    42.   at android.view.ViewRootImpl.enqueueInputEvent (ViewRootImpl.java:8202)
    43.   at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent (ViewRootImpl.java:8434)
    44.   at android.view.InputEventReceiver.dispatchInputEvent (InputEventReceiver.java:238)
    45.   at android.os.MessageQueue.nativePollOnce (Native method)
    46.   at android.os.MessageQueue.next (MessageQueue.java:339)
    47.   at android.os.Looper.loop (Looper.java:192)
    48.   at android.app.ActivityThread.main (ActivityThread.java:8052)
    49.   at java.lang.reflect.Method.invoke (Native method)
    50.   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:626)
    51.   at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1015)

    Here's the other threads, let me know if I should paste all the stacktraces from each thread:
    upload_2021-2-3_14-40-9.png
     
    Last edited: Feb 3, 2021
    dan_ginovker likes this.
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,663
    You need resolve libunity.so stack frames, I am assuming you've built with IL2CPP with Strip Engine Code On, thus the symbols are only available on your machine if you had Create Symbols checkbox On.
     
  3. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    300
    Hey @Tomas1856 thanks for getting back to me.
    I've indeed built with IL2CPP with Strip Engine Code On. Also I can't find this "Create Symbols" but symbols are created in the same directory as the APK and I've uploaded these symbol libunity.so and il2cpp.so to Google Play (I renamed them to have .so ending as per suggestion elsewhere). Or did you mean some other symbols and did you mean that it's not possible with "Strip Engine Code On"?

    EDIT
    Okay, I've now checked in Unity Cloud Diagnostics as well (don't know why I didn't do it at first), which shows:

    Code (CSharp):
    1. Native StackTrace:
    2.  
    3. Thread 0 (crashed)
    4. 0   libunity.so                        0x0000006f11649c0c AndroidNativeCrashReportHandler::SignalHandler(int, siginfo*, void*)
    5. 1   libunity.so                        0x0000006f116572f4 NativeRuntimeException::signal_handler(int, siginfo*, void*)
    6. 2   app_process64                      0x00000058c41a3db0 <symbols missing for uuid: cb4a9b8a8482f0772689ddc73871203d>
    7. 3   [vdso]                             0x0000007236f18678 <unknown>
    8. 4   libunity.so                        0x0000006f1167efe0 bool UnityDefaultAllocator<LowLevelAllocator>::AllocationPage<(RequestType)0>(void const*) const
    9. 5   libunity.so                        0x0000006f1167eb80 UnityDefaultAllocator<LowLevelAllocator>::RegisterAllocation(void const*)
    10. 6   libunity.so                        0x0000006f1167eaf0 UnityDefaultAllocator<LowLevelAllocator>::Allocate(unsigned long, int)
    11. 7   libunity.so                        0x0000006f1167bd08 MemoryManager::Allocate(unsigned long, unsigned long, MemLabelId, AllocateOptions, char const*, int)
    12. 8   libunity.so                        0x0000006f11a0b338 dynamic_array<AwakeFromLoadQueue::Item, 8ul>::reserve(unsigned long)
    13. 9   libunity.so                        0x0000006f11a0d9f0 PersistentManager::CopyToAwakeFromLoadQueueInternal(AwakeFromLoadQueue&)
    14. 10  libunity.so                        0x0000006f11a0db20 PersistentManager::ExtractTimeSliceAwakeFromLoadQueue(TimeSliceAwakeFromLoadQueue&)
    15. 11  libunity.so                        0x0000006f119f61bc LoadSceneOperation::Perform()
    16. 12  libunity.so                        0x0000006f119f7778 PreloadManager::ProcessSingleOperation()
    17. 13  libunity.so                        0x0000006f119f756c PreloadManager::Run()
    18. 14  libunity.so                        0x0000006f119f74fc PreloadManager::Run(void*)
    19. 15  libunity.so                        0x0000006f11a6d370 Thread::RunThreadWrapper(void*)
    20. 16  libc.so                            0x000000723127d1f8 <symbols missing for uuid: 11d13080412d11d9c0f9274b3d01391e>
    21. 17  libc.so                            0x0000007231217e28 <symbols missing for uuid: 11d13080412d11d9c0f9274b3d01391e>
    22. 18  .                                  0x0000000000000000 <unknown>
    Crashlytics & Google Play didn't show this info even with symbols uploaded.
     
    Last edited: Feb 3, 2021
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,663
    Yes, the stacktrace above points to this problem - https://forum.unity.com/threads/android-11-arm64-native-heap-allocator-issues.1047170/
     
  5. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    300
    Ahh I guessed as much when I finally saw the log obfuscated...And as a longshot, you don't know of any workarounds that might mitigate this issue (even if just a bit)?

    We can't migrate to Unity 2018 or 2019 at least not in the foreseeable future as that would require lots of time to deal with compatibility.

    Do you know if miHoYo (Genshin Impact, I saw it was built with Unity 2017.X) did upgrade their Unity-version or did they receive a special Unity-version to deal with this issue? @Tomas1856
     
  6. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,663
    There are no proper workarounds, you could set https://developer.android.com/guide/topics/manifest/uses-sdk-element?authuser=1#max thus not allowing your game to be installed on Android 11 or higher, not sure if that would be desirable for you.

    As for Genshin Impact, I am not totally sure, but I think they have access to Unity source code, which costs money, so most likely they modified the faulty part themselves.
     
  7. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    300
    I see, thanks for your help, that's most likely what they did yes.

    (I can't set that flag, will lose out on tons of players, the crash does not happen 100% of the sessions, it happens from time to time..luckily)
     
  8. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    As long as you stay below the google play crash and anr bad behaviour thresholds. If you go over them google will drop your ranking in their store search I think.

    if you’re still below that threshold and not getting bad reviews I wouldn’t worry too much.
     
  9. thanhnguyenkim

    thanhnguyenkim

    Joined:
    May 8, 2015
    Posts:
    4