SpaiR / imgui-java

JNI based binding for Dear ImGui
MIT License
547 stars 90 forks source link

Bug: crash when debugging with JDK 21 #201

Closed phraktle closed 9 months ago

phraktle commented 9 months ago

Version

1.86.10

What happened?

segfault when running in debug mode.

Note that normal mode works, with the following warning (can't say I have not been warned :)

[LWJGL] [ThreadLocalUtil] Unsupported JNI version detected, this may result in a crash. Please inform LWJGL developers.

Reproduction

Launch imgui in debug mode with JDK 21 (under Eclipse).

Relevant log output

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007ff824bfabf7, pid=59056, tid=259
#
# JRE version: OpenJDK Runtime Environment Zulu21.28+85-CA (21.0+35) (build 21+35)
# Java VM: OpenJDK 64-Bit Server VM Zulu21.28+85-CA (21+35, mixed mode, sharing, tiered, compressed class ptrs, z gc, bsd-amd64)
# Problematic frame:
# C  0x00007ff824bfabf7
#

---------------  S U M M A R Y ------------

Command Line: -XX:+ShowCodeDetailsInExceptionMessages -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:52847 -XX:+UseZGC -javaagent:/Applications/Eclipse Java.app/Contents/Eclipse/configuration/org.eclipse.osgi/2112/0/.cp/lib/javaagent-shaded.jar -Dfile.encoding=UTF-8 -Dstdout.encoding=UTF-8 -Dstderr.encoding=UTF-8 simlis.arbert.gui.AccountGui /Users/phraktle/dev/arbert/etc/phtest-credentials.json

Host: "MacBookPro13,3" x86_64 2700 MHz, 8 cores, 16G, Darwin 21.6.0, macOS 12.6.9 (21G726)
Time: Thu Sep 21 15:57:11 2023 CEST elapsed time: 3.489185 seconds (0d 0h 0m 3s)

---------------  T H R E A D  ---------------

Current thread (0x00007fcc9200b000):  JavaThread "main"             [_thread_in_native, id=259, stack(0x00007ff7b3e91000,0x00007ff7b4691000) (8192K)]

Stack: [0x00007ff7b3e91000,0x00007ff7b4691000],  sp=0x00007ff7b4689798,  free space=8161k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  0x00007ff824bfabf7
C  [libjdwp.dylib+0x1828a]  cbClassPrepare+0xba
V  [libjvm.dylib+0x78ae80]  JvmtiExport::post_class_prepare(JavaThread*, Klass*)+0x360
V  [libjvm.dylib+0x58a674]  InstanceKlass::link_class_impl(JavaThread*)+0x474
V  [libjvm.dylib+0x58974a]  InstanceKlass::initialize_impl(JavaThread*)+0x4a
V  [libjvm.dylib+0x7efb51]  LinkResolver::resolve_static_call(CallInfo&, LinkInfo const&, bool, JavaThread*)+0x71
V  [libjvm.dylib+0x7f2159]  LinkResolver::resolve_invoke(CallInfo&, Handle, constantPoolHandle const&, int, Bytecodes::Code, JavaThread*)+0xf9
V  [libjvm.dylib+0x5ac026]  InterpreterRuntime::resolve_invoke(JavaThread*, Bytecodes::Code)+0x3e6
V  [libjvm.dylib+0x5ac869]  InterpreterRuntime::resolve_from_cache(JavaThread*, Bytecodes::Code)+0x59
j  imgui.app.Window.clearBuffer()V+28
j  imgui.app.Window.initWindow(Limgui/app/Configuration;)V+272
j  imgui.app.Window.init(Limgui/app/Configuration;)V+2
j  imgui.app.Application.initialize(Limgui/app/Application;)V+15
j  imgui.app.Application.launch(Limgui/app/Application;)V+1
phraktle commented 9 months ago

Upgrading the LWJGL dependency to 3.3.3 seems to resolve this

    implementation(platform("org.lwjgl:lwjgl-bom:3.3.3"))