Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Bug Crash on Android when Unity ARCore session reset called when unloading a blended AR scene

Discussion in 'AR' started by clueduppstephen, Sep 6, 2023.

  1. clueduppstephen

    clueduppstephen

    Joined:
    Aug 6, 2019
    Posts:
    13
    Since upgrading to AR-Foundation 4.2.8 from 4.2.3 this issue has affected 155 users, logs indicate they were closing the AR scene. We Destroy all items in AR-planes.trackables, then call reset on the AR session before Async unloading the scene.

    Details:
    Unity version 2021.3.9f1
    ARFoundation version 4.2.8
    ARCore XR Plugin version 4.2.8
    Affected 155 users in last 7 days.
    Affected 80% Samsung devices.
    Affected 78% Android 13

    A simplified Stack trace:
    #01 Firebase.App.cpp:? (Not clear if this is important)
    #02 NativeApi_UnityARCore_session_reset_m
    #03 Unity.XR.ARCore.cpp:?
    #04 2tvs_utils0.lump.cpp:?
    #05 ARCoreProvider_Reset_m
    #06 ARSession_Reset_m
    #07 UnityEngine.UIElementsModule7.cpp:?
    #08 UnityEngine.UIElementsModule7.cpp:?
    #09 SC_AR_CloseAR_m (Our close function attached to a UI button)
     
  2. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,151
    What do you mean "We Destroy all items in AR-planes.trackables"?

    Note our docs:

    https://docs.unity3d.com/Packages/c...chitecture/managers.html#trackable-life-cycle

    Trackable components and their GameObjects are managed by their
    ARTrackableManager
    , and correlate to data that is managed by ARCore itself. Our API is designed to always respect the platform's representation of AR data, and you can introduce errors by manually destroying trackables.
     
  3. mekin

    mekin

    Joined:
    Mar 5, 2019
    Posts:
    11
    That's the top of your crash callstack; it seems extremely important :)

    "Firebase" is a Google SDK. Do you have the source to, or know where in,
    Firebase.App.cpp
    you are crashing? What is the crash reason, e.g., null pointer? jump to address 0x0?
     
  4. clueduppstephen

    clueduppstephen

    Joined:
    Aug 6, 2019
    Posts:
    13
    @andyb-unity

    Hi Andy, Before closing our AR scene we loop through all the Trackable planes and delete them, we used to have an issue with un-interactive planes remaining in the scene if the user reloaded into the AR scene. We have removed this loop and just call .Reset() on the ArSession, this appears to be functional in testing, so we will push this change to production and see if this remedies the crash. Thanks for your feedback.

    @mekin I'm sure its important, but I was wondering if its the top of the stack because Firebase Crashlytics caught and reported the crash. As for the specific error, there is no detailed info in the crash, SIGSEGV title and an un-symbolicated stack, I used address-2-line and my symbols file to get the stack trace above. I don't know why we no longer get a proper crash and tombstone text file :(
     
    andyb-unity and mekin like this.
  5. NikMue

    NikMue

    Joined:
    May 12, 2022
    Posts:
    2
    Hey @clueduppstephen, did you manage to solve these issues? It looks like we have the same issue with AR Foundation Version 5.0.6...
     
  6. mdsaidov98

    mdsaidov98

    Joined:
    Nov 26, 2018
    Posts:
    5
    Hey. have the crash after arsession.Reset(); in ar foundation 5.1.3
    Have some suggestions?
     
  7. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,151
    Our suggestion would be to please file a bug so that we can investigate this issue.

    Note our FAQ:

     
  8. Alex_Heizenrader

    Alex_Heizenrader

    Joined:
    May 16, 2019
    Posts:
    102
    I just observe the exact same crash fyi. It didn't use to crash in old ARfoundation version 4.2.7, but any version after crashes after arsession.reset()

    I will definitely file a bug but whats the best workaround for now to reset arsession? (Whenenabling and disabling it to enter and exit AR)
     
  9. Alex_Heizenrader

    Alex_Heizenrader

    Joined:
    May 16, 2019
    Posts:
    102
    The bug filed fyi (I added comments to explain it happens after reset, since I figured that out after initiating it):

    IN-72985 - ARFoundation broken in Android devices
     
  10. antitheos

    antitheos

    Joined:
    Jun 6, 2019
    Posts:
    1
    running into same issue. hopefully there is a solution soon
     
  11. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,151
    Confirming that this issue is open and in our QA team's queue. Thank you for reporting @Alex_Heizenrader.
     
  12. MajorWolph

    MajorWolph

    Joined:
    Apr 28, 2018
    Posts:
    28
    We are running into this same issue on 5.1.3. Is there any news on this?
     
  13. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,151
  14. andyb-unity

    andyb-unity

    Unity Technologies

    Joined:
    Feb 10, 2022
    Posts:
    1,151
    In the meantime you should avoid calling ARSession.Reset while the session is initializing. This is not a good practice, as there is no data to reset. The session isn't even initialized yet. But we will fix our plug-in so it doesn't crash :).
     
    newguy123 likes this.