LWJGL / lwjgl3

LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan, bgfx), audio (OpenAL, Opus), parallel computing (OpenCL, CUDA) and XR (OpenVR, LibOVR, OpenXR) applications.
https://www.lwjgl.org
BSD 3-Clause "New" or "Revised" License
4.67k stars 631 forks source link

GLFW.glfwInit segfaults when running with java temurin 19 #804

Closed LapisSea closed 1 year ago

LapisSea commented 1 year ago

Version

3.3.1

Platform

Windows x64

JDK

temurin 19

Module

GLFW

Bug description

When running with java 19 in debug mode, calling GLFW.glfwInit(); crashes the JVM. The crash does not happen and everything is functioning correctly when not debugging.

Steps I have taken to create this:

  1. Create an empty maven project in intellij
  2. Set maven.compiler.target and maven.compiler.source to 19
  3. Paste minimal opengl dependencies
  4. run with debug:
    public static void main(String[] args){
    GLFW.glfwInit();
    }

Stacktrace or crash log output

Connected to the target VM, address: '127.0.0.1:57952', transport: 'socket'
[LWJGL] [ThreadLocalUtil] Unsupported JNI version detected, this may result in a crash. Please inform LWJGL developers.
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff872b76b28, pid=30472, tid=31440
#
# JRE version: OpenJDK Runtime Environment Temurin-19+36-RC1(beta) (19.0+36) (build 19-beta+36-pre)
# Java VM: OpenJDK 64-Bit Server VM Temurin-19+36-RC1(beta) (19-beta+36-pre, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# Problematic frame:
# C  [jdwp.dll+0x26b28]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\...\hs_err_pid30472.log
#
# If you would like to submit a bug report, please visit:
#   https://github.com/adoptium/adoptium-support/issues
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Disconnected from the target VM, address: '127.0.0.1:57952', transport: 'socket'

Process finished with exit code 1
TheMrMilchmann commented 1 year ago

This is probably already fixed by #799 which should be available in the next snapshot.

The crash does not happen and everything is functioning correctly when not debugging.

I can't think of any reason why this would only happen in debug mode though.

Spasi commented 1 year ago

LWJGL 3.3.2 snapshot 3 is now available and works on JDK 19.

gudenau commented 1 year ago

This is probably already fixed by #799 which should be available in the next snapshot.

The crash does not happen and everything is functioning correctly when not debugging.

I can't think of any reason why this would only happen in debug mode though.

The debugger probably uses the new function, otherwise it wouldn't be called.