-
-
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
Fix DNS resolve mutex locks #49269
Fix DNS resolve mutex locks #49269
Conversation
There's still three more calls to |
Yeah, I think they probably should be, but they were in the code before my original PR and so I was skeptical to touch them in case someone else added them for some actual purpose. Should I remove them too? They seem to all be in error condition branches that probably never get hit, which is why they've not been a problem. |
Right, this might need checking by @RandomShaper who implemented the |
OK, so wait and see what @RandomShaper says. I can easily remove them if he says they're not needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I took things out of balance by adding the RAII (MutexLock
) style and forgetting to remove some of the explicit unlocks.
By the way, this PR makes the same mistake. 😃 Please remove the explicit unlocks inside the if
s where you have switched to the scoped lock style, and please do so also in get_resolve_item_status()
, where I forgot myself.
Furthermore, I don't think it will actually impact performance, but it's even better to enclose each MutexLock
declaration along with the code it protects in a scope so the lock is released earlier instead of at the end of the function. I don't know if the original intent of the code regarding the early-unlock was optimization or just to avoid writing the unlock call many times, but, in any case, it won't harm.
UPDATE: To elaborate, I didn't have a strong reason to keep the explicit lock/unlock or fully switch to the scoped style. I just decided on a per case basis judging which would be more readable, but now I think it's better to use MutexLock
everywhere, at least in this class, for consistency.
In that case, I'll remove the extra unlock() calls and push an update in 10 minutes. |
This fixes godotengine#49261, which was happening because of a deadlock in the resolver mutex. There was leftover old mutex code and it's all be converted to new MutexLock class now.
Thanks! |
This fixes #49261, which was happening because of a deadlock in the resolver mutex. There was leftover old mutex code and it's all be converted to new MutexLock class now.