kotlin-graphics / openvr

OpenVR SDK
http://steamvr.com
BSD 3-Clause "New" or "Revised" License
37 stars 0 forks source link

CreateOverlay causes EXCEPTION_ACCESS_VIOLATION #3

Open listvin opened 5 years ago

listvin commented 5 years ago

Hello, Giuseppe

Quite a long time I have been struggling with mentioned error. I'm running Windows 10 x64, HTC Vive, nvidia 1070 and amd fx-8320.

Following code:

import openvr.lib.*
import java.nio.LongBuffer

fun main() {
    println("java ${System.getProperty("java.version")} ${System.getProperty("sun.arch.data.model")}bit")
    println(vr.isHmdPresent)
    println(vr.isRuntimeInstalled)
    println(vr.runtimePath)

    val ivr = vr.init(VRApplication.Overlay)
    println("ivr error code: $ivr")

    println("vrOverlay.isInterfaceVersionValid = ${vrOverlay.isInterfaceVersionValid}")

    val testOverlayHandle = VROverlayHandleBuffer.allocate(1).also {
        println(it.limit())
        vrOverlay.createOverlay("test:overlay", "test overlay", it) // <- access violation
//        vrOverlay.createDashboardOverlay("test:overlay", "test dashboard overlay", it, LongBuffer.allocate(1)) // <- no exception produced here
    }.get(0)

    vrOverlay.setOverlayFromFile(testOverlayHandle, "duck.png")
    vrOverlay showOverlay testOverlayHandle

    Thread.sleep(2000)

    vrOverlay hideOverlay testOverlayHandle
    vrOverlay destroyOverlay testOverlayHandle

    vr.shutdown()
}

Produces output:

java 1.8.0_221 32bit
true
true
C:\Program Files (x86)\Steam\steamapps\common\SteamVR
ivr error code: None
vrOverlay.isInterfaceVersionValid = true
1
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x15d6efe6, pid=15344, tid=0x0000429c
#
# JRE version: Java(TM) SE Runtime Environment (8.0_221-b11) (build 1.8.0_221-b11)
# Java VM: Java HotSpot(TM) Client VM (25.221-b11 mixed mode windows-x86 )
# Problematic frame:
# C  [vrclient.dll+0x8efe6]
#
# Core dump written. Default location: C:\Workspace\cyber-timer\hs_err_pid15344.mdmp
#
# An error report file with more information is saved as:
# C:\Workspace\cyber-timer\hs_err_pid15344.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

Process finished with exit code 1

Have tried also under Java 11 x64 both 1.2.10 release and cbc252e with about the same result (but pc like 0x7ffc########). Seems magical to me that createDashboardOverlay doesn't cause any errors.

Attaching Visual Studio to native code shown access violation with pc=0x00000000, can it be a null pointer? PDB file for vrclient.dll isn't available hence I don't see any further options for native debug. hs_err_pid15344.mdmp and hs_err_pid15344.log

SteamVR is 1.6.10, though I expect it to be backward-compatible, declarations of CreateOverlay are similar in openvr.h of 1.2.10 and of 1.6.10. I'd like to try older versions of SteamVR, but I don't see an obvious way of safe downgrade.

P.S. helloVr_OpenGL works as a charm with my setup and SteamVR 1.6.10.

-- Regards, Fedor

elect86 commented 5 years ago

Hi Fedor,

let me update a couple of things (lwjgl and kotlin the most important) and then I'll try to replicate the crash

I'll let you know