Unity-Technologies / arfoundation-samples

Example content for Unity projects based on AR Foundation
Other
3.07k stars 1.15k forks source link

[Android][ARCore] Crash occurs when changing to the front camera after ImageTracking has been performed even once. #1161

Closed salvo-tchou closed 8 months ago

salvo-tchou commented 8 months ago

We are developing an application that allows users to take pictures with AR objects using ARFoundation. ImageTracking is used to detect AR markers, display the object and take the photo. As an option, we have created a function to switch the camera output to the front camera in order to take pictures with the front camera. (In the front camera state, only the image is used, so ImageTracking is not required.)

Under normal conditions, switching between the front and rear cameras functions normally, but If the following code is executed while ImageTracking has occurred even once, a crash will occur.

arCameraManager.requestedFacingDirection = CameraFacingDirection.User

I tried everything, but the crashing part is in the native code of ARFoundation, and I can confirm, no solution was found.

Run Environment

Below are the relevant logs when a crash occurs on the actual device.

//clash point code in unity
////mycode
public async void SetFrontCamera(bool front)
{
    isFrontCamera = front;

        ARCameraManager arCameraManager = FindObjectOfType<ARCameraManager>(true);
    ARTrackedImageManager arTrackedImageManager = FindObjectOfType<ARCameraManager>(true);
    ARCameraManager arCameraManager = FindObjectOfType<ARCameraManager>(true);

        if (isFrontCamera)
        {
            arTrackedImageManager.enabled = false;
        }
        else
        {
            arTrackedImageManager.enabled = true;
        }

        ARCameraBackground arCameraBackground = FindObjectOfType<ARCameraBackground>(true);

        try
        {
            arCameraManager.requestedFacingDirection = (front)? CameraFacingDirection.User : CameraFacingDirection.World;
        }
        catch (Exception e)
        {
            Debug.LogException(e);
        }

        arCameraBackground.enabled = false;
        arCameraBackground.enabled = true;
}

//maybe. ClashPoint in ARFoundation Package
namespace UnityEngine.XR.ARCore
{
    public sealed class ARCoreSessionSubsystem : XRSessionSubsystem
    {
        class ARCoreProvider : Provider
        {
            public override void Update(XRSessionUpdateParams updateParams, Configuration configuration)
            {
                NativeApi.UnityARCore_session_update(
                    updateParams.screenOrientation,
                    updateParams.screenDimensions,
                    configuration.descriptor.identifier,
                    configuration.features);
            }
       }
   }
}

//adb logcat Unity:* Unity-ARCore:* ArPresto:* *:S
02-28 23:28:50.976  9999 10039 I Unity   : Using session configuration 0x3
02-28 23:28:50.976  9999 10039 I Unity   :      Requested Features: User Facing Camera, Auto-Focus
02-28 23:28:50.976  9999 10039 I Unity   :      Supported Features: User Facing Camera, Auto-Focus
02-28 23:28:50.976  9999 10039 I Unity   :      Requested features not satisfied: (None)
02-28 23:28:50.976  9999 10039 I Unity   : UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
02-28 23:28:50.976  9999 10039 I Unity   : UnityEngine.Logger:Log(LogType, Object)
02-28 23:28:50.976  9999 10039 I Unity   : UnityEngine.Debug:Log(Object)
02-28 23:28:50.976  9999 10039 I Unity   : UnityEngine.XR.ARSubsystems.XRSessionSubsystem:DebugPrintConfigurationChange(Configuration, Feature) (at .\Library\PackageCache\com.unity.xr.arfoundation@5.0.7\Runtime\ARSubsystems\SessionSubsystem\XRSessionSubsystem.cs:165)
02-28 23:28:50.976  9999 10039 I Unity   : UnityEngine.XR.ARSubsystems.XRSessionSubsystem:Update(XRSessionUpdateParams) (at .\Library\PackageCache\com.unity.xr.arfoundation@5.0.7\Runtime\ARSubsystems\SessionSubsystem\XRSessionSubsystem.cs:128)
02-28 23:28:50.976  9999 10039 I Unity   : UnityEngine.XR.ARFoundation.ARSession:Update() (at .\Library\PackageCache\com.unity.xr.arfoundation@5.0.7\Runtime\ARFoundation\ARSession.cs:416)
02-28 23:28:50.976  9999 10039 I Unity   :
(end log)

//LogCat
02-28 23:30:49.821: E/CRASH(10355): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
02-28 23:30:49.821: E/CRASH(10355): Version '2022.3.8f1 (b5eafc012955)', Build type 'Development', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
02-28 23:30:49.821: E/CRASH(10355): Build fingerprint: 'google/sunfish/sunfish:13/TQ3A.230805.001.S1/10786265:user/release-keys'
02-28 23:30:49.821: E/CRASH(10355): Revision: 'MP1.0'
02-28 23:30:49.821: E/CRASH(10355): ABI: 'arm64'
02-28 23:30:49.821: E/CRASH(10355): Timestamp: 2024-02-28 23:30:49.821106506+0900
02-28 23:30:49.821: E/CRASH(10355): pid: 10355, tid: 10395, name: UnityMain  >>> edited.for.example.dev <<<
02-28 23:30:49.821: E/CRASH(10355): uid: 10682
02-28 23:30:49.821: E/CRASH(10355): signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr --------
02-28 23:30:49.821: E/CRASH(10355):     x0  b4000074607437e0  x1  ffffffffffffffff  x2  00000072e1606c90  x3  0000000000000010
02-28 23:30:49.821: E/CRASH(10355):     x4  0000000000000000  x5  0000000000000000  x6  7160735e71606d60  x7  7f7f7f7f7f7f7f7f
02-28 23:30:49.821: E/CRASH(10355):     x8  000000718685e99c  x9  00000071882b5d20  x10 0000000000058000  x11 0000000000000006
02-28 23:30:49.821: E/CRASH(10355):     x12 00000000c04c66b8  x13 000000000000014d  x14 00000072e1605850  x15 00000000066b3a4a
02-28 23:30:49.821: E/CRASH(10355):     x16 0000000000000001  x17 0000007608e4c10c  x18 00000000000b0000  x19 00000072e1606c90
02-28 23:30:49.821: E/CRASH(10355):     x20 b4000074409cec80  x21 ffffffffffffffff  x22 b400007370500f50  x23 b4000074409cec59
02-28 23:30:49.821: E/CRASH(10355):     x24 b4000074409cee80  x25 b4000074409c5840  x26 0000000000000001  x27 1fffffffffffffff
02-28 23:30:49.821: E/CRASH(10355):     x28 0000000000000002  x29 b400007370500f58
02-28 23:30:49.821: E/CRASH(10355):     lr  0000007187d26440  sp  00000072e1606c60  pc  000000718685e99c  pst 0000000060000000
02-28 23:30:49.821: E/CRASH(10355): backtrace:
02-28 23:30:49.821: E/CRASH(10355):       #00 pc 000000000078699c  /data/app/~~FddYQmr9voDfk3vw7kqVTQ==/com.google.ar.core-waP0Ni2NqhY_IQ6dt4FrtA==/base.apk (BuildId: 62d65095d6fd0cee751f9a1afa29a9d5)
02-28 23:30:50.151: E/CRASH(10355): Tombstone written to: /storage/emulated/0/Android/data/edited.for.example.dev/files/tombstone_01
02-28 23:30:50.151: E/CRASH(10355): Forwarding signal 4
02-28 23:30:50.151: A/libc(10355): Fatal signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 0x718685e99c in tid 10395 (UnityMain), pid 10355 (.salvo.mim2.dev)
02-28 23:30:50.573: A/DEBUG(10681): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
02-28 23:30:50.573: A/DEBUG(10681): Build fingerprint: 'google/sunfish/sunfish:13/TQ3A.230805.001.S1/10786265:user/release-keys'
02-28 23:30:50.573: A/DEBUG(10681): Revision: 'MP1.0'
02-28 23:30:50.573: A/DEBUG(10681): ABI: 'arm64'
02-28 23:30:50.573: A/DEBUG(10681): Timestamp: 2024-02-28 23:30:50.284466135+0900
02-28 23:30:50.573: A/DEBUG(10681): Process uptime: 86s
02-28 23:30:50.573: A/DEBUG(10681): Cmdline: edited.for.example.dev
02-28 23:30:50.573: A/DEBUG(10681): pid: 10355, tid: 10395, name: UnityMain  >>> edited.for.example.dev <<<
02-28 23:30:50.573: A/DEBUG(10681): uid: 10682
02-28 23:30:50.573: A/DEBUG(10681): signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 0x000000718685e99c
02-28 23:30:50.573: A/DEBUG(10681):     x0  b4000074607437e0  x1  ffffffffffffffff  x2  00000072e1606c90  x3  0000000000000010
02-28 23:30:50.573: A/DEBUG(10681):     x4  0000000000000000  x5  0000000000000000  x6  7160735e71606d60  x7  7f7f7f7f7f7f7f7f
02-28 23:30:50.573: A/DEBUG(10681):     x8  000000718685e99c  x9  00000071882b5d20  x10 0000000000058000  x11 0000000000000006
02-28 23:30:50.573: A/DEBUG(10681):     x12 00000000c04c66b8  x13 000000000000014d  x14 00000072e1605850  x15 00000000066b3a4a
02-28 23:30:50.573: A/DEBUG(10681):     x16 0000000000000001  x17 0000007608e4c10c  x18 00000000000b0000  x19 00000072e1606c90
02-28 23:30:50.573: A/DEBUG(10681):     x20 b4000074409cec80  x21 ffffffffffffffff  x22 b400007370500f50  x23 b4000074409cec59
02-28 23:30:50.573: A/DEBUG(10681):     x24 b4000074409cee80  x25 b4000074409c5840  x26 0000000000000001  x27 1fffffffffffffff
02-28 23:30:50.573: A/DEBUG(10681):     x28 0000000000000002  x29 b400007370500f58
02-28 23:30:50.573: A/DEBUG(10681):     lr  0000007187d26440  sp  00000072e1606c60  pc  000000718685e99c  pst 0000000060000000
02-28 23:30:50.573: A/DEBUG(10681): backtrace:
02-28 23:30:50.573: A/DEBUG(10681):       #00 pc 000000000078699c  /data/app/~~FddYQmr9voDfk3vw7kqVTQ==/com.google.ar.core-waP0Ni2NqhY_IQ6dt4FrtA==/base.apk!libarcore_c.so (offset 0xa06000) (BuildId: 62d65095d6fd0cee751f9a1afa29a9d5)
02-28 23:30:50.573: A/DEBUG(10681):       #01 pc 0000000001c4e43c  /data/app/~~FddYQmr9voDfk3vw7kqVTQ==/com.google.ar.core-waP0Ni2NqhY_IQ6dt4FrtA==/base.apk!libarcore_c.so (offset 0xa06000) (BuildId: 62d65095d6fd0cee751f9a1afa29a9d5)
02-28 23:30:50.573: A/DEBUG(10681):       #02 pc 0000000001c450b0  /data/app/~~FddYQmr9voDfk3vw7kqVTQ==/com.google.ar.core-waP0Ni2NqhY_IQ6dt4FrtA==/base.apk!libarcore_c.so (offset 0xa06000) (BuildId: 62d65095d6fd0cee751f9a1afa29a9d5)
02-28 23:30:50.573: A/DEBUG(10681):       #03 pc 0000000001c44cbc  /data/app/~~FddYQmr9voDfk3vw7kqVTQ==/com.google.ar.core-waP0Ni2NqhY_IQ6dt4FrtA==/base.apk!libarcore_c.so (offset 0xa06000) (BuildId: 62d65095d6fd0cee751f9a1afa29a9d5)
02-28 23:30:50.573: A/DEBUG(10681):       #04 pc 0000000001c453f4  /data/app/~~FddYQmr9voDfk3vw7kqVTQ==/com.google.ar.core-waP0Ni2NqhY_IQ6dt4FrtA==/base.apk!libarcore_c.so (offset 0xa06000) (BuildId: 62d65095d6fd0cee751f9a1afa29a9d5)
02-28 23:30:50.573: A/DEBUG(10681):       #05 pc 00000000016494a4  /data/app/~~FddYQmr9voDfk3vw7kqVTQ==/com.google.ar.core-waP0Ni2NqhY_IQ6dt4FrtA==/base.apk!libarcore_c.so (offset 0xa06000) (BuildId: 62d65095d6fd0cee751f9a1afa29a9d5)
02-28 23:30:50.573: A/DEBUG(10681):       #06 pc 0000000001644c74  /data/app/~~FddYQmr9voDfk3vw7kqVTQ==/com.google.ar.core-waP0Ni2NqhY_IQ6dt4FrtA==/base.apk!libarcore_c.so (offset 0xa06000) (BuildId: 62d65095d6fd0cee751f9a1afa29a9d5)
02-28 23:30:50.573: A/DEBUG(10681):       #07 pc 00000000014ec434  /data/app/~~FddYQmr9voDfk3vw7kqVTQ==/com.google.ar.core-waP0Ni2NqhY_IQ6dt4FrtA==/base.apk!libarcore_c.so (offset 0xa06000) (BuildId: 62d65095d6fd0cee751f9a1afa29a9d5)
02-28 23:30:50.573: A/DEBUG(10681):       #08 pc 00000000016fec0c  /data/app/~~FddYQmr9voDfk3vw7kqVTQ==/com.google.ar.core-waP0Ni2NqhY_IQ6dt4FrtA==/base.apk!libarcore_c.so (offset 0xa06000) (BuildId: 62d65095d6fd0cee751f9a1afa29a9d5)
02-28 23:30:50.573: A/DEBUG(10681):       #09 pc 00000000016fdeec  /data/app/~~FddYQmr9voDfk3vw7kqVTQ==/com.google.ar.core-waP0Ni2NqhY_IQ6dt4FrtA==/base.apk!libarcore_c.so (offset 0xa06000) (BuildId: 62d65095d6fd0cee751f9a1afa29a9d5)
02-28 23:30:50.573: A/DEBUG(10681):       #10 pc 00000000016fd738  /data/app/~~FddYQmr9voDfk3vw7kqVTQ==/com.google.ar.core-waP0Ni2NqhY_IQ6dt4FrtA==/base.apk!libarcore_c.so (offset 0xa06000) (BuildId: 62d65095d6fd0cee751f9a1afa29a9d5)
02-28 23:30:50.573: A/DEBUG(10681):       #11 pc 00000000016fd650  /data/app/~~FddYQmr9voDfk3vw7kqVTQ==/com.google.ar.core-waP0Ni2NqhY_IQ6dt4FrtA==/base.apk!libarcore_c.so (offset 0xa06000) (BuildId: 62d65095d6fd0cee751f9a1afa29a9d5)
02-28 23:30:50.573: A/DEBUG(10681):       #12 pc 000000000111c2f8  /data/app/~~FddYQmr9voDfk3vw7kqVTQ==/com.google.ar.core-waP0Ni2NqhY_IQ6dt4FrtA==/base.apk!libarcore_c.so (offset 0xa06000) (ArSession_resume+120) (BuildId: 62d65095d6fd0cee751f9a1afa29a9d5)
02-28 23:30:50.573: A/DEBUG(10681):       #13 pc 000000000002d13c  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libarpresto_api.so (BuildId: 6a05b5df45411615d86ce7c1f214afef)
02-28 23:30:50.573: A/DEBUG(10681):       #14 pc 0000000000029770  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libarpresto_api.so (ArPresto_setEnabled+120) (BuildId: 6a05b5df45411615d86ce7c1f214afef)
02-28 23:30:50.573: A/DEBUG(10681):       #15 pc 0000000000028728  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libUnityARCore.so (BuildId: 02c5e67188a7818ed8adc2fd7c09e683a8715fca)
02-28 23:30:50.573: A/DEBUG(10681):       #16 pc 0000000000026228  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libUnityARCore.so (BuildId: 02c5e67188a7818ed8adc2fd7c09e683a8715fca)
02-28 23:30:50.573: A/DEBUG(10681):       #17 pc 0000000000011274  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libUnityARCore.so (BuildId: 02c5e67188a7818ed8adc2fd7c09e683a8715fca)
02-28 23:30:50.573: A/DEBUG(10681):       #18 pc 0000000000032a38  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libUnityARCore.so (UnityARCore_session_update+368) (BuildId: 02c5e67188a7818ed8adc2fd7c09e683a8715fca)
02-28 23:30:50.573: A/DEBUG(10681):       #19 pc 000000000a8f64fc  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libil2cpp.so (BuildId: 13bd64966f521868)
02-28 23:30:50.573: A/DEBUG(10681):       #20 pc 000000000a8f5c34  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libil2cpp.so (BuildId: 13bd64966f521868)
02-28 23:30:50.573: A/DEBUG(10681):       #21 pc 000000000aaffde4  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libil2cpp.so (BuildId: 13bd64966f521868)
02-28 23:30:50.573: A/DEBUG(10681):       #22 pc 000000000a9fa7e0  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libil2cpp.so (BuildId: 13bd64966f521868)
02-28 23:30:50.573: A/DEBUG(10681):       #23 pc 000000000bf688a8  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libil2cpp.so (BuildId: 13bd64966f521868)
02-28 23:30:50.573: A/DEBUG(10681):       #24 pc 000000000bf687f4  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libil2cpp.so (BuildId: 13bd64966f521868)
02-28 23:30:50.573: A/DEBUG(10681):       #25 pc 00000000007fa228  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libunity.so (scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool)+176) (BuildId: aaa7ec69d561fd0b)
02-28 23:30:50.573: A/DEBUG(10681):       #26 pc 000000000080c6d4  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libunity.so (ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool)+156) (BuildId: aaa7ec69d561fd0b)
02-28 23:30:50.573: A/DEBUG(10681):       #27 pc 000000000081c460  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libunity.so (MonoBehaviour::CallUpdateMethod(int)+248) (BuildId: aaa7ec69d561fd0b)
02-28 23:30:50.573: A/DEBUG(10681):       #28 pc 0000000000572644  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libunity.so (void BaseBehaviourManager::CommonUpdate<BehaviourManager>()+92) (BuildId: aaa7ec69d561fd0b)
02-28 23:30:50.573: A/DEBUG(10681):       #29 pc 00000000005725d4  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libunity.so (BehaviourManager::Update()+32) (BuildId: aaa7ec69d561fd0b)
02-28 23:30:50.573: A/DEBUG(10681):       #30 pc 0000000000673d5c  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libunity.so (BuildId: aaa7ec69d561fd0b)
02-28 23:30:50.573: A/DEBUG(10681):       #31 pc 0000000000666c44  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libunity.so (ExecutePlayerLoop(NativePlayerLoopSystem*)+92) (BuildId: aaa7ec69d561fd0b)
02-28 23:30:50.573: A/DEBUG(10681):       #32 pc 0000000000666c84  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libunity.so (ExecutePlayerLoop(NativePlayerLoopSystem*)+156) (BuildId: aaa7ec69d561fd0b)
02-28 23:30:50.573: A/DEBUG(10681):       #33 pc 0000000000666f7c  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libunity.so (PlayerLoop()+324) (BuildId: aaa7ec69d561fd0b)
02-28 23:30:50.573: A/DEBUG(10681):       #34 pc 00000000008bd6a0  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libunity.so (UnityPlayerLoop()+812) (BuildId: aaa7ec69d561fd0b)
02-28 23:30:50.573: A/DEBUG(10681):       #35 pc 00000000008e14a8  /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/lib/arm64/libunity.so (nativeRender(_JNIEnv*, _jobject*)+84) (BuildId: aaa7ec69d561fd0b)
02-28 23:30:50.573: A/DEBUG(10681):       #36 pc 0000000000461554  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+148) (BuildId: 289d75599f6112d5757113220599e90b)
02-28 23:30:50.573: A/DEBUG(10681):       #37 pc 000000000020a2b0  /apex/com.android.art/lib64/libart.so (nterp_helper+4016) (BuildId: 289d75599f6112d5757113220599e90b)
02-28 23:30:50.573: A/DEBUG(10681):       #38 pc 000000000026f178  [anon:dalvik-classes.dex extracted in memory from /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/base.apk] (com.unity3d.player.UnityPlayer.-$$Nest$mnativeRender+0)
02-28 23:30:50.573: A/DEBUG(10681):       #39 pc 000000000200e1f0  /memfd:jit-cache (deleted) (offset 0x2000000) (com.unity3d.player.UnityPlayer$C$a.handleMessage+912)
02-28 23:30:50.573: A/DEBUG(10681):       #40 pc 000000000200a090  /memfd:jit-cache (deleted) (offset 0x2000000) (android.os.Handler.dispatchMessage+208)
02-28 23:30:50.573: A/DEBUG(10681):       #41 pc 000000000200c1c4  /memfd:jit-cache (deleted) (offset 0x2000000) (android.os.Looper.loopOnce+1444)
02-28 23:30:50.573: A/DEBUG(10681):       #42 pc 0000000000209a9c  /apex/com.android.art/lib64/libart.so (nterp_helper+1948) (BuildId: 289d75599f6112d5757113220599e90b)
02-28 23:30:50.573: A/DEBUG(10681):       #43 pc 000000000049939a  /system/framework/framework.jar (android.os.Looper.loop+162)
02-28 23:30:50.573: A/DEBUG(10681):       #44 pc 0000000000209334  /apex/com.android.art/lib64/libart.so (nterp_helper+52) (BuildId: 289d75599f6112d5757113220599e90b)
02-28 23:30:50.573: A/DEBUG(10681):       #45 pc 000000000026e640  [anon:dalvik-classes.dex extracted in memory from /data/app/~~qSFDty9Kri45Cl6GcS87tw==/edited.for.example.dev-h-Rl_Te05wWTZJeVU818Wg==/base.apk] (com.unity3d.player.UnityPlayer$C.run+48)
02-28 23:30:50.573: A/DEBUG(10681):       #46 pc 0000000000457b6c  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+556) (BuildId: 289d75599f6112d5757113220599e90b)
02-28 23:30:50.573: A/DEBUG(10681):       #47 pc 0000000000484e54  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+156) (BuildId: 289d75599f6112d5757113220599e90b)
02-28 23:30:50.573: A/DEBUG(10681):       #48 pc 0000000000484b20  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValues<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*)+400) (BuildId: 289d75599f6112d5757113220599e90b)
02-28 23:30:50.573: A/DEBUG(10681):       #49 pc 00000000005ce334  /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallback(void*)+1684) (BuildId: 289d75599f6112d5757113220599e90b)
02-28 23:30:50.573: A/DEBUG(10681):       #50 pc 00000000000b63b0  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: 4e07915368c859b1910c68c84a8de75f)
02-28 23:30:50.573: A/DEBUG(10681):       #51 pc 00000000000530b8  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 4e07915368c859b1910c68c84a8de75f)
02-28 23:30:50.600: E/tombstoned(901): Tombstone written to: tombstone_18
andyb-unity commented 8 months ago

Hi @salvo-tchou,

This looks like a very well-formed bug report, however, our GitHub issues are unofficial. Please officially report this issue and provide the bug number so we can open an investigation: https://unity3d.com/unity/qa/bug-reporting

mike-copley commented 8 months ago

Hi @salvo-tchou,

One thing to note is that the AR Foundation package versions 5.0.x are no longer actively supported. The current supported and released version for the 5.x series is 5.1.2. I would recommend that you try to reproduce your issue with that version first.

If you are still able to reproduce this crash with AR Foundation 5.1.2, then the next step would be to try and reproduce it with the 5.1 samples. Perhaps modify the "Basic Image Tracking" sample to invoke code that is leading to the crash after the image tracking executes properly.

If the crash happens with the samples themselves, then definitely file the bug as Andy has suggested in the post above.

andyb-unity commented 8 months ago

I am closing this issue due to inactivity. Note our repo README:

To report a bug in AR Foundation, please file a bug. You may also submit a GitHub issue, but we will close your GitHub issue if it does not contain an official bug ID number. The best way to ensure that your issue is addressed is to file a bug using Unity's official bug reporting process.

Feel free to open a new issue with a bug report attached.

alexandrefresnais commented 5 months ago

Hey @salvo-tchou ,

Did you end up finding any solution or making a bug report ?

Just got the same problem. Tried many many things to cleanup the ARTrackedImageManager correctly but nothing would do. Though that waiting for end of frame after disabling the component would do, but no.

The only thing I got working is doing arSession.Reset() before switching camera, which is an ok thing to do in my use case.