Closing a tab doesn't terminate its associated process(es) #797

Closed
opened 2026-01-30 22:04:24 +00:00 by claunia · 7 comments
Owner

Originally created by @0xabu on GitHub (May 7, 2019).

When I close a tab (either via Ctrl-W or the close gadget), the underlying processes don't seem to be terminated. For example, this is what task manager shows if I've opened a few tabs and closed them:
image
At the time I took this screenshot, there was only a single tab open.

  • Your Windows build number: 18362
Originally created by @0xabu on GitHub (May 7, 2019). When I close a tab (either via Ctrl-W or the close gadget), the underlying processes don't seem to be terminated. For example, this is what task manager shows if I've opened a few tabs and closed them: ![image](https://user-images.githubusercontent.com/13037682/57335805-a4b3bb80-70d8-11e9-9b2e-d2ade13ff9a6.png) At the time I took this screenshot, there was only a single tab open. * Your Windows build number: 18362
Author
Owner

@DHowett-MSFT commented on GitHub (May 8, 2019):

We could probably do with some job objects, and we definitely have a handle leak. Thanks for the report!


From: Andrew Baumann notifications@github.com
Sent: Tuesday, May 7, 2019 3:02:23 PM
To: microsoft/Terminal
Cc: Subscribed
Subject: [microsoft/Terminal] Closing a tab doesn't terminate its associated process(es) (#541)

When I close a tab (either via Ctrl-W or the close gadget), the underlying processes don't seem to be terminated. For example, this is what task manager shows if I've opened a few tabs and closed them:
[image]https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F13037682%2F57335805-a4b3bb80-70d8-11e9-9b2e-d2ade13ff9a6.png&data=01%7C01%7Cduhowett%40microsoft.com%7Ca80d12f65e744b344cbf08d6d337b0eb%7C72f988bf86f141af91ab2d7cd011db47%7C1&sdata=5UAacXCGoz7ZoqU7s9LTvGruyaD7B61b8VfTiw6yL00%3D&reserved=0
At the time I took this screenshot, there was only a single tab open.

  • Your Windows build number: 18362


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTerminal%2Fissues%2F541&data=01%7C01%7Cduhowett%40microsoft.com%7Ca80d12f65e744b344cbf08d6d337b0eb%7C72f988bf86f141af91ab2d7cd011db47%7C1&sdata=xSrBZlaUrCBT%2BLTD5kfUytbViztJwv%2BxS6uL0OTU%2BZo%3D&reserved=0, or mute the threadhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FADNHLGSSJY3QLTYVB7C7QFDPUH367ANCNFSM4HLM2EQA&data=01%7C01%7Cduhowett%40microsoft.com%7Ca80d12f65e744b344cbf08d6d337b0eb%7C72f988bf86f141af91ab2d7cd011db47%7C1&sdata=FPc8UOLI8xsENh%2FTy8wnLj2srjQtcAkkG9DCmtd5%2BEQ%3D&reserved=0.

@DHowett-MSFT commented on GitHub (May 8, 2019): We could probably do with some job objects, and we definitely have a handle leak. Thanks for the report! ________________________________ From: Andrew Baumann <notifications@github.com> Sent: Tuesday, May 7, 2019 3:02:23 PM To: microsoft/Terminal Cc: Subscribed Subject: [microsoft/Terminal] Closing a tab doesn't terminate its associated process(es) (#541) When I close a tab (either via Ctrl-W or the close gadget), the underlying processes don't seem to be terminated. For example, this is what task manager shows if I've opened a few tabs and closed them: [image]<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F13037682%2F57335805-a4b3bb80-70d8-11e9-9b2e-d2ade13ff9a6.png&data=01%7C01%7Cduhowett%40microsoft.com%7Ca80d12f65e744b344cbf08d6d337b0eb%7C72f988bf86f141af91ab2d7cd011db47%7C1&sdata=5UAacXCGoz7ZoqU7s9LTvGruyaD7B61b8VfTiw6yL00%3D&reserved=0> At the time I took this screenshot, there was only a single tab open. * Your Windows build number: 18362 — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTerminal%2Fissues%2F541&data=01%7C01%7Cduhowett%40microsoft.com%7Ca80d12f65e744b344cbf08d6d337b0eb%7C72f988bf86f141af91ab2d7cd011db47%7C1&sdata=xSrBZlaUrCBT%2BLTD5kfUytbViztJwv%2BxS6uL0OTU%2BZo%3D&reserved=0>, or mute the thread<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FADNHLGSSJY3QLTYVB7C7QFDPUH367ANCNFSM4HLM2EQA&data=01%7C01%7Cduhowett%40microsoft.com%7Ca80d12f65e744b344cbf08d6d337b0eb%7C72f988bf86f141af91ab2d7cd011db47%7C1&sdata=FPc8UOLI8xsENh%2FTy8wnLj2srjQtcAkkG9DCmtd5%2BEQ%3D&reserved=0>.
Author
Owner

@shuffle2 commented on GitHub (Jun 2, 2019):

Was just making new issue, but noticed this one.

Environment

Windows build number: Microsoft Windows [Version 10.0.18362.145]
Windows Terminal version (if applicable): 880272c7483a3bb6893dbec3725d0eb7375ab78a

Steps to reproduce

Watch WindowsTerminal in procexp or something. Open and close tabs. Spawned processes are never killed until WindowsTerminal.exe is.

Expected behavior

The code attempts to close spawned processes with tabs, but there are some refcount leaks on a shared_ptr.

Actual behavior

Reference of newly created tab is given to 2 lambdas, which never die. It seems the API gives back a handle which you're supposed to use to remove the callback, which isn't currently done.
https://github.com/microsoft/terminal/blob/master/src/cascadia/TerminalApp/App.cpp#L765
https://github.com/microsoft/terminal/blob/master/src/cascadia/TerminalApp/App.cpp#L786

@shuffle2 commented on GitHub (Jun 2, 2019): Was just making new issue, but noticed this one. # Environment ```none Windows build number: Microsoft Windows [Version 10.0.18362.145] Windows Terminal version (if applicable): 880272c7483a3bb6893dbec3725d0eb7375ab78a ``` # Steps to reproduce Watch WindowsTerminal in procexp or something. Open and close tabs. Spawned processes are never killed until WindowsTerminal.exe is. # Expected behavior The code attempts to close spawned processes with tabs, but there are some refcount leaks on a `shared_ptr`. # Actual behavior Reference of newly created tab is given to 2 lambdas, which never die. It seems the API gives back a handle which you're supposed to use to remove the callback, which isn't currently done. https://github.com/microsoft/terminal/blob/master/src/cascadia/TerminalApp/App.cpp#L765 https://github.com/microsoft/terminal/blob/master/src/cascadia/TerminalApp/App.cpp#L786
Author
Owner

@DHowett-MSFT commented on GitHub (Jun 2, 2019):

There's also some process isolation issues that result in console hosts sticking around after WT exits; #970 seeks to fix some of that.

@DHowett-MSFT commented on GitHub (Jun 2, 2019): There's also some process isolation issues that result in console hosts sticking around after WT exits; #970 seeks to fix some of that.
Author
Owner

@zadjii-msft commented on GitHub (Jun 3, 2019):

@shuffle2 god find on those lines. I think I touched those in #825, but this issue will be helpful to make sure that those are fixed correctly.

@zadjii-msft commented on GitHub (Jun 3, 2019): @shuffle2 god find on those lines. I think I touched those in #825, but this issue will be helpful to make sure that those are fixed correctly.
Author
Owner

@zadjii-msft commented on GitHub (Jun 10, 2019):

Hey this was fixed in #541! Hooray!

Its also related to #745

@zadjii-msft commented on GitHub (Jun 10, 2019): Hey this was fixed in #541! Hooray! Its also related to #745
Author
Owner

@ms-xy commented on GitHub (Nov 16, 2021):

I want to report that this is still an issue. It is impossible to terminate a misbehaving child process without terminating the terminal in the process.

Example situation: I start a wildfly server. After a while it becomes unresponsive. I close the tab, but the process lingers and is not terminated, blocking ports. If I try to end the process via task manager, it also terminates the parent process, effectively closing all my other tabs. Which in turn renders the tab feature pretty much useless.

@ms-xy commented on GitHub (Nov 16, 2021): I want to report that this is still an issue. It is impossible to terminate a misbehaving child process without terminating the terminal in the process. Example situation: I start a wildfly server. After a while it becomes unresponsive. I close the tab, but the process lingers and is not terminated, blocking ports. If I try to end the process via task manager, it also terminates the parent process, effectively closing all my other tabs. Which in turn renders the tab feature pretty much useless.
Author
Owner

@zadjii-msft commented on GitHub (Nov 16, 2021):

@ms-xy This was a bug with a pretty specific root cause more than two years ago now - if you're seeing something similar, it's likely a new bug entirely. Mind filing a new issue? Knowing more about your exact setup might help debug & root-cause what you're seeing.

@zadjii-msft commented on GitHub (Nov 16, 2021): @ms-xy This was a bug with a pretty specific root cause more than two years ago now - if you're seeing something similar, it's likely a new bug entirely. Mind filing a new issue? Knowing more about your exact setup might help debug & root-cause what you're seeing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#797