-
Notifications
You must be signed in to change notification settings - Fork 757
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
document QtCollider:LangClient - event loop deadlock issue #5039
Conversation
thanks! after looking at this more closely i think we should fix it in hidapi, per this comment, instead of here. the reason is that with this change we open the door to other multithreaded programming errors, some of which may be difficult to catch, whereas deadlock is easy to spot and fix with a backtrace. i think it is reasonable, in fact desirable, to continue to enforce that a tick in the language does not occur while interpreting command-line code. |
our fork of hidapi, which you should submit a PR against directly, is here: https://github.com/supercollider/hidapi as far as i know the signal11 repo is unmaintained now. |
Brian, thank you for your consideration and comments. My original intention was to fix hidapi, but as time passed it seemed worthwhile to investigate other solutions. This PR seemed like a good approach when trylock worked and found it used in older code, esp. doClockTask method from scapp (cocoa tick equivalent). However, I agree with your concern, and think changing a critical code path to fix an edge case is probably not worthwhile. Could it make sense to comment point of deadlock? Maybe make design a little more apparent. e.g.
|
yeah! that would be really helpful actually. |
09edd79
to
14f368b
Compare
Is this pull request okay, or shall I make a new one? |
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.
thanks!
@gurk no new PR needed, i'll merge this as is. and also edit the PR title so it accurately reflects the purpose. thanks! |
In qt tick event handler there's potential for language deadlock with a recursive event loop call.
This fix uses trylock to bail early from handler when unable to obtain language lock.
e.g. deadlock can happen when tick called during work event handling, which is rare but possible.
Solution seems not too radical as SuperCollider appears to have precedence of this approach:
SC_LanguageClient::tick
SCApp AppClock handler
Tested with no apparent issues on MacOS 10.14.6.
Purpose and Motivation
Document the cause of #1640
Types of changes
To-do list