vscode: extra terminal processes hanging around on restart

Testing #174837

Regardless of window.experimental.sharedProcessUseUtilityProcess, for every N terminals in a window, and R restarts, there are N * R processes shown in the activity monitor.

https://user-images.githubusercontent.com/29464607/220416103-e771334a-5df1-44d9-bbf4-630ce5413fa0.mov

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 28 (23 by maintainers)

Commits related to this issue

Most upvoted comments

The fix has not been merged into v1.77, it is available in https://code.visualstudio.com/insiders/ and will be available in v1.78

I can easily reproduce this in a vanilla Ubuntu using bash. The problem is the shell integration shell traps signals and ignores SIGTERM. The SIGKILL signal works just fine. https://github.com/microsoft/vscode/issues/176549

Minimal test case to repro the leak.

var pty = require('node-pty');

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

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

ptyProcess.onExit((ev) => {
    console.log(`pty exited with ${ev.exitCode}`);
});

ptyProcess.write('ls\n');

@Tyriar I can investigate this today.

Thanks for confirming, the fix will be available with v1.78 next week.

Similar issue on Linux. On Ubuntu 22.04 on macOS Parallels, the shell integration scripts remain after closing code-insiders: /usr/bin/bash --init-file /usr/share/code-insiders/resources/app/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh. Using ps aux | grep code-insiders, the status of those processes is Ss+ (waiting for an event to complete, and is a “session leader in the foreground process group”). I’m wondering whether something might be causing the shell integration scripts to fail to complete?