Fix ResourceLoader deadlocks#120077
Merged
Merged
Conversation
This fixes several issues: * There was a bug in the cycle detection. It was possible for the cycle detection to fail because the current thread isn't in the list. Fix this by just seeing if any of the next threads were already in the cycle. * By way of an optimization the thread_waiting_on bookkeeping was done under the same thread_load_mutex as the cycle detection. But there is also an early exit after yields. If we exit through the yield the thread_waiting_on entry is stale and can cause other threads to fail to do cycle detection. * When multiple threads end up finishing a resource simultaneously anyway, probably through cycle detection, there's a small chance that the original thread finished more-or-less at the same time if the original thing blocking load completed. We solve this now by letting only one of the threads do the initial registration.
b501b77 to
b88a62f
Compare
bruvzg
approved these changes
Jun 8, 2026
bruvzg
left a comment
Member
There was a problem hiding this comment.
Seems to fix the only crash I was still able to reproduce. And none of the previously fixed crashes are reproducible.
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes several issues:
Testing was done with MRPs from:
In addition two projects that were shared with me privately.
No regressions compared to current master were found, and the new issues were fixed.