Terminal Crash/Hangs when closing second-last tab quickly #5798

Closed
opened 2026-01-31 00:21:56 +00:00 by claunia · 8 comments
Owner

Originally created by @TBBle on GitHub (Jan 7, 2020).

Feedback Hub Link: https://aka.ms/AA6xn1u

Environment

Windows build number: Microsoft Windows NT 10.0.18363.0
Windows Terminal version (if applicable): 0.7.3451.0

Any other software?

Two shells have been involved in reproductions.
* PowerShell Core 7.0.0-rc1 auto-added as a shell. This is my default.
* MSYS has been added as a shell per https://github.com/microsoft/terminal/issues/1669#issuecomment-562082594

Steps to reproduce

Open Terminal, with alwaysShowTabs: false and showTabsInTitlebar: false.
Hit Control-Shift-1, Control-Shift-Tab, Control-Shift-W in sequence repeatedly until terminal crashes.

Note sure if it's the same problem, it showed up when I was trying to repro this more reliably.

Open Terminal, with alwaysShowTabs: false and showTabsInTitlebar: false.
Hit Control-Shift-1 (PowerShell Core my this case), then Control-Shift-W repeatedly until terminal hangs.

Expected behavior

Closing a tab should not crash Terminal.

Actual behavior

Closing a tab occasionally hangs or crashes terminal.

The behaviour of "Open Terminal, Start a different shell, Close the existing shell" is something I do frequently, and I see this crash once or twice in a work-day.

I think it generally happens when I'm just starting a session, but I cannot say with absolute certainty that it hasn't happened when closing a long-lived tab.

I also don't recall having ever triggered it by mouse activity, just Control-Shift-W.

Originally created by @TBBle on GitHub (Jan 7, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> Feedback Hub Link: https://aka.ms/AA6xn1u <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: Microsoft Windows NT 10.0.18363.0 Windows Terminal version (if applicable): 0.7.3451.0 Any other software? Two shells have been involved in reproductions. * PowerShell Core 7.0.0-rc1 auto-added as a shell. This is my default. * MSYS has been added as a shell per https://github.com/microsoft/terminal/issues/1669#issuecomment-562082594 ``` # Steps to reproduce Open Terminal, with alwaysShowTabs: false and showTabsInTitlebar: false. Hit Control-Shift-1, Control-Shift-Tab, Control-Shift-W in sequence repeatedly until terminal crashes. Note sure if it's the same problem, it showed up when I was trying to repro this more reliably. Open Terminal, with alwaysShowTabs: false and showTabsInTitlebar: false. Hit Control-Shift-1 (PowerShell Core my this case), then Control-Shift-W repeatedly until terminal hangs. <!-- A description of how to trigger this bug. --> # Expected behavior <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> Closing a tab should not crash Terminal. # Actual behavior <!-- What's actually happening? --> Closing a tab occasionally hangs or crashes terminal. The behaviour of "Open Terminal, Start a different shell, Close the existing shell" is something I do frequently, and I see this crash once or twice in a work-day. I think it *generally* happens when I'm just starting a session, but I cannot say with absolute certainty that it hasn't happened when closing a long-lived tab. I also don't recall having ever triggered it by mouse activity, just Control-Shift-W.
Author
Owner

@mkitzan commented on GitHub (Jan 14, 2020):

Tried a repro, and couldn't get the crash (and I can input pretty fast). @TBBle, is it possible that when you're inputting during a hang it might miss inputs to launch a new tab but receive the inputs correctly to close a tab (causing an extra tab to be closed without launching a new one)? This could close the window if the only remaining tab is closed.

@mkitzan commented on GitHub (Jan 14, 2020): Tried a repro, and couldn't get the crash (and I can input pretty fast). @TBBle, is it possible that when you're inputting during a hang it might miss inputs to launch a new tab but receive the inputs correctly to close a tab (causing an extra tab to be closed without launching a new one)? This could close the window if the only remaining tab is closed.
Author
Owner

@TBBle commented on GitHub (Jan 17, 2020):

I doubt that's it, because I was definitely getting Application errors in my Event Viewer, and sometimes it would hang Terminal rather than closing it.

That said, a new version of Terminal was just released which fixed #3908 in Terminal v0.8.10091.0, so it's possible I was hitting that, and if you happened to already have that update, then it wouldn't repro. So I'll try and repro it with the version I listed above, if I still have it, and then update to the newer version and try again.

@TBBle commented on GitHub (Jan 17, 2020): I doubt that's it, because I was definitely getting Application errors in my Event Viewer, and sometimes it would hang Terminal rather than closing it. That said, a new version of Terminal was just released which fixed #3908 in Terminal v0.8.10091.0, so it's possible I was hitting that, and if you happened to already have that update, then it wouldn't repro. So I'll try and repro it with the version I listed above, if I still have it, and then update to the newer version and try again.
Author
Owner

@TBBle commented on GitHub (Jan 17, 2020):

Turns out both the machines I have here have auto-updated to the new version of Terminal, and didn't reproduce the issue on brief testing. So if I'm lucky and my home box has not updated, I can try there. Otherwise, I'll probably have to close this as "Probably #3908 until proven otherwise".

@TBBle commented on GitHub (Jan 17, 2020): Turns out both the machines I have here have auto-updated to the new version of Terminal, and didn't reproduce the issue on brief testing. So if I'm lucky and my home box has not updated, I can try there. Otherwise, I'll probably have to close this as "Probably #3908 until proven otherwise".
Author
Owner

@mkitzan commented on GitHub (Jan 17, 2020):

I just noticed the version in your issue! Yeah, that PR fixed some crashes which repro-ed by opening-closing tabs quickly. It's highly likely that your crash was covered by that PR (or another related PR).

@mkitzan commented on GitHub (Jan 17, 2020): I just noticed the version in your issue! Yeah, that PR fixed some crashes which repro-ed by opening-closing tabs quickly. It's highly likely that your crash was covered by that PR (or another related PR).
Author
Owner

@TBBle commented on GitHub (Jan 17, 2020):

Repro is a little hard, because I often get stopped due to triggering this with my repro steps:
image

I suspect this dialog is really a PowerShell Core bug (I just installed 7.0.0-rc2, perhaps it's new), complaining about STATUS_DLL_INIT_FAILED because the terminal it was expecting to write to has disappeared.

@TBBle commented on GitHub (Jan 17, 2020): Repro is a little hard, because I often get stopped due to triggering this with my repro steps: ![image](https://user-images.githubusercontent.com/138397/72584017-8dea8780-393c-11ea-9825-55e2588986bc.png) I suspect this dialog is really a PowerShell Core bug (I just installed 7.0.0-rc2, perhaps it's new), complaining about `STATUS_DLL_INIT_FAILED` because the terminal it was expecting to write to has disappeared.
Author
Owner

@TBBle commented on GitHub (Jan 17, 2020):

Okay, sounds good. Closing this provisionally as "Fixed by #3908"/"Duplicate of #2947", unless I trigger it again.

For anyone who comes across this later, I didn't originally trigger this by fast-open-close loops, it was just sometimes happening on fast "Start Terminal, start non-default shell, close default shell".

@TBBle commented on GitHub (Jan 17, 2020): Okay, sounds good. Closing this provisionally as "Fixed by #3908"/"Duplicate of #2947", unless I trigger it again. For anyone who comes across this later, I didn't *originally* trigger this by fast-open-close loops, it was just sometimes happening on fast "Start Terminal, start non-default shell, close default shell".
Author
Owner

@mkitzan commented on GitHub (Jan 17, 2020):

The PS App Error is a PS thing - I think. If you open and close quickly a stand alone PS shell it does this (if I remember correctly when I tried it last).

@mkitzan commented on GitHub (Jan 17, 2020): The PS App Error is a PS thing - I think. If you open and close quickly a stand alone PS shell it does this (if I remember correctly when I tried it last).
Author
Owner

@zadjii-msft commented on GitHub (Jan 17, 2020):

For the record, I think the 0xc0000142 dialog is because the conhost.exe process that we're spawning to host pwsh.exe closes before pwsh is able to successfully connect. I see this a good amount whenever I write code that accidentally causes conhost to crash immediately on startup :P. In this case, closing the tab this quickly is just closing the conhost too fast.

@zadjii-msft commented on GitHub (Jan 17, 2020): For the record, I think the `0xc0000142` dialog is because the `conhost.exe` process that we're spawning to host `pwsh.exe` closes before `pwsh` is able to successfully connect. I see this a good amount whenever I write code that accidentally causes conhost to crash immediately on startup :P. In this case, closing the tab this quickly is just closing the conhost too fast.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#5798