-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
Create a node-pty host process with flow control and event batching #74620
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Commit that moved the process into renderer: 35cee02 |
Commit that converted to use amd ed9cdf5 |
Did some exploration into this. How terminal processes are launched currently
Issues:
Using just the ext host
Issues:
Prototype: #81106 Moving the processes out of proc, this is how it used to be (before ext host processes)
Issues:
Proposed solution
[1] Uses ext host socket-based message protocol
Prototype: #81105 Note that this could be split into 2 stages:
On flow controlWe recently exposed a callback on xterm's write which fires when the data is parsed. This will make flow control much easier that the earlier proposals I talked about. For example we could provide a callback for event nth write and send messages over to TerminalPtyHostProcess to indicate where the renderer is at in parsing the data. |
Conpty can send a final screen update after ClosePseudoConsole which waits for the socket to be drained before continuing. When both the socket draining and closing occurs on the same thread a deadlock can occur which locks up VS Code's UI, the only ways to fix are to close the client or kill the misbehaving conhost instance. This change moves the handling of the conout named pipe to a Worker which bumps the minimum Node version requirement to 12 (10 with a flag). This change may also have positive performance benefits as called out in microsoft/vscode#74620 Fixes #375
Conpty can send a final screen update after ClosePseudoConsole which waits for the socket to be drained before continuing. When both the socket draining and closing occurs on the same thread a deadlock can occur which locks up VS Code's UI, the only ways to fix are to close the client or kill the misbehaving conhost instance. This change moves the handling of the conout named pipe to a Worker which bumps the minimum Node version requirement to 12 (10 with a flag). This change may also have positive performance benefits as called out in microsoft/vscode#74620 The worker change also happens for winpty, it seems to work there too. Fixes #375
I did an exploration into moving node-pty into the main process (#99897) and it worked pretty well. It's just a prototype and falls over when it comes to pty lifecycle management but it seems like it would be quite easy to tweak it to restore terminals across reloads #20013 if it lived in the main process (as the prototype shows). Another benefit is it speeds up the terminal output significantly, My plan is to eventually move node-pty into a process that's forked from the main process and then establishing a direct socket connection for the terminal if possible to the window so we keep pretty much everything of the main process except for the setting up of the connection. The branch in action with node-pty hosted on the main process and (the hacky) reload persistence: |
I split the flow control and event batching portion of this into #113827 |
Update: #116373 will be merged soon which will:
I'll close this issue when the above gets merged and defer the following to more targeted issues:
|
As of around a year ago node-pty is launched directly from the renderer process, while this does mean ctrl+c is responsive it has several downsides:
My proposal for these problems:
The text was updated successfully, but these errors were encountered: