-
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
Terminal hangs when opening new windows or new tabs on Windows Server 2022 #11135
Comments
That quells my fear that it's related to #4472. What shell are you trying to open in the new tab? |
The default shell on a fresh install (PowerShell). I also changed the default to Command Prompt and it behaved the same. |
I'm also seeing it in Windows 10 for Terminal 1.10 |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. |
This is still a problem and I have replied. How does one remove the labels the bot mentions? I do not seem to have that ability. Now the bot removed the labels but 8 days ago it did not. |
@zadjii-msft : How do I transfer the dump file to you securely? I cannot seem to upload .zip files or .dmp files here. |
My email is on my github profile, you can send it there |
@zadjii-msft : The dump file zipped is 76 MB which is larger than my e-mail quota allows. Is there another way to share it with you? I could request a temporary place via my IT organization, but it may take several days for the area to be provisioned. |
I have the same problem. Windows Terminal Preview v1.10.1933.0 works, and Windows Terminal v1.10.2383.0 hangs. I am on Windows 10 (19043.1237). |
@zadjii-msft : What other methods do you have to provide Microsoft the dump file? I am unable to attach it here or send via e-mail? |
Perhaps if you have a private OneDrive folder that could be shared with me and then I could upload into it? (And hopefully the upload is not blocked by OneDrive) |
Similar to #11252 btw. |
@Falco20019 : Yes, this appears similar. |
@zadjii-msft If it helps, I have uploaded a memory dump with Windows Terminal in its hang state and shared it with your email address. You can access it through OneDrive here. https://srminform-my.sharepoint.com/:u:/g/personal/j_jackson_s-rminform_com/EfptE2hZQ2xErdBCGJN967MBjQavxnnXQQx8JtaNyc8_uQ?email=migrie%40microsoft.com&e=9IKHlN Hope that's okay but let me know if you would like me to host it somewhere else |
Hi @Sankgreall , was your dump from Windows 10 or Server 2022? |
My GH name at the usual suspect corporate domain. |
Hosted here. I will note that one of my debug sessions actually spun up the Terminal correctly. I just wasn't thinking and deleted it, but this is also expected behaviour as others have noted if you kill the process manually and start a new console, it sometimes appears to work and bypasses this issue. |
Sounds super race condition-y to me. I hope this trace is insightful. Opening now. |
Oh my goodness. There is an exception thrown on a thread inside of this trace. We might be onto something! Digging! |
This is going to sound really weird. Do you have a touchscreen? |
Well. Technically yes? The machines we install Windows Terminal on get shipped out to users with Surface Laptops, which have touch screens. I am running a Dell XPS, which also has touchscreen. The touchscreen functionality is not used for any business processes, however... If that makes sense? |
An access violation happens ( Partial stack of throwing callsite
The tablet input service (the soft keyboard that shows up on touch screens... also known as But the tablet input service is being sneaky. They know they're calling other people's code and that it could contain bugs. So they registered a Structured Exception Handler to catch anything that could go wrong. Up to and including an access violation that would normally crash the application. The C++ Frame Handler we had installed will not catch an access violation... but an SEH one will!
The touch screen keyboard handler then just marks the call as failed and gives up. But it ends that whole thread right where it stood... and doesn't let our unlock call go off in the scope exit. terminal/src/types/ScreenInfoUiaProviderBase.cpp Lines 221 to 244 in aec7392
Then when the rest of the Terminal is given a chance to load... (see #11135 (comment) in the main thread)... it tries to take the lock to set things up. But the SEH-killed thread from the In short, it's an easy repro. Run So the culprit is #10971 (and 1.10 backport #11042) because it allows queries from the UIA before everything is ready. Now our team will debate whether that fix is appropriate and we should revert it... whether we should patch up this particular call site and/or audit the others from Thank you so much for working with us today and helping us track this down. This looks like it is going to be a big deal and a big priority for us to service. I have to head home for this evening and @zadjii-msft is already off for today, but we'll cycle through with @carlos-zamora and @DHowett in the morning and start cranking on fixes and working out our servicing story. So much appreciated that you went above and beyond in providing us all the logging, diagnostics, and tracing we could possibly need today. You're awesome! |
Ah amazing. Very happy I could help, and also want to say thank you and the rest of the team for servicing such an incredible application that we use literally every single day. Your effort is really appreciated! |
OK here's the plan: We're going to prepare two fixes:
Here's the structure output to make it easier to see which members need guarding:
And then when we're done, we'll hold ourselves to doing a "Root Cause Analysis" to reflect on what went wrong, how we can correct it beyond this, how we can discover things like this faster, and how we can prevent issues like this in the future. Some of what we've slated for the comprehensive fix is already a part of satisfying the "how we can prevent this" and "how we can discover this faster", but we would like to be accountable for this issue. |
Great to hear the progress you are all making. Once a patch is available I could try it in my Windows Server 2022 environment. Thanks! |
FYI, it appears that a workaround for my scenario on Windows Server 2022 is to kill the TabTip.exe process using Task Manager before attempting to use Windows Terminal. |
Adds a check before every UIA function call to ensure the terminal (specifically the buffer) is initialized before doing work. Both the `ScreenInfoUiaProvider` and the `UiaTextRange` are now covered. ## References Closes #11135 #10971 & #11042 ## Detailed Description of the Pull Request / Additional comments Originally, I tried applying this heuristic to all the `RuntimeClassInitialize` on `UiaTextRangeBase` with the philosophy of "a range pointing to an invalid buffer is invalid itself", but that caused a regression on [MSFT 33353327](https://microsoft.visualstudio.com/OS/_workitems/edit/33353327). `IUiaData` also has `GetTextBuffer()` return a `TextBuffer&`, which cannot be checked for nullness. Instead, I decided to add a function to `IUiaData` that checks if we have a valid state. Since this is shared with Conhost and Conhost doesn't have this issue, I simply make that function say that it's always in a valid state. ## Validation Steps Performed - [X] Narrator can detect newly created terminals - [X] (On Windows Server 2022) Windows Terminal does not hang on launch
Adds a check before every UIA function call to ensure the terminal (specifically the buffer) is initialized before doing work. Both the `ScreenInfoUiaProvider` and the `UiaTextRange` are now covered. ## References Closes #11135 #10971 & #11042 ## Detailed Description of the Pull Request / Additional comments Originally, I tried applying this heuristic to all the `RuntimeClassInitialize` on `UiaTextRangeBase` with the philosophy of "a range pointing to an invalid buffer is invalid itself", but that caused a regression on [MSFT 33353327](https://microsoft.visualstudio.com/OS/_workitems/edit/33353327). `IUiaData` also has `GetTextBuffer()` return a `TextBuffer&`, which cannot be checked for nullness. Instead, I decided to add a function to `IUiaData` that checks if we have a valid state. Since this is shared with Conhost and Conhost doesn't have this issue, I simply make that function say that it's always in a valid state. ## Validation Steps Performed - [X] Narrator can detect newly created terminals - [X] (On Windows Server 2022) Windows Terminal does not hang on launch
Adds a check before every UIA function call to ensure the terminal (specifically the buffer) is initialized before doing work. Both the `ScreenInfoUiaProvider` and the `UiaTextRange` are now covered. ## References Closes #11135 #10971 & #11042 ## Detailed Description of the Pull Request / Additional comments Originally, I tried applying this heuristic to all the `RuntimeClassInitialize` on `UiaTextRangeBase` with the philosophy of "a range pointing to an invalid buffer is invalid itself", but that caused a regression on [MSFT 33353327](https://microsoft.visualstudio.com/OS/_workitems/edit/33353327). `IUiaData` also has `GetTextBuffer()` return a `TextBuffer&`, which cannot be checked for nullness. Instead, I decided to add a function to `IUiaData` that checks if we have a valid state. Since this is shared with Conhost and Conhost doesn't have this issue, I simply make that function say that it's always in a valid state. ## Validation Steps Performed - [X] Narrator can detect newly created terminals - [X] (On Windows Server 2022) Windows Terminal does not hang on launch
Alright folks, I'll be preparing servicing builds for this fix early next week (mostly because preparing and launching something on Friday feels like a bad idea.) Thanks again for your help and it should be in your hands soon! |
@miniksa Any timeline for when this will land in release (or a hint on how I can use the servicing build)? |
It's rolling out now! It was sent to some inside rings on Friday and it's rolling out to the remaining rings today to be ready for the Windows launch date tomorrow. I'll have patch notes and the releases up by end of day today. And hopefully the winget manifests too. Sorry, I'm a little behind schedule juggling things. @DHowett is out on vacation so I'm pretending to be him and I'm not as good a juggler! |
🎉This issue was addressed in #11312, which has now been successfully released as Handy links: |
🎉This issue was addressed in #11312, which has now been successfully released as Handy links: |
🎉This issue was addressed in #11312, which has now been successfully released as Handy links: |
After installing either Terminal 1.10 or Terminal Preview 1.11 (after its dependencies and winget), opening it the first time (or subsequent times) causes the window to hang indefinitely (the process shows as 'Not Responding' in Task Manager). A similar problem happens when clicking the + to open a new tab.
The problem happens regardless if the default terminal is either Powershell or others (like Command Prompt).
A partial workaround is to launch a second copy of the app while the instance is hung, then use Task Manager to kill the hung app. Once the hung process closes, the application opens as expected. The workaround does not address the new tab problem, but just the initial window opening.
If there is any logging or debug that can be enabled, please let me know.
The text was updated successfully, but these errors were encountered: