Search Unity

Resolved Crash in XRDisplaySubsystem Destroy on PlayMode Exit??

Discussion in 'XR Interaction Toolkit and Input' started by slippyfrog, Sep 22, 2021.

  1. slippyfrog

    slippyfrog

    Joined:
    Jan 18, 2016
    Posts:
    42
    I am getting a Unity crash on play mode exit.

    My project has been stable and fine for months and nothing drastic has changed that would result in this crash. The issue started presenting shortly after I upgraded my Quest 2 to v32. I am not sure if it is related but this is my only lead so far.

    I'm still in the process of narrowing it down and make sure it is not something on my end. Anyways, Unity crashes consistently 100% of the time on playmode exit .

    I'm using Unity 2021.1.19f and latest version of XRI and XRManager packages. Also using the Oculus Plugin XR Integration.

    From the stack dump, It looks to do with the DestroySubsystem of the XRDisplaySubsystem.

    I tried creating an empty project with just the action based player right and the crash presents.

    Just wondering if any one else has seen this recently or can point me the right direction. I've been scratching my head over this one.

    Thanks for any insight/help!



    Stacktrace:
    Code (CSharp):
    1.  
    2.   at <unknown> <0xffffffff>
    3.   at (wrapper managed-to-native) UnityEngine.SubsystemBindings.DestroySubsystem (intptr) [0x00007] in <d4316ef652ed4f7aaafcee08b080979e>:0
    4.   at UnityEngine.IntegratedSubsystem.Destroy () [0x00015] in <d4316ef652ed4f7aaafcee08b080979e>:0
    5.   at UnityEngine.XR.Management.XRLoaderHelper.DestroySubsystem<T_REF> () [0x00035] in C:\Users\frog\Dev\MyProject\Library\PackageCache\com.unity.xr.management@4.1.0\Runtime\XRLoaderHelper.cs:85
    6.   at Unity.XR.Oculus.OculusLoader.Deinitialize () [0x00005] in C:\Users\frog\Dev\MyProject\Library\PackageCache\com.unity.xr.oculus@1.10.0\Runtime\OculusLoader.cs:201
    7.   at UnityEngine.XR.Management.XRManagerSettings.DeinitializeLoader () [0x00027] in C:\Users\frog\Dev\MyProject\Library\PackageCache\com.unity.xr.management@4.1.0\Runtime\XRManagerSettings.cs:443
    8.   at UnityEngine.XR.Management.XRGeneralSettings.DeInitXRSDK () [0x00021] in C:\Users\frog\Dev\MyProject\Library\PackageCache\com.unity.xr.management@4.1.0\Runtime\XRGeneralSettings.cs:201
    9.   at UnityEngine.XR.Management.XRGeneralSettings.Quit () [0x00010] in C:\Users\frog\Dev\MyProject\Library\PackageCache\com.unity.xr.management@4.1.0\Runtime\XRGeneralSettings.cs:128
    10.   at UnityEngine.XR.Management.XRGeneralSettings.InternalPlayModeStateChanged (UnityEditor.PlayModeStateChange) [0x00008] in C:\Users\frog\Dev\MyProject\Library\PackageCache\com.unity.xr.management@4.1.0\Runtime\XRGeneralSettings.cs:112
    11.   at UnityEditor.XR.Management.XRGeneralSettingsPerBuildTarget.PlayModeStateChanged (UnityEditor.PlayModeStateChange) [0x00033] in C:\Users\frog\Dev\MyProject\Library\PackageCache\com.unity.xr.management@4.1.0\Editor\XRGeneralSettingsPerBuildTarget.cs:84
    12.   at (wrapper delegate-invoke) System.Action`1<UnityEditor.PlayModeStateChange>.invoke_void_T (UnityEditor.PlayModeStateChange) [0x00070] in <695d1cc93cca45069c528c15c9fdd749>:0
    13.   at UnityEditor.EditorApplication.Internal_PlayModeStateChanged (UnityEditor.PlayModeStateChange) [0x0001e] in <d04deee419f24e8faf312b86e53e3f07>:0
    14.   at (wrapper runtime-invoke) <Module>.runtime_invoke_void_int (object,intptr,intptr,intptr) [0x00022] in <d04deee419f24e8faf312b86e53e3f07>:0
    15.   at <unknown> <0xffffffff>
    16.   at (wrapper managed-to-native) UnityEditor.EditorApplication.set_isPlaying (bool) [0x00007] in <d04deee419f24e8faf312b86e53e3f07>:0
    17.   at UnityEditor.EditorApplication.ExitPlaymode () [0x00002] in <d04deee419f24e8faf312b86e53e3f07>:0
    18.   at UnityEditor.Toolbars.PlayModeButtons.OnPlayButtonValueChanged (UnityEngine.UIElements.ChangeEvent`1<bool>) [0x00016] in <937b2b5660994942a383daf774868ea5>:0
    19.   at UnityEngine.UIElements.EventCallbackFunctor`1<TEventType_REF>.Invoke (UnityEngine.UIElements.EventBase) [0x00057] in <3d389beb8fbc4cc99098812a324df20c>:0
    20.   at UnityEngine.UIElements.EventCallbackRegistry.InvokeCallbacks (UnityEngine.UIElements.EventBase) [0x00040] in <3d389beb8fbc4cc99098812a324df20c>:0
    21.   at UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase) [0x00054] in <3d389beb8fbc4cc99098812a324df20c>:0
    22.   at UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase) [0x0012f] in <3d389beb8fbc4cc99098812a324df20c>:0
    23.   at UnityEngine.UIElements.DefaultDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel) [0x00025] in <3d389beb8fbc4cc99098812a324df20c>:0
    24.   at UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel,bool) [0x00028] in <3d389beb8fbc4cc99098812a324df20c>:0
    25.   at UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel) [0x00047] in <3d389beb8fbc4cc99098812a324df20c>:0
    26.   at UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () [0x00039] in <3d389beb8fbc4cc99098812a324df20c>:0
    27.   at UnityEngine.UIElements.EventDispatcher.OpenGate () [0x0003c] in <3d389beb8fbc4cc99098812a324df20c>:0
    28.   at UnityEngine.UIElements.EventDispatcherGate.Dispose () [0x00007] in <3d389beb8fbc4cc99098812a324df20c>:0
    29.   at UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel) [0x0011a] in <3d389beb8fbc4cc99098812a324df20c>:0
    30.   at UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () [0x00039] in <3d389beb8fbc4cc99098812a324df20c>:0
    31.   at UnityEngine.UIElements.EventDispatcher.OpenGate () [0x0003c] in <3d389beb8fbc4cc99098812a324df20c>:0
    32.   at UnityEngine.UIElements.EventDispatcherGate.Dispose () [0x00007] in <3d389beb8fbc4cc99098812a324df20c>:0
    33.   at UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel) [0x0011a] in <3d389beb8fbc4cc99098812a324df20c>:0
    34.   at UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.IPanel,UnityEngine.UIElements.DispatchMode) [0x00049] in <3d389beb8fbc4cc99098812a324df20c>:0
    35.   at UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase,UnityEngine.UIElements.DispatchMode) [0x0001f] in <3d389beb8fbc4cc99098812a324df20c>:0
    36.   at UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel) [0x000e3] in <3d389beb8fbc4cc99098812a324df20c>:0
    37.   at UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (int,intptr,bool&) [0x0003f] in <3d389beb8fbc4cc99098812a324df20c>:0
    38.   at UnityEngine.UIElements.UIEventRegistration.ProcessEvent (int,intptr) [0x0001f] in <3d389beb8fbc4cc99098812a324df20c>:0
    39.   at UnityEngine.UIElements.UIEventRegistration/<>c.<.cctor>b__1_2 (int,intptr) [0x00003] in <3d389beb8fbc4cc99098812a324df20c>:0
    40.   at UnityEngine.GUIUtility.ProcessEvent (int,intptr,bool&) [0x00018] in <8993825ca73141f8999b26a750e0f11a>:0
    41.   at (wrapper runtime-invoke) <Module>.runtime_invoke_void_int_intptr_intptr& (object,intptr,intptr,intptr) [0x0002d] in <8993825ca73141f8999b26a750e0f11a>:0
    42. =================================================================
    43. Got a SIGSEGV while executing native code. This usually indicates
    44. a fatal error in the mono runtime or one of the native libraries
    45. used by your application.
    46. =================================================================
    47. Received signal SIGSEGV
    48. Stack trace:
     
    Last edited: Sep 22, 2021
  2. slippyfrog

    slippyfrog

    Joined:
    Jan 18, 2016
    Posts:
    42
    Okay, problem solved (at least for my particular instance). Here are my finding, just in case someone runs into a similar issue.

    So I have integrated XR Plugin Manager with the Oculus Plugin and also the XR Interaction Toolkit. Separately, I have also integrated a portion of the Oculus Integration Asset. The Oculus Plugin was required to access the OVRPassthroughLayer that was introduced in v31 update the the Quest) as discussed here:
    https://forum.unity.com/threads/ocu...sthrough-mode-api-via-xr-integration.1163992/

    While initially working fine, this seems to have cause issue I was observing over time. Deleting the Oculus folder that was installed when the Oculus Integration Asset was imported solved the issue and the Unity no longer crashes on exit of play mode. I was able to reinstall the Oculus Integration Asset after and everything seems to work fine again.

    Updated:
    There is a bug filed for this one here:
    https://issuetracker.unity3d.com/is...hen-entering-play-mode-with-oculus-quest-link
     
    Last edited: Sep 23, 2021
  3. skidvis

    skidvis

    Joined:
    Jun 3, 2017
    Posts:
    18
    Here's a video on how to fix it: