-
Notifications
You must be signed in to change notification settings - Fork 8.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
Fire and forget Hyperlink handling to break deadlock #8087
Conversation
Over to @PankajBhojwani for another signoff in the morning 😄 |
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.
Yea that'll work
@msftbot make sure @PankajBhojwani signs off on this |
Hello @zadjii-msft! Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:
If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you". |
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.
Looks good to me, thank you!
Fire and forget on the hyperlink handler inside the TermControl. ## PR Checklist * [x] Closes #7994 * [x] Tested manually * [x] Hi, I work here. ## Detailed Description of the Pull Request / Additional comments In `TermControl`, `_HyperlinkHandler` is called by `_PointerPressedHandler` which has taken a write lock for all its friends. However, `_HyperlinkHandler` downstreams to `ShellExecute` which can pump the message queue looking for something. That pumping of the queue can trigger messages that also want the write lock to update state. They get stuck. Everything hangs. `_HyperlinkHandler` really only needs read lock and really only for as long as it takes to fill up its parameters before it's invoked... but the simpler and more contained solution is to just fire and forget the rest of the method that causes the deadlock to a continuation at the tail of the dispatcher queue so `_PointerPressedHandler` can complete and naturally drop the write lock. ## Validation Steps Performed - Launched `main` manually on my box and clicked the hyperlink that is detected when Powershell starts and it froze. - Launched this change manually on my box and clicked the hyperlink that is detected when Powershell starts and it did not freeze. (cherry picked from commit 2ea4742)
🎉 Handy links: |
🎉 Handy links: |
Fire and forget on the hyperlink handler inside the TermControl.
PR Checklist
Detailed Description of the Pull Request / Additional comments
In
TermControl
,_HyperlinkHandler
is called by_PointerPressedHandler
which has taken a write lock for all itsfriends. However,
_HyperlinkHandler
downstreams toShellExecute
which can pump the message queue looking for something. That pumping of
the queue can trigger messages that also want the write lock to update
state. They get stuck. Everything hangs.
_HyperlinkHandler
really only needs read lock and really only for aslong as it takes to fill up its parameters before it's invoked... but
the simpler and more contained solution is to just fire and forget the
rest of the method that causes the deadlock to a continuation at the
tail of the dispatcher queue so
_PointerPressedHandler
can completeand naturally drop the write lock.
Validation Steps Performed
main
manually on my box and clicked the hyperlink that isdetected when Powershell starts and it froze.
is detected when Powershell starts and it did not freeze.