Is anyone besides me using JME’s Application.restart() method with LWJGL v3 (jme3-lwjgl3)?
Today I discovered an issue in my Acorus project, where pressing the Enter key invokes restart() and blanks the application window. The app continues running with a blank gray window; there’s no stack trace. However, the window isn’t supposed to go blank!
Here’s the relevant code in my project:
If I comment out line 160, the window displays normally after I press Enter, but of course the new settings don’t get applied either.
I’m puzzled why I didn’t notice this issue sooner. I’m pretty sure the applyToContext() feature worked last year.
At first I suspected it was a regression related to JME v3.8.0-alpha1, but then I found the issue occurs also with JME v3.6.1-stable.
LWJGL v2 (jme3-lwjgl) doesn’t seem to have this issue.
WindowWidth and WindowHeight look problematic. I am investigating.
EDIT: negative values for “WindowWidth” and “WindowHeight” are valid. They indicate to create the window using the width and height of the primary monitor’s current mode.
Correction: your test application doesn’t crash, but the render statistics vanish after 10 seconds, which I think is the same bug I’m seeing in Acorus.
Using printlns, I convinced myself that the thread executing restart() (“jME3 Main”) isn’t the same thread that executed start() (“main”):
Jan 03, 2025 7:13:20 AM com.jme3.system.JmeSystemDelegate lambda$new$1
WARNING: JmeDialogsFactory implementation not found.
Jan 03, 2025 7:13:20 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.6.0-stable
* Branch: HEAD
* Git Hash: 53f2a49
* Build Date: 2023-03-20
[LWJGL] [ThreadLocalUtil] Unsupported JNI version detected, this may result in a crash. Please inform LWJGL developers.
Jan 03, 2025 7:13:20 AM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 3.3.1 build 7 context running on thread jME3 Main
* Graphics Adapter: GLFW 3.4.0 Win32 WGL Null EGL OSMesa VisualC DLL
Jan 03, 2025 7:13:21 AM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFO: OpenGL Renderer Information
* Vendor: NVIDIA Corporation
* Renderer: NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2
* OpenGL Version: 3.2.0 NVIDIA 566.36
* GLSL Version: 1.50 NVIDIA via Cg compiler
* Profile: Core
Jan 03, 2025 7:13:21 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio Renderer Information
* Device: OpenAL Soft
* Vendor: OpenAL Community
* Renderer: OpenAL Soft
* Version: 1.1 ALSOFT 1.21.1
* Supported channels: 64
* ALC extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFT_device_clock ALC_SOFT_HRTF ALC_SOFT_loopback ALC_SOFT_loopback_bformat ALC_SOFT_output_limiter ALC_SOFT_pause_device
* AL extensions: AL_EXT_ALAW AL_EXT_BFORMAT AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_BFORMAT AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_EXT_SOURCE_RADIUS AL_EXT_STEREO_ANGLES AL_LOKI_quadriphonic AL_SOFT_bformat_ex AL_SOFTX_bformat_hoa AL_SOFT_block_alignment AL_SOFTX_callback_buffer AL_SOFTX_convolution_reverb AL_SOFT_deferred_updates AL_SOFT_direct_channels AL_SOFT_direct_channels_remix AL_SOFT_effect_target AL_SOFT_events AL_SOFTX_filter_gain_ex AL_SOFT_gain_clamp_ex AL_SOFT_loop_points AL_SOFTX_map_buffer AL_SOFT_MSADPCM AL_SOFT_source_latency AL_SOFT_source_length AL_SOFT_source_resampler AL_SOFT_source_spatialize
Jan 03, 2025 7:13:21 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio effect extension version: 1.0
Jan 03, 2025 7:13:21 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio max auxiliary sends: 2
Jan 03, 2025 7:13:24 AM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFO: OpenGL Renderer Information
* Vendor: NVIDIA Corporation
* Renderer: NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2
* OpenGL Version: 3.2.0 NVIDIA 566.36
* GLSL Version: 1.50 NVIDIA via Cg compiler
* Profile: Core
Jan 03, 2025 7:13:27 AM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFO: OpenGL Renderer Information
* Vendor: NVIDIA Corporation
* Renderer: NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2
* OpenGL Version: 3.2.0 NVIDIA 566.36
* GLSL Version: 1.50 NVIDIA via Cg compiler
* Profile: Core
Jme does rename the thread in the context creation code.
Osx gets is special threatment, maybe linux/wayland requires a bit extra love too. Could it be that you changed os/windowmanager since the last time you remember it working?
Jme does rename the thread in the context creation code.
I don’t think the thread gets renamed on my machine; I think Application.start() creates a new thread. To verify this, I printed the thread IDs in main() and simpleUpdate(), and they’re different.
Examining the code, I think thread renaming occurs only on MacOS:
Different hardware and different Linux releases, perhaps, but surely still using Cinnamon/X11/Linux.
I hacked LjwglWindow.java to reuse the primary thread in create(), even on Linux. Even with restart() invoked on the primary thread, the render stats still disappear after 10 seconds. So I don’t think it’s a threading issue.
I re-tested Acorus on the same hardware running JME 3.8.0-alpha1/Windows 11, and restart() didn’t blank the window there. (It did, however cause the window to jump back to the primary monitor.) JME 3.6.1-stable gave similar results.
This suggests my issue might be Linux-specific. @zzuegg have you been testing on Windows?
I cannot reproduce it with my laptop (intel graphics and linux+x11).
I tried zzuegg’s example and the text doesn’t disappear after restarting, all looks fine.
Could it be only a problem with Nvidia drivers? what about AMD?
Jan 04, 2025 2:07:53 AM com.jme3.system.JmeSystemDelegate lambda$new$1
WARNING: JmeDialogsFactory implementation not found.
Jan 04, 2025 2:07:53 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.7.0-stable
* Branch: HEAD
* Git Hash: bc6cdf5
* Build Date: 2024-10-21
Jan 04, 2025 2:07:53 AM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 3.3.3+5 context running on thread jME3 Main
* Graphics Adapter: GLFW 3.4.0 Wayland X11 GLX Null EGL OSMesa monotonic shared
Jan 04, 2025 2:07:53 AM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFO: OpenGL Renderer Information
* Vendor: Intel
* Renderer: Mesa Intel(R) UHD Graphics 620 (WHL GT2)
* OpenGL Version: 4.6 (Core Profile) Mesa 20.3.5
* GLSL Version: 4.60
* Profile: Core
Jan 04, 2025 2:07:53 AM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.ogre.MeshLoader
Jan 04, 2025 2:07:53 AM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.ogre.SkeletonLoader
Jan 04, 2025 2:07:53 AM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.ogre.MaterialLoader
Jan 04, 2025 2:07:53 AM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.ogre.SceneLoader
Jan 04, 2025 2:07:53 AM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.fbx.FbxLoader
Jan 04, 2025 2:07:53 AM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.gltf.GltfLoader
Jan 04, 2025 2:07:53 AM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.gltf.BinLoader
Jan 04, 2025 2:07:53 AM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.scene.plugins.gltf.GlbLoader
Jan 04, 2025 2:07:53 AM com.jme3.asset.AssetConfig loadText
WARNING: Cannot find loader com.jme3.audio.plugins.OGGLoader
Jan 04, 2025 2:07:53 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio Renderer Information
* Device: OpenAL Soft
* Vendor: OpenAL Community
* Renderer: OpenAL Soft
* Version: 1.1 ALSOFT 1.23.1
* Supported channels: 64
* ALC extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFT_device_clock ALC_SOFT_HRTF ALC_SOFT_loopback ALC_SOFT_loopback_bformat ALC_SOFT_output_limiter ALC_SOFT_output_mode ALC_SOFT_pause_device ALC_SOFT_reopen_device
* AL extensions: AL_EXT_ALAW AL_EXT_BFORMAT AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_BFORMAT AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_EXT_SOURCE_RADIUS AL_EXT_STATIC_BUFFER AL_EXT_STEREO_ANGLES AL_LOKI_quadriphonic AL_SOFT_bformat_ex AL_SOFTX_bformat_hoa AL_SOFT_block_alignment AL_SOFT_buffer_length_query AL_SOFT_callback_buffer AL_SOFTX_convolution_reverb AL_SOFT_deferred_updates AL_SOFT_direct_channels AL_SOFT_direct_channels_remix AL_SOFT_effect_target AL_SOFT_events AL_SOFT_gain_clamp_ex AL_SOFTX_hold_on_disconnect AL_SOFT_loop_points AL_SOFTX_map_buffer AL_SOFT_MSADPCM AL_SOFT_source_latency AL_SOFT_source_length AL_SOFT_source_resampler AL_SOFT_source_spatialize AL_SOFT_source_start_delay AL_SOFT_UHJ AL_SOFT_UHJ_ex
Jan 04, 2025 2:07:53 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio effect extension version: 1.0
Jan 04, 2025 2:07:53 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio max auxiliary sends: 2
Jan 04, 2025 2:08:04 AM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFO: OpenGL Renderer Information
* Vendor: Intel
* Renderer: Mesa Intel(R) UHD Graphics 620 (WHL GT2)
* OpenGL Version: 4.6 (Core Profile) Mesa 20.3.5
* GLSL Version: 4.60
* Profile: Core
Jan 04, 2025 2:08:14 AM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFO: OpenGL Renderer Information
* Vendor: Intel
* Renderer: Mesa Intel(R) UHD Graphics 620 (WHL GT2)
* OpenGL Version: 4.6 (Core Profile) Mesa 20.3.5
* GLSL Version: 4.60
* Profile: Core