Search Unity

Crash in libunwind?

Discussion in 'Android' started by spatial_io, Mar 3, 2021.

  1. spatial_io

    spatial_io

    Joined:
    Jul 3, 2017
    Posts:
    21
    We are getting this cryptic native crash on a Oculus Quest:
    ```
    [ 0 ] std::__ndk1::shared_ptr<unwindstack::Elf>::~shared_ptr() (libunity.so)
    [ 1 ] unwindstack::MapInfo::~MapInfo() (libunity.so)
    [ 2 ] 0x740dae911e (base.odex)
    ```
    Is there anyway to disable this use of libunwind in Unity? Why would it be crashing during stack unwind?
     
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,905
    It's used whenever stacktrace is being resolved, you could disable it by setting stacktrace logging to None in Player Settings, but I think it would be still be used when the actual crash is occuring.

    In any case if you have a 100% repro crash with this stacktrace, could you please report a bug with repro project attached? Thank you.
     
  3. spatial_io

    spatial_io

    Joined:
    Jul 3, 2017
    Posts:
    21
    Our stack traces are set to "ScriptOnly," so should we expect it to make a difference to put it to "None"?
     
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,905
    If you're using IL2CPP, then yes, None - should disable that code path, assuming the stacktrace resolving is done from scripts, from your callstack it's not totally clear if that's the case.
     
  5. bearhugmo

    bearhugmo

    Joined:
    Mar 20, 2019
    Posts:
    19
    We see variations of this issue extensively on our live releases. Have been unable to repro locally so aren't able to provide a sample project. We do obviously use IL2CPP.

    We currently rely on Unity Diagnostics and Bugsnag to track issues. What are the implications of disabling Stack Trace logging on diagnostic efforts?

    Code (CSharp):
    1. SIGSEGV Segmentation violation (invalid memory reference)    
    2. libunity std::__ndk1::shared_ptr<unwindstack::Elf>::~shared_ptr()    
    3. libunity unwindstack::MapInfo::~MapInfo()    
    4. libunity unwindstack::Maps::Clear()    
    5. libunity UnityFinalDeinitApplication()    
    6. libunity nativeDone(_JNIEnv*, _jobject*)    
    7. /data/app/com.bhe.alicelegends-iHird0Ma2aXdzujzqQQnhw==/oat/arm64/base.odex:474640 0x74f4435e10
    Code (CSharp):
    1. SIGSEGV Segmentation violation (invalid memory reference)    
    2. libunity std::__ndk1::shared_ptr<unwindstack::Elf>::~shared_ptr()    
    3. libunity unwindstack::MapInfo::~MapInfo()    
    4. libunity unwindstack::Maps::Clear()    
    5. libunity UnityFinalDeinitApplication()    
    6. libunity nativeDone(_JNIEnv*, _jobject*)    
    7. /data/dalvik-cache/arm64/mnt@asec@com.bhe.alicelegends-fWIww8RHXDEDOJo9@base.apk@classes.dex:699920 0x6f370b2e10
     
  6. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,905
    Seems like it's crashing when application is being closed by OS, disabling stack trace logging only affects Debug.Log/LogError and similar functions, in case of a crash Unity will still try to resolve stacktrace, other than that it doesn't impact the game
     
  7. bearhugmo

    bearhugmo

    Joined:
    Mar 20, 2019
    Posts:
    19
    We rolled out an update with the above suggestion but still get this crash on Android.

    upload_2021-5-5_12-34-37.png

    The log clearly indicates that the game has terminated as far as the client code paths are concerned.

    upload_2021-5-5_12-37-8.png

    The issue is a continual source of instability on Android for us since Android instability impacts discoverability on the platform. Is there anything else we can try to mitigate? Alternatively, what is the best way to go about helping you to fic the issue within Unity given that it is intermittent and hard to repro for us?
     
  8. bearhugmo

    bearhugmo

    Joined:
    Mar 20, 2019
    Posts:
    19
    There also seems to be a second route for the exception to occur.

    upload_2021-5-6_15-6-51.png
     

    Attached Files:

  9. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    This is a bug on our side. It happens on application quit. We're rolling out a fix for it.
     
    bearhugmo likes this.
  10. BearHugMark

    BearHugMark

    Joined:
    Feb 21, 2016
    Posts:
    21
    Hi Aurimas-Cernias, many thanks for the fix. We're very excited to get this as soon as possible.

    Currently, the issue causes us to be flagged for "bad behaviour" in the Google Play dashboard, which significantly harms our organic installs. Do you have an ETA on when we might be able to get the fix?

    Thanks again,
    Mark
     
  11. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    I approved pull requests for backports of this feature yesterday (all supported resleases), so it's a matter of how long it takes to land them, test and publish release. Should be few weeks from now.
     
  12. spatial_io

    spatial_io

    Joined:
    Jul 3, 2017
    Posts:
    21
    Which Unity releases will this make it in for? Thanks!
     
  13. toptracer-emilio

    toptracer-emilio

    Joined:
    Mar 2, 2021
    Posts:
    1
    Thank you for reporting and investigating this issue, it sounds like this is what is happening to our app. We are affected much in the same way as BearHugMark so - if possible - we would love an approximate ETA of the fix, or which version it is in if it has already been released.

    All the best,
    Emilio
     
  14. masourek

    masourek

    Joined:
    Apr 24, 2020
    Posts:
    3
    Has the fix been rolled out yet? Is there an issue in the issuetracker that I could follow? We get quite a lot of those sigsegv errors. Thanks for your work on this!
     
  15. bearhugmo

    bearhugmo

    Joined:
    Mar 20, 2019
    Posts:
    19
    I can see that a fix made it into 2021.1.10f1 which links to this issue.

    Looking over the release notes for 2019.4.28 I can't see anything matching it. So I suppose we wait for the fix to get backported. I wonder how long that takes.
     
  16. go3000

    go3000

    Joined:
    Feb 17, 2020
    Posts:
    6
    did the 2019.4.x fixed this issue? thanks.
     
  17. xuxiangwen2080

    xuxiangwen2080

    Joined:
    Jan 26, 2022
    Posts:
    2
    我们在Unity2020.1.14f1开发项目遇到了相同,请问现在有什么最新的进展吗?
     
  18. easemagus

    easemagus

    Joined:
    Jul 6, 2022
    Posts:
    3
    Hi, have you fix that bug?