Shutdown exception [SOLVED] — Oculus
New to the forums? Click here to read the "How To" Guide.

Developer? Click here to go to the Developer Forums.

Shutdown exception [SOLVED]

JoshKlintJoshKlint Posts: 9
edited February 2015 in Support
After rendering in direct mode, I get this error when my application closes:
"Unhandled exception at 0x59CF6691 (OVRDisplay32.dll) in OculusVR.exe: 0xC0000005: Access violation reading location 0xFEEEFEFB."
Visual Studio won't display the callstack because it can't find a missing PDB file for the Oculus library.

I also get these warnings in the output:
****************
ERROR: RT Shim being unloaded before all references reached 0!
This can be indicative of calling FreeLibrary directly without
checking DllCanUnloadNow() first, or it could be a leaked reference
at process exit.

Outstanding references:
OVRDirect3D9Ex: 0
OVRDirect3DDevice9Ex: 0
OVRDXGIAdapter: 6
OVRDXGIFactory: 6
OVRDXGISwapChain: 6
****************

DXGI WARNING: Process is terminating. Using simple reporting. Please call ReportLiveObjects() at runtime for standard reporting. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Producer at 0x0464EF40, Refcount: 5. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object at 0x005F4A78, Refcount: 2. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object : 1 [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Producer at 0x062A1DC8, Refcount: 5. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object at 0x062A4740, Refcount: 2. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object : 1 [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Producer at 0x063EFC48, Refcount: 5. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object at 0x063F25C0, Refcount: 2. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object : 1 [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Producer at 0x07A98280, Refcount: 5. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object at 0x07A9AB80, Refcount: 2. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object : 1 [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Producer at 0x098FC7E0, Refcount: 7. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object at 0x098F45D8, Refcount: 2. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object : 1 [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Producer at 0x09C29B28, Refcount: 5. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object at 0x09C2C418, Refcount: 2. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object : 1 [ STATE_CREATION WARNING #0: ]
First-chance exception at 0x59E46691 (OVRDisplay32.dll) in OculusVR.debug.exe: 0xC0000005: Access violation reading location 0xFEEEFEFB.
Unhandled exception at 0x59E46691 (OVRDisplay32.dll) in OculusVR.debug.exe: 0xC0000005: Access violation reading location 0xFEEEFEFB.

The program '[2956] OculusVR.debug.exe' has exited with code 0 (0x0).
The HMD is deleted, then ovr_Shutdown() is called, then the program exits and the crash occurs.
  • Windows 7 64-bit
  • NVidia GEForce 780
  • Visual Studio 2013 for C++
  • OpenGL 4
All it takes to produce the problem is the creation of a rendering context and a call to ovr_CreateHMD() in between the intialize and shutdown functions.

Comments

  • The problem occurs with both SDK 0.4.3 and 0.4.2.

    If I run the OculusWorldDemo sample on Windows and use OpenGL rendering, Visual Studio prints out the following error messages, but it runs correctly without encountering an exception:
    ****************
    ERROR: RT Shim being unloaded before all references reached 0!
    This can be indicative of calling FreeLibrary directly without
    checking DllCanUnloadNow() first, or it could be a leaked reference
    at process exit.

    Outstanding references:
    OVRDirect3D9Ex: 0
    OVRDirect3DDevice9Ex: 0
    OVRDXGIAdapter: 4
    OVRDXGIFactory: 4
    OVRDXGISwapChain: 4
    ****************

    DXGI WARNING: Process is terminating. Using simple reporting. Please call ReportLiveObjects() at runtime for standard reporting. [ STATE_CREATION WARNING #0: ]
    DXGI WARNING: Live Producer at 0x0089BA20, Refcount: 5. [ STATE_CREATION WARNING #0: ]
    DXGI WARNING: Live Object at 0x0089E528, Refcount: 2. [ STATE_CREATION WARNING #0: ]
    DXGI WARNING: Live Object : 1 [ STATE_CREATION WARNING #0: ]
    DXGI WARNING: Live Producer at 0x02DEF558, Refcount: 5. [ STATE_CREATION WARNING #0: ]
    DXGI WARNING: Live Object at 0x02DF1ED0, Refcount: 2. [ STATE_CREATION WARNING #0: ]
    DXGI WARNING: Live Object : 1 [ STATE_CREATION WARNING #0: ]
    DXGI WARNING: Live Producer at 0x05289FF8, Refcount: 7. [ STATE_CREATION WARNING #0: ]
    DXGI WARNING: Live Object at 0x0528C998, Refcount: 2. [ STATE_CREATION WARNING #0: ]
    DXGI WARNING: Live Object : 1 [ STATE_CREATION WARNING #0: ]
    DXGI WARNING: Live Producer at 0x07873740, Refcount: 5. [ STATE_CREATION WARNING #0: ]
    DXGI WARNING: Live Object at 0x078760B8, Refcount: 2. [ STATE_CREATION WARNING #0: ]
    DXGI WARNING: Live Object : 1 [ STATE_CREATION WARNING #0: ]
    The program '[4068] OculusWorldDemo.exe' has exited with code 0 (0x0).
  • I was able to avoid the exception by deleting all program windows before exiting the program. Our application uses a hidden window for shared OpenGL resources. The order relative to the ovr_Shutdown command does not seem to matter.
  • Could you elaborate a bit further on that? With program windows you mean windows with an associated OpenGL context in them? Why do you say the order with respect to ovr_Shutdown doesn't matter (when it clearly does, you have to close windows first).

    I have the same exception at shutdown (only) in a project where we are also using OpenCL. Maybe close that down before the Rift...

    But in every project we have the com errors and RT Shim warnings (just not the exception).

    Thanks, Daniel
  • Ok, a proper cleanup of OpenCL before the ovr_Destroy() helps getting rid of that exception.
    Still the _com_errors at window creation and RT_shim warnings at program closure though.
  • Hi,
    I am facing the same issue, no matter where i call ovr_Shutdown(), my application crashes on close.
    Should i just assume the current implementation of ovr_Shutdown() is broken (0.4.4) and carry on until the next SDK release ?

    BTW, it crashes in .\LibOVR\Src\Displays\OVR_Win32_RenderShim.cpp, line 349 :
    if( !needShim )
        return (*oldProcExW)( lpLibFileName, hFile, dwFlags );
    

    0xC0000005: Access violation executing location 0x00000000.

    Note : I am not even rendering anything in the rift yet, just getting it's position with ovrHmd_GetTrackingState().
  • cyberealitycybereality Posts: 26,156 Oculus Staff
    Did you make sure to call ovrHmd_BeginFrameTiming first?
    frameTiming = ovrHmd_BeginFrameTiming(hmd, 0); 
    ovrTrackingState ts = ovrHmd_GetTrackingState(hmd, frameTiming.ScanoutMidpointSeconds);
    
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i
    Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
Sign In or Register to comment.