Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bug Unity app randomly freezes on Oculus

Discussion in 'VR' started by Dave458854, Feb 3, 2022.

  1. Dave458854

    Dave458854

    Joined:
    Jan 14, 2021
    Posts:
    13
    My problem is pretty simple - my app seemingly randomly freezes, with the screen no longer updating or following the headset, and the app having to be restarted (usually twice, for whatever reason).

    There are no unusual activity spikes preceding the cutout, although it does seem easiest to replicate when rapidly moving the headset around. It occurs both in scenes with lots of objects and scenes with hardly any.

    I have attempted to reduce texture sizes to nothing, decimate vertice counts, remove all non-standard shaders tweak all graphics settings I know to have an influence on performance and still nothing changes. The only way I could noticeably reduce the freezes is by activating low-overhead-mode, which comes with a whole heap of other graphical glitches instead.

    Unity doesn't output any errors, but here is the relevant part of the logs I collected through adb:

    Code (log):
    1. 01-20 13:11:46.985  7301  7368 W Telemetry: [OpenXR] space handle invalid;
    2. 01-20 13:11:46.985  7301  7368 E OVRPlugin: [XRCMD][failure] [XR_ERROR_HANDLE_INVALID]: xrEndFrame(m_xrSession, &frameEndInfo), arvr/projects/integrations/OVRPlugin/Src/Util/CompositorOpenXR.cpp:3554 (arvr/projects/integrations/OVRPlugin/Src\Util/CompositorOpenXR.h:122)
    3. 01-20 13:11:46.985  7301  7368 E Unity   : [XR] Unable to submit Oculus frame
    4. 01-20 13:11:46.986  7301  7368 W PhaseSync: [PS_Ver_1_0] DiscardFrame is triggered, frame->Stage 2 FrameBeginIndex 1868
    I'm using Unity 2021.2.10f (although the problem has been present with older versions, too)
    Oculus Integration 37.0
    XR Interaction Toolkit 2.0.0-pre6
    Oculus XR Plugin 3.0.0-pre4 (Same issue with the official release)

    Does anyone have any idea what might be the issue here?

    Edit: Oculus Quest (1 and 2) - since I didn't mention that anywhere
     
    Last edited: Feb 3, 2022
  2. glenneroo

    glenneroo

    Joined:
    Oct 27, 2016
    Posts:
    209
    Maybe a stupid question but did you check that you don't have infinite while/for loops anywhere? I always make sure to put a timer or some other way to break out of loops that might get stuck. It happens to me every once in awhile even though I know better. I even wrote a little blog post about it since it recently bit me:
    https://www.unitytips.org/2022/01/unity-is-mysteriously-freezing-or-locking-up/

    Otherwise, have you tried reproducing this with a completely empty project?
     
  3. Dave458854

    Dave458854

    Joined:
    Jan 14, 2021
    Posts:
    13
    No guess is too far out there for me not to consider it at this point, but it has never happened in the Editor and it tends to happen when nothing it's actually running CPU-wise (it's a utility app, not so much a game).

    It happens in all scenes of the project, and rebuilding the project from scratch hasn't helped, either.
     
  4. glenneroo

    glenneroo

    Joined:
    Oct 27, 2016
    Posts:
    209
    Maybe try connecting the Oculus Developer Hub and/or installing OVR Metrics overlay app and/or logging things like temperature, GPU usage, etc. to see if you can pinpoint what might be the cause.
     
  5. Dave458854

    Dave458854

    Joined:
    Jan 14, 2021
    Posts:
    13
    Done that, no unusual activity spikes in any of the metrics. The graphics sometimes glitch just before (the view jumping significantly for a frame or so), but nothing that shows up in the metrics (OVR Matrics app or Developer Hub)

    Edit: I tried recording a video of the glitches, but they don't appear on video, it seems to be a GPU-internal thing

    Edit2: I managed to record one of the more severe of the glitches
    ezgif-5-76527fca2d.gif
     
    Last edited: Feb 4, 2022
  6. Alex_the_Coder

    Alex_the_Coder

    Joined:
    Dec 3, 2018
    Posts:
    16
    Have you found a solution for your problem yet?
     
  7. unity_B6708DEFBABE67468AAE

    unity_B6708DEFBABE67468AAE

    Joined:
    Dec 16, 2021
    Posts:
    2
    any fix found for this?
     
  8. georg360

    georg360

    Joined:
    Jul 23, 2019
    Posts:
    1
    would be nice if someday someone finds a solution to this problem :)
     
  9. Alex_the_Coder

    Alex_the_Coder

    Joined:
    Dec 3, 2018
    Posts:
    16
    So for me the culprit was a sound plugin from the asset store. At certain times it loads in a lot of audioClips. This leads to limitations in memory / cpu usage. After implementing my own solution (significantly shrinking amount of clips & distributing loading over several frames) the freezes never occured again.