Skip to content

All terminals in all VSCode windows crashing with PTY Host error with long input in a terminal window #252018

Open
@jdthorpe

Description

@jdthorpe

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.101.1, 1.100.3 (the two I tried)
  • OS Version: Mac OS 15.5 (24F74)

Steps to Reproduce:

  1. Paste commands in the terminal such that commands are sent to the sub-process when it's unresponsive. For example, These lines pasted into an R session will cause the error:
Sys.sleep(1)
print("hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello ello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello ")
print("hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello ello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello ")
  1. All terminal windows in all VSCode windows freeze and a message stating that "The connection to the terminal's PTY Host process is unresponsive, terminals may stop working. Click to manually restart the pty host." Clicking the "Pty host" message restarts the terminal that caused the failure, and all other terminals in all other VS Code windows remain frozen causing all work in all open terminals in all instances of VS Code to be lost.
    I don't think this error with the node-pty library, as I can run the following .mjs code (adapted from the node-pty README) without issue:
import * as os from "node:os";
import * as pty from "node-pty";

const shell = os.platform() === "win32" ? "powershell.exe" : "bash";

const ptyProcess = pty.spawn(shell, [], {
  name: "xterm-color",
  cols: 80,
  rows: 30,
  cwd: process.env.HOME,
  env: process.env,
});

ptyProcess.onData((data) => {
  process.stdout.write(data);
});

ptyProcess.write("which R\r");
ptyProcess.write("R\r");
const problemCommand = `
Sys.sleep(1)
print("hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hhello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello")
print("hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hhello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello")
`;
ptyProcess.write(problemCommand);

ptyProcess.resize(100, 40);
ptyProcess.write("q(save='no')\r");
ptyProcess.write("exit\r");

This issue persisist when disabling all the extensions, and in vscode-insiders. Also, this issue does not occur for me in a regular terminal session.

I noticed this after installing the most recent xcode command line tools on Intel Mac, but don't observe this issue on my windows silicon mac.

This issue occurs with both the universal and intel VSCode installations.

Metadata

Metadata

Assignees

Labels

new releaseIssues found in a recent release of VS Code

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions