-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GDScript: Avoid deadlock possibility in multi-threaded load #93032
Conversation
40ad0fa
to
6ce9a98
Compare
I agree. The code seems good, but since it isn't fixing any reported regressions it's best to wait until 4.4 |
6ce9a98
to
79550a5
Compare
This turns out to fix an important issue. We may want to reasses milestone. |
This seems to break the
|
I wonder why it doesn't support the overloading. However, I can just preprocess out those for web builds. I'll push with that. |
836026b
to
25ccc06
Compare
That's because in
So it's the same definition twice. |
25ccc06
to
7ca31d6
Compare
…eneric mechanism This is strictly beyond a refactor because it also changes when the mutexes are relocked, but that's only for extra safety.
7ca31d6
to
d334632
Compare
Thanks! |
We already have a mechanism in
WorkerThreadPool
by which it collaborates withCommandQueueMT
by unlocking its mutex before starting a wait and relocking it afterwards. That is a deadlock prevention mechanism that lets certain otherwise ill situations to make progress.I found that in multi-threaded load situations (with
RESOURCE_CACHE_MODE_IGNORE
), the GDScript cache can incurr in a deadlock. That's the case if multiple threads interact withGDScriptCache::get_full_script()
. By letting theWorkerThreadPool
unlock the corresponding mutex, the deadlock is broken.The first commit just makes the existing system more generic (mostly a refactor). The second makes
GDScriptCache
opt-in for it. It's interesting to keep both changes separate for bisections.NOTE: Due to a risk of regressions, as this is slippery ground, you power maintainers may want to reschedule to 4.4.
UPDATE: Fixes #85255.