Remove job object and startup suspended behavior #2198
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
Removes the
ConhostConnectionwork 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.exepost-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.