Search Unity

Bug Oculus SDK Crashes when OpenXR is the xr back-end and oculus xr feature is enabled without headset

Discussion in 'VR' started by ertanturan, Jan 17, 2023.

  1. ertanturan

    ertanturan

    Joined:
    Nov 19, 2016
    Posts:
    28
    So yeah, if you don't have any headset connected and you set your xr back-end to OpenXR and enable the OculusXR feature Unity crashes.

    steps to reproduce.

    1. add oculus sdk and package and xr package from package manager. (I'm also using the sdk integration from assetstore)
    2. add oculus camera rig to an empty scene.
    3. set xr back-end to OpenXR
    4. Enable OculusXR feature
    5. Disconnect your headset from your pc/laptop
    6. start the scene it should crash

    added crash reports
     

    Attached Files:

    Jimbo_Slice likes this.
  2. glenneroo

    glenneroo

    Joined:
    Oct 27, 2016
    Posts:
    231
    You should file a bug report.
     
  3. Tanya_Li

    Tanya_Li

    Unity Technologies

    Joined:
    Jun 29, 2020
    Posts:
    105
    We also observed this issue lately and reported it to Meta team. This failure mostly happen when the headset is disconnected and also if the oculus link is not started during initialization. According to the responses from Meta this issue would be fixed in the next SDK release.
     
  4. ertanturan

    ertanturan

    Joined:
    Nov 19, 2016
    Posts:
    28

    Thank you for the info ! is there any link that we can track the progress ?
     
    Jimbo_Slice likes this.
  5. ertanturan

    ertanturan

    Joined:
    Nov 19, 2016
    Posts:
    28

    Hello Tanya Li,

    The Oculus plugin was just updated yesterday and I've updated every package in my project to their latest version. The problem kind of stil persists. If I start my project with no headset connected Unity is crashing. And if I take the cable off during a session and plug it back and re-enable the link from the headset Unity editor stops playing instead of continuing the session.

    Can you please confirm that you guys actually reported the issue to the Meta team and confirm if they've solved the issue ? I couldn't see anything in the changelog regarding this issue.

    Any info would be appreciated

    Thanks !
     
  6. ertanturan

    ertanturan

    Joined:
    Nov 19, 2016
    Posts:
    28
    Sometimes I'm receiving this error when I disconnect the headset and re-connect it back... and it crashes Unity without logs
     

    Attached Files:

    Last edited: Feb 8, 2023
  7. ertanturan

    ertanturan

    Joined:
    Nov 19, 2016
    Posts:
    28
    Alternatively you can enable both openXr and Oculus xr back-ends along with "metaXR feature" and hit play to reproduce the crash
     
  8. ertanturan

    ertanturan

    Joined:
    Nov 19, 2016
    Posts:
    28
    Still happening even with the newest oculus sdk. Looks like the new issues are caused by unity xr plugin and openxr plugin.
     
  9. Tanya_Li

    Tanya_Li

    Unity Technologies

    Joined:
    Jun 29, 2020
    Posts:
    105
    glenneroo likes this.
  10. krzys_h

    krzys_h

    Joined:
    Jun 23, 2013
    Posts:
    3
    V50 was released on 15th of March (which was "next week or so" after the previous post) including the following in the release notes, but it seems like it did not fix the issue.

    It seems like it did change the issue though - instead of crashing during OpenXR initialization, it now crashes while trying to deinitialize it after it fails because of the disconnected HMD.

    Before (V47 is the one I had installed I think? It matches the log from the initial post in this thread):
    Code (csharp):
    1. =================================================================
    2.     Managed Stacktrace:
    3. =================================================================
    4.       at <unknown> <0xffffffff>
    5.       at UnityEngine.SubsystemDescriptorBindings:Create <0x00089>
    6.       at UnityEngine.IntegratedSubsystemDescriptor`1:Create <0x0002a>
    7.       at UnityEngine.IntegratedSubsystemDescriptor`1:CreateImpl <0x0001a>
    8.       at UnityEngine.IntegratedSubsystemDescriptor:UnityEngine.ISubsystemDescriptor.Create <0x00017>
    9.       at UnityEngine.XR.Management.XRLoaderHelper:CreateSubsystem <0x00178>
    10.       at UnityEngine.XR.OpenXR.OpenXRLoaderBase:CreateSubsystem <0x0004a>
    11.       at UnityEngine.XR.OpenXR.OpenXRLoaderBase:CreateSubsystems <0x00062>
    12.       at UnityEngine.XR.OpenXR.OpenXRLoaderBase:InitializeInternal <0x0054a>
    13.       at UnityEngine.XR.OpenXR.OpenXRLoaderBase:Initialize <0x000e2>
    14.       at UnityEngine.XR.Management.XRManagerSettings:InitializeLoaderSync <0x000d6>
    15.       at UnityEngine.XR.Management.XRGeneralSettings:InitXRSDK <0x00112>
    16.       at UnityEngine.XR.Management.XRGeneralSettings:AttemptInitializeXRSDKOnLoad <0x00052>
    17.       at System.Object:runtime_invoke_void <0x00084>
    18. =================================================================
    After (V50):
    Code (csharp):
    1. =================================================================
    2.     Managed Stacktrace:
    3. =================================================================
    4.       at <unknown> <0xffffffff>
    5.       at UnityEngine.XR.OpenXR.OpenXRLoaderBase:Internal_PumpMessageLoop <0x00086>
    6.       at UnityEngine.XR.OpenXR.OpenXRLoaderBase:ProcessOpenXRMessageLoop <0x000a2>
    7.       at UnityEngine.XR.OpenXR.OpenXRLoaderBase:Deinitialize <0x0010a>
    8.       at UnityEngine.XR.OpenXR.OpenXRLoaderBase:Initialize <0x00151>
    9.       at UnityEngine.XR.Management.XRManagerSettings:InitializeLoaderSync <0x000d6>
    10.       at UnityEngine.XR.Management.XRGeneralSettings:InitXRSDK <0x00112>
    11.       at UnityEngine.XR.Management.XRGeneralSettings:AttemptInitializeXRSDKOnLoad <0x00052>
    12.       at System.Object:runtime_invoke_void <0x00084>
    13. =================================================================
    Also note that the same issue occurs in built players, which is a huge pain when trying to support both VR and non-VR scenarios in one build.
     
  11. ertanturan

    ertanturan

    Joined:
    Nov 19, 2016
    Posts:
    28
    Exactly same on my end. It didn't fix the issue but changed it. Also, now it doesn't crash if I start with a headset connected and disconnect it when my unity game is playing and reconnect it back instead it just stops playing Unity which is still not ideal. Anyway, the fight is still on. Hope they'll fix the error soon.
     
  12. BAM5

    BAM5

    Joined:
    Mar 22, 2023
    Posts:
    1
    I too have been having this issue, albeit with unreal.
    Whenever I disconnect the hmd the game will crash and my stack trace shows that it always happens with an external openxr call.
    I'm currently looking through the openxr standard to see if there's some way to retrieve HMD status to guard against calling these functions that crash when the HMD is disconnected.
     
  13. ThomasBERNARD33

    ThomasBERNARD33

    Joined:
    Apr 20, 2022
    Posts:
    15
    So we have to wait for V51 for a resolution...

    In the meantime, the quickest and dirtiest fix I found to use the editor without a VRHeadset plugged in is simply to change the editor "Play Mode OpenXR Runtime" from default to SteamVR.
    It is clearly stated that this change will only affect this instance of the editor and so it will need to be set at any launch.
    Once a VR headset is plugged in, I switch it back to default or Oculus...
    This is not ideal, but it is working for me.

    Temp solution more detailed :

    Project Settings / XR Plug-in Management / OpenXR
    Under the windows tab, change the "Play Mode OpenXR Runtime" from "System Default" or "Oculus OpenXR" to "SteamVR".
    Revert when you want to use your Oculus headset or simply use it though SteamVR until it's fixed.
     
    ertanturan likes this.
  14. ertanturan

    ertanturan

    Joined:
    Nov 19, 2016
    Posts:
    28
    The error is still same. V51 is out (not the sdk though just the oculus software)
    and here's the log which is same as @krzys_h's :

    =================================================================
    Managed Stacktrace:
    =================================================================
    at <unknown> <0xffffffff>
    at UnityEngine.XR.OpenXR.OpenXRLoaderBase:Internal_PumpMessageLoop <0x000cd>
    at UnityEngine.XR.OpenXR.OpenXRLoaderBase:processOpenXRMessageLoop <0x0023a>
    at UnityEngine.XR.OpenXR.OpenXRLoaderBase:Deinitialize <0x00392>
    at UnityEngine.XR.OpenXR.OpenXRLoaderBase:Initialize <0x0062b>
    at UnityEngine.XR.Management.XRManagerSettings:InitializeLoaderSync <0x003f2>
    at UnityEngine.XR.Management.XRGeneralSettings:InitXRSDK <0x0039a>
    at UnityEngine.XR.Management.XRGeneralSettings:AttemptInitializeXRSDKOnLoad <0x0019a>
    at System.Object:runtime_invoke_void <0x00184>
    =================================================================
     
  15. ertanturan

    ertanturan

    Joined:
    Nov 19, 2016
    Posts:
    28
    I'm quite sceptic about this issue being Oculus issue because all the errors are being thrown Unity's APIs and OpenXR's APIs. And Oculus is saying they're already using OpenXR... so maybe the errors are in Unity's and OpenXR's APIs ?
    @Tanya_Li ? Can you please confirm ?
     
  16. ThomasBERNARD33

    ThomasBERNARD33

    Joined:
    Apr 20, 2022
    Posts:
    15
    If you use steamVR with OpenXR, there is no issues at all.
    It's indeed connected to Oculus AND OpenXR but apparently, Oculus commented that they where aware of the issue and that they will fix it in V51. It's not cristal clear whether it will be fix in V51 sdk in the headset or in V51 sdk in the oculus integration..

    "We also observed this issue lately and reported it to Meta team. This failure mostly happen when the headset is disconnected and also if the oculus link is not started during initialization. According to the responses from Meta this issue would be fixed in the next SDK release." From Tanya_Li, Jan 17, 2023"
     
  17. ertanturan

    ertanturan

    Joined:
    Nov 19, 2016
    Posts:
    28
    @ThomasBERNARD33 saw your replies above about steamvr but I'm not planning to force my clients to use steamvr or any other mid-layer other than openxr. And I'm also aware of the response of the Tanya Li which you quoted.
    It's just that errors are coming from Unity APIs and OpenXR APIs so need confirmation to see if this is Oculus related or not.
     
    Last edited: Apr 20, 2023
  18. thep3000

    thep3000

    Unity Technologies

    Joined:
    Aug 9, 2013
    Posts:
    400
    We've repro'd this locally - we get the same stack trace in the log but when a debugger is attached we see:

    0000000000000000() Unknown
    OVRPlugin.dll!00007ff9c3a9e1e6() Unknown
    [Inline Frame] UnityOpenXR.dll!xrPollEvent(XrInstance_T * <args_0>, XrEventDataBuffer *) Line 166 C++
    [Inline Frame] UnityOpenXR.dll!TryReadNextEvent() Line 30 C++
    UnityOpenXR.dll!PollEvents() Line 73 C++


    We'll reach out to meta about this again.
     
    ertanturan likes this.
  19. ertanturan

    ertanturan

    Joined:
    Nov 19, 2016
    Posts:
    28
    @thep3000 can you please update us once the meta team responds to you guys ?
     
  20. ThomasBERNARD33

    ThomasBERNARD33

    Joined:
    Apr 20, 2022
    Posts:
    15
    V51 is out both on headset and in Oculus integration. Anybody tried it yet ? Does it fix the issue ?
     
  21. ertanturan

    ertanturan

    Joined:
    Nov 19, 2016
    Posts:
    28
    @ThomasBERNARD33 I've tried it this morning with v51 and the issue still persists...
     
  22. nprof50

    nprof50

    Joined:
    Jul 17, 2018
    Posts:
    2
    I am receiving the same crash resulting in the same stack trace @ertanturan's posted in comment #14. I have tried changing the OpenXR Loader to SteamVR for now, but it still crashes the editor when I enter play mode. Is there any update on this or temporary workaround?
     
    Last edited: May 2, 2023
  23. ThomasBERNARD33

    ThomasBERNARD33

    Joined:
    Apr 20, 2022
    Posts:
    15
    Hello guys,

    In the latest Oculus integration (V53.1) they mention this : upload_2023-5-22_15-32-6.png

    Has anybody tried it yet ? Does it fix anything ?
     
  24. gcook191996

    gcook191996

    Joined:
    Jan 23, 2019
    Posts:
    3
    Any updates on this?

    We're still having issues with this crashing our project.
     
  25. xw0

    xw0

    Joined:
    Apr 14, 2017
    Posts:
    1
    Please try to disable "Developer Runtime Features" in Oculus app, or switch to Oculus XR Plugin if you encounter a crash under "UnityOpenXR.dll!xrPollEvent".
     
  26. ertanturan

    ertanturan

    Joined:
    Nov 19, 2016
    Posts:
    28
    V54 of Oculus Integration and the issue is still there added the crash log.
     

    Attached Files:

  27. ertanturan

    ertanturan

    Joined:
    Nov 19, 2016
    Posts:
    28
    It's not applicable in my case because I want to use face/eye tracking with the openxr back-end at runtime.
     
  28. krzys_h

    krzys_h

    Joined:
    Jun 23, 2013
    Posts:
    3
    I do not have "Developer Runtime Features" enabled. The crash still happens.
     
  29. Sashell_

    Sashell_

    Joined:
    Jul 14, 2021
    Posts:
    19
    Hi, I've got the exact same problem. Also linked to this when trying to use quest link :
    upload_2023-6-13_12-3-18.png
     
  30. jazzbach

    jazzbach

    Joined:
    May 11, 2016
    Posts:
    41
    I was having the exact same issue today (I have Oculus Integration SDK 53.1 installed) and, the "ugly" way I was able to solve it temporarily was to connect the headset through Link Cable (I have an Oculus Quest 2) (this will open the Oculus PC app). At this point, you can either remove the headset or not, depending on what you're testing (in my case, I was testing something non VR related). Finally, you can test the project as usual by pressing the Unity play/stop button and Unity won't crash anymore :confused:
     
    Last edited: Jun 14, 2023
  31. Sashell_

    Sashell_

    Joined:
    Jul 14, 2021
    Posts:
    19
    Did you have OpenXR + Meta Xr features enabled ? Because on my message above, I've got an exception when trying to play on quest link with openXR.
     
  32. jazzbach

    jazzbach

    Joined:
    May 11, 2016
    Posts:
    41
    I had both enabled actually.

    By the way: Oculus Integration SDK 54.1 has just been released today and they are finally acknowledging this issue in the "Known Issues" section. It includes some workarounds:

    When using Unity OpenXR Plugin and have “Developer Runtime Features” enabled in the Oculus app, Unity editor might crash when starting the VR preview. The workarounds are (1) Switch to Oculus XR Plugin, or (2) Disable “Developer Runtime Features”, or (3) Start Quest Link before using play-in-editor.

    https://developer.oculus.com/downloads/package/unity-integration/54.1/
     
  33. Sashell_

    Sashell_

    Joined:
    Jul 14, 2021
    Posts:
    19
    Ok thanks. Since none of these solutions has worked for me, guess we just have to wait.
     
  34. ertanturan

    ertanturan

    Joined:
    Nov 19, 2016
    Posts:
    28
    @Sashell_ If you're initializing XR from one of your C# scripts disable that script. Enable "Initialize XR on Load" setting from project settings. Set your xr back-end to OpenXR and enable the MetaXR Features. Make sure you have the latest version of Oculus integration. And XR-Related packages.
    Worked for me hope it works for you.
     
  35. krzys_h

    krzys_h

    Joined:
    Jun 23, 2013
    Posts:
    3
    I just tested this again, and I'm very confused. Now, on V50, the crash always happens. On V51, the crash never happens. Changing the "Developer Runtime Features" toggle does nothing at all. I'm sure I tested V51 before and it always crashed, also independently from the developer toggle. Is the issue related not only to the Oculus Integration version in the project, but also to the installed Oculus runtime? It's kinda annoying, as V51 is the first version that doesn't support Quest 1, and I have no reason to drop Quest 1 support other than to fix this crash.