Linux exports run, but hang on exit

Godot Version

v4.6.2.stable.mono.official [71f334935]

Question

I have been building and exporting a game to Linux successfully for the past couple of years, but my most recent build does not close when the user exits. I have examined and reverted, individually, every change I have made since the previous good version, but I can’t find the culprit.

I have confirmed that threads are being cleaned up on exit.

I know this is virtually impossible to figure out from a forum post; I’m just wondering what sorts of things I should be looking at to debug this - I’m at a loss.

When running from command line, the GOOD version shows:

WARNING: Property not found: 'xr/openxr/extensions/hand_tracking'.
     at: get_setting_with_override (core/config/project_settings.cpp:430)
Godot Engine v4.6.2.stable.mono.custom_build - https://godotengine.org
Error [GENERAL | xrCreateInstance | OpenXR-Loader] : LoaderInstance::CreateInstance chained CreateInstance call failed
Error [GENERAL | xrCreateInstance | OpenXR-Loader] : xrCreateInstance failed
VR Server (v1789498647)

Using breakpad crash handler
Setting breakpad minidump AppID = 250820
Forcing breakpad minidump interfaces to load
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
10/03 14:43:34 minidumps folder is set to /tmp/dumps
10/03 14:43:34 Init: Installing breakpad exception handler for appid(250820)/version(2.17.10)/tid(59744)
[S_API] SteamAPI_Init(): Loaded '/home/ericd/.local/share/Steam/linux64/steamclient.so' OK.
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
SteamInternal_SetMinidumpSteamID:  Caching Steam ID:  76561197963006489 [API loaded yes]
SteamInternal_SetMinidumpSteamID:  Setting Steam ID:  76561197963006489
OpenXR: Created instance for OpenXR 1.0.54
OpenXR: Running on OpenXR runtime:  SteamVR/OpenXR   2.17.10
OpenXR: Failed to get system for our form factor [ XR_ERROR_FORM_FACTOR_UNAVAILABLE ]
WARNING: OpenXR was requested but failed to start.
HMD was not detected or a required feature was not supported.

Godot will start in normal mode.

     at: initialize_openxr_module (modules/openxr/register_types.cpp:253)
Vulkan 1.4.341 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 4070 Ti

AMC Forth Ver. 1.2.2
ERROR: Pages in use exist at exit in PagedAllocator: N33RendererSceneRenderImplementation22RenderForwardClustered32GeometryInstanceSurfaceDataCacheE
   at: ~PagedAllocator (./core/templates/paged_allocator.h:169)
ERROR: Pages in use exist at exit in PagedAllocator: N33RendererSceneRenderImplementation22RenderForwardClustered32GeometryInstanceForwardClusteredE
   at: ~PagedAllocator (./core/templates/paged_allocator.h:169)
ERROR: 1 shaders of type SceneForwardClusteredShaderRD were never freed
   at: ~ShaderRD (servers/rendering/renderer_rd/shader_rd.cpp:1056)
ERROR: 1 RID allocations of type 'N10RendererRD11MeshStorage4MeshE' were leaked at exit.
ERROR: 1 RID allocations of type 'N10RendererRD15MaterialStorage8MaterialE' were leaked at exit.
ERROR: 1 RID allocations of type 'N10RendererRD15MaterialStorage6ShaderE' were leaked at exit.
ERROR: 1 RID allocations of type 'N10RendererRD14TextureStorage7TextureE' were leaked at exit.
ERROR: 8 RID allocations of type 'N17RendererSceneCull8InstanceE' were leaked at exit.
corrupted size vs. prev_size while consolidating

When running the failing version:

WARNING: Property not found: 'xr/openxr/extensions/hand_tracking'.
     at: get_setting_with_override (core/config/project_settings.cpp:430)
Godot Engine v4.6.2.stable.mono.custom_build - https://godotengine.org
Error [GENERAL | xrCreateInstance | OpenXR-Loader] : LoaderInstance::CreateInstance chained CreateInstance call failed
Error [GENERAL | xrCreateInstance | OpenXR-Loader] : xrCreateInstance failed
VR Server (v1789498647)

Using breakpad crash handler
Setting breakpad minidump AppID = 250820
Forcing breakpad minidump interfaces to load
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
10/03 14:47:25 minidumps folder is set to /tmp/dumps
10/03 14:47:25 Init: Installing breakpad exception handler for appid(250820)/version(2.17.10)/tid(60025)
[S_API] SteamAPI_Init(): Loaded '/home/ericd/.local/share/Steam/linux64/steamclient.so' OK.
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
SteamInternal_SetMinidumpSteamID:  Caching Steam ID:  76561197963006489 [API loaded yes]
SteamInternal_SetMinidumpSteamID:  Setting Steam ID:  76561197963006489
OpenXR: Created instance for OpenXR 1.0.54
OpenXR: Running on OpenXR runtime:  SteamVR/OpenXR   2.17.10
OpenXR: Failed to get system for our form factor [ XR_ERROR_FORM_FACTOR_UNAVAILABLE ]
WARNING: OpenXR was requested but failed to start.
HMD was not detected or a required feature was not supported.

Godot will start in normal mode.

     at: initialize_openxr_module (modules/openxr/register_types.cpp:253)
Vulkan 1.4.341 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 4070 Ti

AMC Forth Ver. 1.2.2
ERROR: Pages in use exist at exit in PagedAllocator: N33RendererSceneRenderImplementation22RenderForwardClustered32GeometryInstanceSurfaceDataCacheE
   at: ~PagedAllocator (./core/templates/paged_allocator.h:169)
ERROR: Pages in use exist at exit in PagedAllocator: N33RendererSceneRenderImplementation22RenderForwardClustered32GeometryInstanceForwardClusteredE
   at: ~PagedAllocator (./core/templates/paged_allocator.h:169)
ERROR: 1 shaders of type SceneForwardClusteredShaderRD were never freed
   at: ~ShaderRD (servers/rendering/renderer_rd/shader_rd.cpp:1056)
ERROR: 1 RID allocations of type 'N10RendererRD11MeshStorage4MeshE' were leaked at exit.
ERROR: 1 RID allocations of type 'N10RendererRD15MaterialStorage8MaterialE' were leaked at exit.
ERROR: 1 RID allocations of type 'N10RendererRD15MaterialStorage6ShaderE' were leaked at exit.
ERROR: 1 RID allocations of type 'N10RendererRD14TextureStorage7TextureE' were leaked at exit.
ERROR: 8 RID allocations of type 'N17RendererSceneCull8InstanceE' were leaked at exit.
corrupted size vs. prev_size while consolidating

At this point I either kill the app with xkill or with Ctrl-C if I’m running from the command line.

I am building and uploading to Steam, but I have yet to see if this problem exists in that context as well.

I realize there are plenty of issues here that I could be asking about, but the only error in the debugger has to do with initializing XR, which is an artifact of having XR enabled in the project while not actually running the app with a VR headset connected.

Exports to Windows exit without any problem.

try it on other devices or ask friend (with linux)bto try it on ther machines.
and do you use get_tree.quit ?

Yes, I’m using get_tree().quit()

Actually, I was originally using get_tree().call_deferred(“quit”) for some reason, but they both seem to work (or not work) the same way.

I tried running the executable on a cheap laptop (Ubuntu 26.04) with a completely different integrated GPU and it also hung. Then I brought it over to my Steam Deck running in Linux desktop mode (completely different distro and GPU) and it closed after a brief wait. Not sure what to make of that!

Hm.. seams like it works on all pc exept for yours, I dont know a lott about PCs or linux but on this point it would open a bug_report on godots github page bc this seasm to be an engine bug and I would provide as much info as posible about your device and distro

If you are using git, and have fine-grain commits, did you try git bisect?

If you intend to release on steam it may be worth building a Godot template against steamrt4 for a consistent environment steam users will see, if it’s not present in that environment it may not matter for your use :upside_down_face:

Bisect sounds like a great idea.

Unfortunately, my small problem has morphed into a huge one, as the Godot editor has begun crashing instantly when I try to edit the project - even a fresh restore from Github.

So it looks like the process of recovering the project had the side effect of fixing the original problem. Everything is good again.

By “recovering the project” I mean starting with an empty project folder, cloning the repository from GitHub, and letting the project launcher rediscover it. Initially, that caused the editor to crash, but running it in recovery mode allowed me to find some problems in the project that I could fix. Once everything was fixed, the hung Linux build problem vanished.

Thanks, everyone, for chipping in with suggestions!

Is there any more context you provide for your solution? What caused the issue, now that you’ve found it? I suppose deleting the .godot folder is a similar action to force re-importing, for anyone not using git.

I wish I could say more with confidence.

At some point while trying to force the project into a known state, I deleted the .godot folder, as you said. This caused the project editor to crash. Rather than trying to fix the project at that point, I went a step further (possibly unnecessarily) by starting from scratch with a fresh clone. The editor still crashed, of course, but I had no choice but to dig into the reasons why in recovery mode. There was a complex scene that could not be loaded, and buried deep inside it were resources (jpeg files) with the dreaded red X next to them. I converted those to png and reimported them, replacing the originals. This alone was enough to make the editor happy again.

I probably didn’t need to start “from scratch”, but at least I know the archive is complete (like testing a backup recovery).

I tried exporting again, and the new Linux binaries ran and exited perfectly. Since I was in the habit (at this point) of running the binaries from the command line, I did spend some more time looking at the output in --verbose mode and managed to find a few remove_child() calls without corresponding queue_free() calls, and some add_child() calls without corresponding remove_child() calls that didn’t affect the game but did make Godot a little angry when it exited.

I should probably do some isolated testing with those bad jpg files to see if the import issue can be recreated in a small project. They had been in the project without any issue for a couple of years and through several Godot version upgrades.