godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.01k stars 21.17k forks source link

after update to Godot 4.3 frequent in-game freezes #96109

Open notmart opened 2 months ago

notmart commented 2 months ago

Tested versions

Reproducible in: 4.3.0 Not reproducible in: 4.2.x

System information

Linux, X11 Godot 4.3.0 using Forward+

Issue description

After update to Godot 4.3, my game project is starting to randomly freeze in-game (never the editor, even if it has a lot of @tool) it just stops drawing and hitting pause to open the debugger (or opening remote explorer) in the editor has no effect, while the stop button works.

the only visible thing that might give some information, is that when it freezes it starts to output on log (when starting godot from the terminal) the message:

Object was deleted while awaiting a callback.

this message is repeated thousands upon thousands of times, which seems to happen in message_queue.cpp, line 406

Steps to reproduce

just start playing the game for a while, and the total freeze happens after one-two minutes

Minimal reproduction project (MRP)

Unfortunately it seems to happen only in my project, which is rather big, so i wouldn't know exactly how to do a minimal project that shows the problem (doesn't seem to happen on the official example projects)

I can rebuild Godot itself and add more debug or breakpoints in godot itself, if it might help.

notmart commented 2 months ago

after putting some debug into CallQueue::push_callablep() i found out that before the Object was deleted while awaiting a callback. flood, there is a flood of push_callablep of PathFollow3D::set_position (and then the error message about the queue being full).

The game uses several pathfollows that get updated every _physics_process, perhaps is that which is too heavy, piles up and freezes the engine, as i see in its implementation update_transform is deferred so i guess is not guaranteed to be finished before the next _physics_process()

Also disabling all the updates of the PathFollow3Ds seems to make the problem not happen

notmart commented 2 months ago

also, if i patch

void PathFollow3D::set_progress(real_t p_progress) {

to call update_transform(true) immediate instead of deferred, that works around the problem as well