Godot Version
4.2.1
Question
Been hunting down this bug nearly forever, and cannot get a resolution for it. When I close my game, it lags. Takes 2-3 seconds to close. This ONLY happens in the build version of my game, and I am only able to test the Windows version so far.
When closing the game ran from the Godot editor, it shuts down nearly immediately, and does not throw any errors to the console.
Adding the console wrapper to my build gives me a little more information:
Does anyone have any idea what these errors are?
My game project is large - it’s a complete game, and this is one of the last hold-out bugs - so I don’t know where to start.
One obvious culprit is that I have a background thread that does some “busy waiting” (with a 100 ms OS timeout), to autosave the game. I am very careful in handing off resources, and duplicating when necessary to facilitate saving, and there’s no cross-thread traffic. Of course, in _exit_tree
I have to
set a thread-safe flag to false to kill the busy-waiting-loop and then wait_to_finish()
on the thread, before exiting the tree.
When completely elliminating the auto-saving thread from my game, the exact same error happens, so I have ruled that out as a cause.
Any help would be greatly appreciated.
Edit: I doubt OpenGL is the issue (although maybe a separate issue, since the last 3 errors aren’t present)- I made a complete copy of the game, changed the renderer backend to Forward+, and still getting this error when closing:
Still hangs for 2-3 seconds.