You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes, when opening a project in Godot editor, the editor hangs while loading the project. Process CPU usage will be 0 and when the process is inspected using a C++ debugger the main thread and EditorHelp documentation loading thread (EditorHelp::_load_doc_thread()) seem to be deadlocked, both waiting for a lock. This happens very rarely, I have seen this happen probably less than 5 times in during several months of testing so it is possible the issue very sensitive to thread timing and project structure. The first time I remember this happening was at least a few months ago.
This might be related to #82817 and as discussed on RocketChat the error message about editor_doc_cache.res being in use might also be related to this as this is a file EditorHelp creates and updates.
Call stack from main thread, it looks like it is deadlocked waiting for a write lock (built and run using llvm-mingw on Windows):
Load any project and the loading can hang forever. However, this happens very rarely.
Minimal reproduction project
Any project will probably do. However, as this might be documentation generation related, having a bigger project with more classes etc. could trigger this more or less often.
The text was updated successfully, but these errors were encountered:
So I know for a fact that the order of EditorNode initialization and documentation generation is not deterministic (see #80377). This means that sometimes docs would generate before and sometimes after EditorNode is finished setting itself and everything in it up.
From your logs, this seems like the case as well. We are attempting to generate documentation before the editor is done setting itself up. Seems like while this happens some classes can still be registered with ClassDB which causes the conflict.
Now the question is — is this preventable? I suppose if classes can be initialized as late as they are requested by another object's constructor, then ClassDB never has stable information in it? Exposed classes are registered ahead of time, but unexposed classes can still happen afterwards.
Edit:
So, classes are initialized (initialize_class()) in two situations: you register them and they are allocated for the first time. I guess for the purposes of the documentation we don't care for the latter, we only need registered classes. We just need to make sure docs can do what they need to do without interrupting anything else.
Since deadlocks like that when accessing ClassDB don't normally happen, this is probably something particular about this situation. For example, an obvious hint about this problem is that we call EditorHelp::generate_doc(); in EditorNode constructor, just before we start adding nodes to the tree (which causes allocations, which causes the deadlock). So this could probably be adjusted in some way.
Godot version
4.2 custom dev (multiple versions)
System information
Windows 10
Issue description
Creating this issue as discussed on RocketChat.
Sometimes, when opening a project in Godot editor, the editor hangs while loading the project. Process CPU usage will be 0 and when the process is inspected using a C++ debugger the main thread and
EditorHelp
documentation loading thread (EditorHelp::_load_doc_thread()
) seem to be deadlocked, both waiting for a lock. This happens very rarely, I have seen this happen probably less than 5 times in during several months of testing so it is possible the issue very sensitive to thread timing and project structure. The first time I remember this happening was at least a few months ago.This might be related to #82817 and as discussed on RocketChat the error message about
editor_doc_cache.res
being in use might also be related to this as this is a file EditorHelp creates and updates.Call stack from main thread, it looks like it is deadlocked waiting for a write lock (built and run using llvm-mingw on Windows):
And the EditorHelp loading thread calls stack, deadlocked waiting for a read lock:
Steps to reproduce
Load any project and the loading can hang forever. However, this happens very rarely.
Minimal reproduction project
Any project will probably do. However, as this might be documentation generation related, having a bigger project with more classes etc. could trigger this more or less often.
The text was updated successfully, but these errors were encountered: