utopia-rise / godot-kotlin-jvm

Godot Kotlin JVM Module
MIT License
585 stars 38 forks source link

Segmentation fault in JvmInstanceWrapper<KtBinding, &KtBindingQualifiedName>::swap_to_weak_unsafe #666

Closed opl- closed 1 week ago

opl- commented 3 weeks ago

Game process randomly crashes with SIGSEGV within a few minutes.

Version

Godot Kotlin/JVM: 39dc30230a30d2a6ab4ec3277eb3bc270995ab23 OpenJDK: 21.0.3+9 Platform: Linux, X11 display server running on XWayland

Stack

Thread 52 "pool-1-thread-1" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f6e69cff6c0 (LWP 298400)]
0x00007f6e8f71f6b8 in OopStorage::Block::release_entries(unsigned long, OopStorage*) () from target:/nix/store/k9snfnb9i9yc1ww9r0bb0vah9mgwjw7c-openjdk-21.0.3+9/lib/openjdk/lib/server/libjvm.so
(gdb) bt
#0  0x00007f6e8f71f6b8 in OopStorage::Block::release_entries(unsigned long, OopStorage*) () from target:/nix/store/k9snfnb9i9yc1ww9r0bb0vah9mgwjw7c-openjdk-21.0.3+9/lib/openjdk/lib/server/libjvm.so
#1  0x00007f6e8f71f928 in OopStorage::release(oopDesc* const*) () from target:/nix/store/k9snfnb9i9yc1ww9r0bb0vah9mgwjw7c-openjdk-21.0.3+9/lib/openjdk/lib/server/libjvm.so
#2  0x00007f6e8f3d081f in jni_DeleteGlobalRef () from target:/nix/store/k9snfnb9i9yc1ww9r0bb0vah9mgwjw7c-openjdk-21.0.3+9/lib/openjdk/lib/server/libjvm.so
#3  0x0000563a7e866f3f in JvmInstanceWrapper<KtBinding, &KtBindingQualifiedName>::swap_to_weak_unsafe (this=0x7f6d982a1d20, p_env=...) at modules/kotlin_jvm/src/jvm_wrapper/jvm_instance_wrapper.h:116
#4  0x0000563a7e866ed8 in KotlinBinding::set_kt_binding (this=0x563a999146f0, j_object=j_object@entry=...) at modules/kotlin_jvm/src/binding/kotlin_binding.cpp:55
#5  0x0000563a7e867194 in KotlinBindingManager::bind_object (id=..., id@entry=..., j_object=...) at modules/kotlin_jvm/src/binding/kotlin_binding_manager.cpp:84
#6  0x0000563a7e84ada3 in MemoryManager::bind_instance (p_raw_env=<optimized out>, p_instance=<optimized out>, instance_id=-9223354724898543221, p_object=<optimized out>) at modules/kotlin_jvm/src/jvm_wrapper/memory/memory_manager.cpp:13
#7  0x00007f6e7d9f207e in ?? ()
#8  0x000000061c45ba00 in ?? ()
#9  0x00007f6e8f33ea48 in java_lang_Thread::set_thread_status(oopDesc*, JavaThreadStatus) () from target:/nix/store/k9snfnb9i9yc1ww9r0bb0vah9mgwjw7c-openjdk-21.0.3+9/lib/openjdk/lib/server/libjvm.so
chippmann commented 3 weeks ago

Will be fixed by: https://github.com/utopia-rise/godot-kotlin-jvm/issues/618 Probably in https://github.com/utopia-rise/godot-kotlin-jvm/pull/661

opl- commented 3 weeks ago

Discussed on Discord.

Been told this is likely a counterpart to #617, so linking the two.

CedNaru commented 1 week ago

Should be fixed by #661.