Repository navigation
update to jmonkeyengine 3.10.0-beta2 + lwjgl 3 - #716
Merged
Merged
Conversation
Contributor
Author
|
Currently causes a crash on exit. |
Quit the SDK and the JVM died with SIGSEGV during process teardown, reliably, whenever the offscreen scene application had started: Current thread is native thread # C [libc.so.6+0x91651] <- __GI___nptl_deallocate_tsd SIGSEGV (SEGV_MAPERR) Root cause (proven via strace mmap/munmap correlation, a coredump backtrace and four hs_err logs with identical state; pthread key index 14 and the same destructor offset ...d30 in every sample): - GLFW (jME lwjgl3 backend) probes EGL besides GLX while creating the GL context for the offscreen scene application. - glvnd's libEGL.so.1 registers a pthread_key whose destructor points into its own text, and stores per-thread TSD data on the render thread that made the egl* calls. The key is never deleted. - At SDK shutdown GLFW terminates and dlcloses libEGL.so.1 (strace: munmap of its whole 75432-byte mapping during the teardown cascade). The registered destructor is now dangling. - When the render thread finishes and glibc runs the thread-exit TSD walker (__nptl_deallocate_tsd), it calls the stale destructor into the unmapped libEGL text -> SIGSEGV -> JVM fatal error. Timing-wise this is a race: occasionally the thread exits before the dlclose and the exit looks clean. Fix: hold our own dlopen reference on libEGL.so.1 at module startup (System.load in the jme3-core Installer, Linux only). GLFW's dlclose then merely drops its own reference: the library stays mapped until the JVM terminates and the destructor remains valid. Verified: traced runs before the fix crashed on every exit; with the pin, exits are clean (no hs_err, no coredump, libEGL never unmapped) across repeated straced and plain runs. A complete fix should also be pursued upstream (glvnd removing its pthread key on library unload, or GLFW not unloading libraries it probed). Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
The fix commit for the exit crash holds a dlopen reference on libEGL.so.1 to keep glvnd's pthread-key destructor valid. Its comments and log message blamed GLFW for the load/unload of libEGL. jME 3.10's lwjgl3 backend is SDL3-based (LWJGL 3.4 lwjgl-sdl bindings; there is no lwjgl-glfw on the SDK classpath): SDL probes the X11 and Wayland/EGL video backends when the GL context is created, and its video teardown (SDL_EGL_UnloadLibrary) dlcloses libEGL at shutdown, leaving the destructor dangling. Same crash, same pthread key, same fix - only the actor is SDL3, not GLFW. Wording-only change, no functional difference. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Contributor
Author
|
Regarding why only linux: So the specific bug is Linux-bound: only there does a library exist that registers a destructor it Two honest caveats:
|
Contributor
|
Hmm, is this a bug in LWJGL ? |
Contributor
Author
|
It talks about upstream, so yeah maybe. If anyone can casually nudge the lwjgl team to look at this, please do.(Note, it talks about GLFW, but it's actually SDL which is corrected in the latter commit message). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #715