[PR #2198] [MERGED] Remove job object and startup suspended behavior #24855

Open
opened 2026-01-31 09:05:46 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/2198
Author: @miniksa
Created: 8/1/2019
Status: Merged
Merged: 8/2/2019
Merged by: @miniksa

Base: masterHead: dev/miniksa/job


📝 Commits (1)

  • a0c4281 Remove job object and startup suspended behavior because conhosts should clean themselves up.

📊 Changes

1 file changed (+11 additions, -31 deletions)

View changed files

📝 src/cascadia/TerminalConnection/ConhostConnection.cpp (+11 -31)

📄 Description

Summary of the Pull Request

Removes the ConhostConnection work that set up a job object and created everything suspended. I don't believe this is or should be necessary as the ConPTY'd conhost should realize that the server end of the connection is gone and gracefully shut down (and tell its clients to shut down).

PR Checklist

Detailed Description of the Pull Request / Additional comments

I believe that using a job here is just covering up an underlying problem with outstanding handles, bad eventing, or other message communication failures. The job is a big hammer solution to just terminate everything when the terminal goes down, which I believe is responsible for some of the pwsh.exe post-mortem debugger sessions I'm seeing (as the conhost goes down and then pwsh throws an unhandled exception).

Overall, if there's an issue in this area, I think we can debug and diagnose it individually and fix the leftover handle, untriggered/unhandled event, etc. So I'm taking out the job object and we'll see how things go.

Also, I believe some of the issues that this was covering up have been resolved in other ways between when it was installed and now. I did some playing around and didn't get any orphaned conhost.exes (or their clients). So this must be already better than it used to be.

Validation Steps Performed

Launched Terminal, closed it normally.
Launched Terminal, killed it in process explorer.
Launched Terminal with many tabs of varying types (pwsh, powershell, cmd) and killed Terminal in process explorer.

In all cases, the conhosts and their children were cleaned up appropriately without the job object.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/2198 **Author:** [@miniksa](https://github.com/miniksa) **Created:** 8/1/2019 **Status:** ✅ Merged **Merged:** 8/2/2019 **Merged by:** [@miniksa](https://github.com/miniksa) **Base:** `master` ← **Head:** `dev/miniksa/job` --- ### 📝 Commits (1) - [`a0c4281`](https://github.com/microsoft/terminal/commit/a0c42813f108899461903853a38e1258b1d19e75) Remove job object and startup suspended behavior because conhosts should clean themselves up. ### 📊 Changes **1 file changed** (+11 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalConnection/ConhostConnection.cpp` (+11 -31) </details> ### 📄 Description <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Removes the `ConhostConnection` work that set up a job object and created everything suspended. I don't believe this is or should be necessary as the ConPTY'd conhost should realize that the server end of the connection is gone and gracefully shut down (and tell its clients to shut down). <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [X] Closes #2185 * [X] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [X] Tests added/passed * [X] Requires documentation to be updated * [X] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments I believe that using a job here is just covering up an underlying problem with outstanding handles, bad eventing, or other message communication failures. The job is a big hammer solution to just terminate everything when the terminal goes down, which I believe is responsible for some of the `pwsh.exe` post-mortem debugger sessions I'm seeing (as the conhost goes down and then pwsh throws an unhandled exception). Overall, if there's an issue in this area, I think we can debug and diagnose it individually and fix the leftover handle, untriggered/unhandled event, etc. So I'm taking out the job object and we'll see how things go. Also, I believe some of the issues that this was covering up have been resolved in other ways between when it was installed and now. I did some playing around and didn't get any orphaned conhost.exes (or their clients). So this must be already better than it used to be. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Launched Terminal, closed it normally. Launched Terminal, killed it in process explorer. Launched Terminal with many tabs of varying types (pwsh, powershell, cmd) and killed Terminal in process explorer. In all cases, the conhosts and their children were cleaned up appropriately without the job object. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:05:46 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#24855