-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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 deadlock in RemoteDebugger::debug
#87169
Conversation
Looks like it's a responsibility of the various peer implementations to lock internally if they need. In particular, |
Hmm I don't think there should be any new issues in that particular part of code from removing the lock.
|
First of all, I agree that the current code features a little locking catastrophe there and that this PR does the right thing by taking it away. What I mean is that |
RemoteDebugger::debug
Unless just making |
Thanks! |
This raw
mutex.lock
will cause a deadlock in the debugger if the peer is not connected. Additionally, callingmutex.unlock
if the mutex is not held by the current thread is undefined behavior. This is causing deadlocks for me when a different thread than the MainThread enters this loop due to eg an error in a GDScript thread as the microsoft inplementation will decrease the lock counter of the recursive mutex below 0 causing the mutex to appear as locked.Not sure why this
mutex.lock
is here in the first place as every additional iteration won't relock the mutex. If this lock is indeed needed the loop needs to be converted towhile(true)
and the check placed inside but in my testing I didn't find any issues with completely removing this.