Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminal pty host unresponsive after closing a VS Code window #117956

Closed
eamodio opened this issue Mar 2, 2021 · 24 comments · Fixed by #123782
Closed

Terminal pty host unresponsive after closing a VS Code window #117956

eamodio opened this issue Mar 2, 2021 · 24 comments · Fixed by #123782
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders terminal Integrated terminal issues terminal-conpty Integrated terminal issues related to the ConPTY backend verified Verification succeeded windows VS Code on Windows issues
Milestone

Comments

@eamodio
Copy link
Contributor

eamodio commented Mar 2, 2021

I've seen this happen a few times now, and this last time it seemed to happen right after I closed a VS Code window. After that, I got the following notification in all my other open VS Code windows.

image

Here is the Shared Process output

[2021-03-02 03:11:02.588] [sharedprocess] [warning] No ptyHost heartbeat after 6 seconds
[2021-03-02 03:11:07.592] [sharedprocess] [error] No ptyHost heartbeat after 12 seconds
[2021-03-02 03:11:40.245] [sharedprocess] [error] [uncaught exception in sharedProcess]: Could not find pty with id "4": Error: Could not find pty with id "4"
    at P._throwIfNoPty (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:12:36591)
    at P.shutdown (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:12:35103)
    at Object.call (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:11:8178)
    at C.onPromise (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:10:27579)
    at C.onRawMessage (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:10:26938)
    at c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:10:26191
    at A.fire (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:8:1836)
    at process.Z (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:6:30611)
    at process.emit (events.js:315:20)
    at emit (internal/child_process.js:876:12)
    at processTicksAndRejections (internal/process/task_queues.js:85:21)
[2021-03-02 03:11:40.303] [sharedprocess] [error] [uncaught exception in sharedProcess]: Could not find pty with id "2": Error: Could not find pty with id "2"
    at P._throwIfNoPty (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:12:36591)
    at P.resize (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:12:35219)
    at Object.call (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:11:8178)
    at C.onPromise (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:10:27579)
    at C.onRawMessage (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:10:26938)
    at c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:10:26191
    at A.fire (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:8:1836)
    at process.Z (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:6:30611)
    at process.emit (events.js:315:20)
    at emit (internal/child_process.js:876:12)
    at processTicksAndRejections (internal/process/task_queues.js:85:21)
[2021-03-02 03:11:40.838] [sharedprocess] [error] [uncaught exception in sharedProcess]: Could not find pty with id "2": Error: Could not find pty with id "2"
    at P._throwIfNoPty (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:12:36591)
    at P.shutdown (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:12:35103)
    at Object.call (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:11:8178)
    at C.onPromise (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:10:27579)
    at C.onRawMessage (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:10:26938)
    at c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:10:26191
    at A.fire (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:8:1836)
    at process.Z (c:\Users\Eric\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\platform\terminal\node\ptyHostMain.js:6:30611)
    at process.emit (events.js:315:20)
    at emit (internal/child_process.js:876:12)
    at processTicksAndRejections (internal/process/task_queues.js:85:21)
@Tyriar Tyriar added this to the March 2021 milestone Mar 2, 2021
@Tyriar Tyriar added bug Issue identified by VS Code Team member as probable bug terminal Integrated terminal issues windows VS Code on Windows issues labels Mar 2, 2021
@Tyriar
Copy link
Member

Tyriar commented Mar 2, 2021

Going to look into whether we can wait for the process input to stop before actually killing the process for windows as another workaround for #71966. This process can take a bit of time now if needed since it's off the window being shutdown which has limited time to react.

@Tyriar
Copy link
Member

Tyriar commented Mar 2, 2021

It looks like we are using the same method as before where we indicate to dispose immediate.

this.terminalInstances.forEach(instance => instance.dispose(true));

Perhaps it's different before because the window going down would more aggressively shut down its child processes?

@Tyriar
Copy link
Member

Tyriar commented Mar 2, 2021

@eamodio @meganrogge we can consider bringing this in for the recovery build if we start seeing reports.

@donvanone
Copy link

No, a few seconds after I open a second VSCode instance, this error message appears in both instances. It also happens if I open a second terminal in one instance

@Tyriar
Copy link
Member

Tyriar commented Mar 3, 2021

@donvanone an extension may be closing the terminal, or it might be getting relaunched if an extension changes the environment (like the git extension will do when opening a new workspace). Does it happen if you open a new window and then wait 10 seconds before opening a terminal, such that extensions can activate?

@donvanone
Copy link

I had the problem even with uninstalled extensions. But the good old "did you try turning it off an on again" helped. After a windows reboot, everything works fine

@Tyriar
Copy link
Member

Tyriar commented Mar 11, 2021

To clarify the scope of this fix since @eamodio is still seeing lingering issues in insiders for this that we aren't able to nail down. Verified here means that the mechanism to delay killing the process on Windows for up to 5 seconds works as expected.

@DavyLandman
Copy link

Don't know if this helps, but I've noticed that it consistently happens if I open a terminal in 2nd level (is that the vscode term for running vscode "inside" vscode?), after closing that 2nd level all terminals are stuck.

@creage
Copy link

creage commented Apr 1, 2021

VSCode 1.55.0, the issue is still there.

Single instance of VSCode looks fine, but starting another instance fires the warning almost immediately, breaking terminals in both instances.

@Teut2711
Copy link

Teut2711 commented Apr 7, 2021

It did not happened with git console but happens a lot with powershell but git has this other problem https://stackoverflow.com/questions/62685569/error-while-installing-python-extensions-cant-open-file-directory-filename .

@joshuaclausen
Copy link

I've been getting this recently, though consistently throughout my day, while doing remote ssh sessions through the vscode terminal window. I open a new terminal and then use wsl2, and within wsl2 doing the ssh sessions. I experience this in both of the following VSCode versions:

Version: 1.55.1 (user setup)
Commit: 08a217c
Date: 2021-04-07T15:06:02.360Z
Electron: 11.3.0
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Windows_NT x64 10.0.19043

Version: 1.56.0-insider (user setup)
Commit: 845efe5
Date: 2021-04-09T09:50:06.816Z
Electron: 11.4.2
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Windows_NT x64 10.0.19043

@egamma egamma reopened this Apr 13, 2021
Tyriar added a commit that referenced this issue Apr 13, 2021
This pushes the polling for Windows terminal shutdowns into TerminalProcess
itself so it's not possible to shutdown a Windows terminal immediately.

Part of #117956
Tyriar added a commit that referenced this issue Apr 22, 2021
@ghost
Copy link

ghost commented Apr 26, 2021

for me, even single instanse of vscode show this message, if i want to restart "watch" task

@Tyriar
Copy link
Member

Tyriar commented Apr 27, 2021

Update: #121336 (comment)

@rzhao271 rzhao271 removed candidate Issue identified as probable candidate for fixing in the next release verified Verification succeeded labels May 4, 2021
@jpelton-stroud
Copy link

jpelton-stroud commented May 5, 2021

Started getting this error in VSCode 1.55.2 after upgrading to Chrome OS v90; appears to cause the whole VM to seize. Persists after full powerwash & fresh VM/Code install, no exts enabled. :(

UPDATE: FWIW, I have not experienced the issue on Chrome OS Version 90.0.4430.100 since updating to Code v1.56.0

@LordMidi
Copy link

LordMidi commented May 6, 2021

I'm getting this error all the time since some months. If I start an npm script in VS Code this error occurs. So I had to switch to the git bash terminal (Windows). Hope this gets fixed...
Still happens with 1.56.0

@Tyriar Tyriar added the terminal-conpty Integrated terminal issues related to the ConPTY backend label May 13, 2021
@SFeldman-Accenture
Copy link

I am receiving this same error myself. I only have a few extensions installed and I've been extremely stable until I installed the PowerShell Extension. At that point I immediately receive the error that "The connection to the terminal's pty host process is unresponsive", as well as two others: "the language service could not be started", and "Loading the PowerShell extension is taking longer than expected. If you're using privilege enforcement software, this can affect start up performance"

I'm pretty new to using VS and programming in general so I'm not sure what to do about this.

@Tyriar
Copy link
Member

Tyriar commented May 14, 2021

@SFeldman-Accenture this should be fixed in the Insiders build as of today, coming to stable in a month or so.

@SFeldman-Accenture
Copy link

@SFeldman-Accenture this should be fixed in the Insiders build as of today, coming to stable in a month or so.

Hey @Tyriar, forgive me if this is a dumb question but the Insiders build is kind of like a "beta" build? So there's the potential for it to have issues in other areas? Just weighing the pros and cons of getting the extension working vs. potentially having issues in other areas.

@Tyriar
Copy link
Member

Tyriar commented May 14, 2021

@SFeldman-Accenture yes it is, you may get some instability but also access to new fixes/features. But this issue is fixed (finally), it just won't be available in stable until early next month.

@Tyriar
Copy link
Member

Tyriar commented May 14, 2021

@SFeldman-Accenture sounds like you have the accessibility mode on, click the "screen reader optimized" button in the status bar.

@Vistur
Copy link

Vistur commented Jun 2, 2021

I get this all the time even in the Insiders build and with no extensions. It started for me right after updating to macOS Big Sur v11.4

@Tyriar
Copy link
Member

Tyriar commented Jun 2, 2021

@Vistur this is the only know case where this can happen on macOS #119090

@RomanDavlyatshin
Copy link

RomanDavlyatshin commented Jun 4, 2021

@Tyriar I'm getting this issue all the time at Windows10 (so I guess it's not just related to macOS)
I usually keep open plenty of VS code projects (usually 2-5 at the same time).
TBH it just got so unbearable, I launch external terminals manually whenever it's possible. (So basically every time, except when I'm using a debugger)

My system specs are

Version: 1.56.2 (user setup)
Commit: 054a9295330880ed74ceaedda236253b4f39a335
Date: 2021-05-12T17:13:13.157Z (3 wks ago)
Electron: 12.0.4
Chrome: 89.0.4389.114
Node.js: 14.16.0
V8: 8.9.255.24-electron.0
OS: Windows_NT x64 10.0.19042

Any feedback/fix suggestions are greatly appreciated

@Tyriar
Copy link
Member

Tyriar commented Jun 4, 2021

@RomanDavlyatshin the new release which fixes this should be out next week.

@meganrogge meganrogge added the verified Verification succeeded label Jun 7, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jun 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders terminal Integrated terminal issues terminal-conpty Integrated terminal issues related to the ConPTY backend verified Verification succeeded windows VS Code on Windows issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

17 participants