Terminal v1.13 seems to shut down slower compared to 1.12 #16668

Closed
opened 2026-01-31 05:19:00 +00:00 by claunia · 23 comments
Owner

Originally created by @vefatica on GitHub (Feb 6, 2022).

I haven't seen that message in ages. But I'm seeing it (albeit, briefly) in WindowsTerminalPreview 1.13.10336.0 (and not in WindowsTerminal 1.12.10334.0). Both versions use "closeOnExit": "always". How do I avoid seeing that message? Thanks.

Originally created by @vefatica on GitHub (Feb 6, 2022). I haven't seen that message in ages. But I'm seeing it (albeit, briefly) in WindowsTerminalPreview 1.13.10336.0 (and not in WindowsTerminal 1.12.10334.0). Both versions use "closeOnExit": "always". How do I avoid seeing that message? Thanks.
Author
Owner

@j4james commented on GitHub (Feb 6, 2022):

This definitely works for me in 1.13.10336.0. Is it possible you've only applied the setting in some profiles, or maybe you've set it in the default profile, but then accidentally reset it one of the other profiles?

Also, can you give a specific set of steps to produce the error. For example, if I open a cmd shell and type findstr with no parameters, and then exit, that would be trigger the [process exited with code 2] message when "closeOnExit" is set to "never", but it exits immediately if "closeOnExit" is set to "always". Does that example trigger the message for you?

@j4james commented on GitHub (Feb 6, 2022): This definitely works for me in 1.13.10336.0. Is it possible you've only applied the setting in some profiles, or maybe you've set it in the default profile, but then accidentally reset it one of the other profiles? Also, can you give a specific set of steps to produce the error. For example, if I open a cmd shell and type `findstr` with no parameters, and then `exit`, that would be trigger the `[process exited with code 2]` message when "closeOnExit" is set to "never", but it exits immediately if "closeOnExit" is set to "always". Does that example trigger the message for you?
Author
Owner

@j4james commented on GitHub (Feb 6, 2022):

I've just done a quick search now, and I suspect this might be the same problem as #11608.

@j4james commented on GitHub (Feb 6, 2022): I've just done a quick search now, and I suspect this might be the same problem as #11608.
Author
Owner

@vefatica commented on GitHub (Feb 6, 2022):

If WindowsTerminalPreview 1.13.10336.0 has one tab and the shell in that tab (any shell) exits, the message shows (albeit, briefly) before WT itself exits. It does not prevent WT from exiting but it does slow it down.

This does not happen in WindowsTerminal 1.12.10334.0. [If it does, WT exits so quickly that I can't see it.]

@vefatica commented on GitHub (Feb 6, 2022): If WindowsTerminalPreview 1.13.10336.0 has one tab and the shell in that tab (any shell) exits, the message shows (albeit, briefly) before WT itself exits. It does not prevent WT from exiting but it does slow it down. This does not happen in WindowsTerminal 1.12.10334.0. [If it does, WT exits so quickly that I can't see it.]
Author
Owner

@237dmitry commented on GitHub (Feb 6, 2022):

It happens every time when closed terminal. What profile does not matter. This pop-up string with the exit code is annoying. You try to read it every time.

exit

@237dmitry commented on GitHub (Feb 6, 2022): It happens every time when closed terminal. What profile does not matter. This pop-up string with the exit code is annoying. You try to read it every time. ![exit](https://user-images.githubusercontent.com/78153320/152691755-fbd535f1-bd9f-4fbf-98ff-c019067b1fb8.png)
Author
Owner

@rashil2000 commented on GitHub (Feb 6, 2022):

I am also facing this issue. It didn't happen before 1.13. Even when exit code is 0, it shows up briefly.

@rashil2000 commented on GitHub (Feb 6, 2022): I am also facing this issue. It didn't happen before 1.13. Even when exit code is 0, it shows up briefly.
Author
Owner

@j4james commented on GitHub (Feb 6, 2022):

If WindowsTerminalPreview 1.13.10336.0 has one tab and the shell in that tab (any shell) exits, the message shows (albeit, briefly) before WT itself exits.

OK, I've just managed to reproduce that now. Most of the time I didn't see anything, but that may just be dependent on how fast it closes.

@j4james commented on GitHub (Feb 6, 2022): > If WindowsTerminalPreview 1.13.10336.0 has one tab and the shell in that tab (any shell) exits, the message shows (albeit, briefly) before WT itself exits. OK, I've just managed to reproduce that now. Most of the time I didn't see anything, but that may just be dependent on how fast it closes.
Author
Owner

@vefatica commented on GitHub (Feb 6, 2022):

Well it makes a big difference in how fast windowsterminal.exe exits. With my setup (unzip only and hand-made AppPaths and context menu entries), it's easy to do a test like this.

First the stable 1.12.

v:\> timer /q & do i=1 to 10 (start /wait D:\wt\exe\windowsterminal.exe nt cmd /c exit) & timer
Timer 1 off: 12:35:02  Elapsed: 0:00:02.994

Then the preview 1.13.

v:\> timer /q & do i=1 to 10 (start /wait D:\wtp\exe\windowsterminal.exe nt cmd /c exit) & timer
Timer 1 off: 12:40:05  Elapsed: 0:00:06.402
@vefatica commented on GitHub (Feb 6, 2022): Well it makes a big difference in how fast windowsterminal.exe exits. With my setup (unzip only and hand-made AppPaths and context menu entries), it's easy to do a test like this. First the stable 1.12. ``` v:\> timer /q & do i=1 to 10 (start /wait D:\wt\exe\windowsterminal.exe nt cmd /c exit) & timer Timer 1 off: 12:35:02 Elapsed: 0:00:02.994 ``` Then the preview 1.13. ``` v:\> timer /q & do i=1 to 10 (start /wait D:\wtp\exe\windowsterminal.exe nt cmd /c exit) & timer Timer 1 off: 12:40:05 Elapsed: 0:00:06.402 ```
Author
Owner

@j4james commented on GitHub (Feb 6, 2022):

Yeah, it looks to me like this message has always been displayed on exit (at least since this functionality was added in PR #3623). So I think you're only noticing it now because of the exit speed.

@j4james commented on GitHub (Feb 6, 2022): Yeah, it looks to me like this message has always been displayed on exit (at least since this functionality was added in PR #3623). So I think you're only noticing it now because of the exit speed.
Author
Owner

@DHowett commented on GitHub (Feb 6, 2022):

Right; it's not the message that made exit slower, it is that a slower exit made the message obvious.

@DHowett commented on GitHub (Feb 6, 2022): Right; it's not the message that made exit slower, it is that a slower exit made the message obvious.
Author
Owner

@rashil2000 commented on GitHub (Feb 6, 2022):

Right; it's not the message that made exit slower, it is that a slower exit made the message obvious.

I feel so too. When I have multiple pwsh tabs open, I can see the exit code only in the last remaining tab (when I start closing all of them).

@rashil2000 commented on GitHub (Feb 6, 2022): > Right; it's not the message that made exit slower, it is that a slower exit made the message obvious. I feel so too. When I have multiple pwsh tabs open, I can see the exit code only in the last remaining tab (when I start closing all of them).
Author
Owner

@vefatica commented on GitHub (Feb 6, 2022):

Why is it so darned slow?

@vefatica commented on GitHub (Feb 6, 2022): Why is it so darned slow?
Author
Owner

@lhecker commented on GitHub (Feb 6, 2022):

In 3bd3a4f712 I've changed the process exit for conhost from

TerminateProcess(GetCurrentProcess(), hr);

to

ExitProcess(hr);

The latter runs the destructors of global variables and the former doesn't. (I wasn't aware about this detail when I made the change.) Maybe that's the cause for the slowdown?

@lhecker commented on GitHub (Feb 6, 2022): In 3bd3a4f712006d752b59d66e104aeb6bc5f7f9d6 I've changed the process exit for conhost from ```cpp TerminateProcess(GetCurrentProcess(), hr); ``` to ```cpp ExitProcess(hr); ``` The latter runs the destructors of global variables and the former doesn't. (I wasn't aware about this detail when I made the change.) Maybe that's the cause for the slowdown?
Author
Owner

@DHowett commented on GitHub (Feb 6, 2022):

In 3bd3a4f712 I've changed the process exit for conhost from


TerminateProcess(GetCurrentProcess(), hr);

to


ExitProcess(hr);

The latter runs the destructors of global variables and the former doesn't. (I wasn't aware about this detail when I made the change.) Maybe that's the cause for the slowdown?

This may not be related; by the time we get an exit code from the process in terminal, we have shut down the PTY... or the PTY should be exiting. I don't believe we wait for it before tearing down Terminal.

@DHowett commented on GitHub (Feb 6, 2022): > In 3bd3a4f712006d752b59d66e104aeb6bc5f7f9d6 I've changed the process exit for conhost from > > ```cpp > > TerminateProcess(GetCurrentProcess(), hr); > > ``` > > > > to > > ```cpp > > ExitProcess(hr); > > ``` > > > > The latter runs the destructors of global variables and the former doesn't. (I wasn't aware about this detail when I made the change.) Maybe that's the cause for the slowdown? This may not be related; by the time we get an exit code from the process in _terminal_, we have shut down the PTY... or the PTY should be exiting. I don't believe we wait for it before tearing down Terminal.
Author
Owner

@zadjii-msft commented on GitHub (Feb 7, 2022):

Alright so this thread seems to have veered a little from its origin, and I'm having a hard time figuring out what the real issue is here.

Is root of this issue "Terminal 1.13 seems to shut down slower than 1.12 did"? I want to untangle the real root of the issue from the perceived causes.

@zadjii-msft commented on GitHub (Feb 7, 2022): Alright so this thread seems to have veered a little from its origin, and I'm having a hard time figuring out what the real issue is here. Is root of this issue "Terminal 1.13 seems to shut down slower than 1.12 did"? I want to untangle the real root of the issue from the perceived causes.
Author
Owner

@vefatica commented on GitHub (Feb 7, 2022):

When I started this thread I didn't know whether the message caused the slow shutdown or a slowed shutdown allowed me to see the message. If the experts above got it right, it's the latter, and the question would seem to be "Why is the shutdown slower?" ... which quickly leads to "What can be done about it?".

@vefatica commented on GitHub (Feb 7, 2022): When I started this thread I didn't know whether the message caused the slow shutdown or a slowed shutdown allowed me to see the message. If the experts above got it right, it's the latter, and the question would seem to be "Why is the shutdown slower?" ... which quickly leads to "What can be done about it?".
Author
Owner

@vefatica commented on GitHub (Mar 27, 2022):

This is no longer an issue in WindowsTerminalPreview 1.13.10733.0.

Is there a discussion of a fix somewhere? I'd like to know more.

@vefatica commented on GitHub (Mar 27, 2022): This is no longer an issue in WindowsTerminalPreview 1.13.10733.0. Is there a discussion of a fix somewhere? I'd like to know more.
Author
Owner

@DHowett commented on GitHub (Mar 28, 2022):

Huh! If we fixed it, it was an accident ... or it was crashing on shutdown and it isn't any longer (and us fixing it was still an accident!)

@DHowett commented on GitHub (Mar 28, 2022): Huh! If we fixed it, it was an accident ... or it was crashing on shutdown and it isn't any longer (and us fixing it was still an accident!)
Author
Owner

@vefatica commented on GitHub (Mar 28, 2022):

I dunno! (And no complaints). The WT window is dissapearing lightning fast. I have a key hardware mapped to "[Esc]exit[Enter]". When I use it with one tab open, WT diasppears before I see the whole word "exit" on the command line.

@vefatica commented on GitHub (Mar 28, 2022): I dunno! (And no complaints). The WT window is dissapearing lightning fast. I have a key hardware mapped to "[Esc]exit[Enter]". When I use it with one tab open, WT diasppears before I see the whole word "exit" on the command line.
Author
Owner

@zadjii-msft commented on GitHub (Mar 28, 2022):

Cool I guess? I'll tag this up so the bot will close this out in a week. If this comes back, feel free to hop in the thread, otherwise I'll say we totally figured this out 😝

@zadjii-msft commented on GitHub (Mar 28, 2022): Cool I guess? I'll tag this up so the bot will close this out in a week. If this comes back, feel free to hop in the thread, otherwise I'll say we _totally figured this out_ 😝
Author
Owner

@vefatica commented on GitHub (Mar 28, 2022):

Hmmm! I'm still curious. @j4james said he repro'd it. Maybe he sees an improvement now and will chime in.

@vefatica commented on GitHub (Mar 28, 2022): Hmmm! I'm still curious. @j4james said he repro'd it. Maybe he sees an improvement now and will chime in.
Author
Owner

@zadjii-msft commented on GitHub (Sep 1, 2022):

Anyone still seeing this 5 months later/?

@zadjii-msft commented on GitHub (Sep 1, 2022): Anyone still seeing this 5 months later/?
Author
Owner

@vefatica commented on GitHub (Sep 1, 2022):

Anyone still seeing this 5 months later/?

I haven't seen it in ages.

@vefatica commented on GitHub (Sep 1, 2022): > Anyone still seeing this 5 months later/? I haven't seen it in ages.
Author
Owner

@zadjii-msft commented on GitHub (Sep 1, 2022):

Good enough for me.

@zadjii-msft commented on GitHub (Sep 1, 2022): Good enough for me.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16668