-
Notifications
You must be signed in to change notification settings - Fork 36.4k
Open
Labels
freeze-slow-crash-leakVS Code crashing, performance, freeze and memory leak issuesVS Code crashing, performance, freeze and memory leak issuesterminal-processProblems launching processes, managing ptys, exiting, process leaks, etc.Problems launching processes, managing ptys, exiting, process leaks, etc.
Description
Expected behaviour
When opening and deleting a terminal the number of promises in pty-host stays the same
Actual behaviour
When opening and deleting a terminal, the number of promises in pty host seems to grow by one each time, specifically
Opening and deleting a terminal 97 times in VS Code 1.105.1:
// platform/terminal/node/terminalProcess.ts
this._ptyProcess = ptyProcess;
this._childProcessMonitor = this._register(new ChildProcessMonitor(ptyProcess.pid, this._logService));
this._childProcessMonitor.onDidChangeHasChildProcesses(value => this._onDidChangeProperty.fire({ type: ProcessPropertyType.HasChildProcesses, value }));
this._processStartupComplete = new Promise<void>(c => {
this.onProcessReady(() => c());
});{
"promisesWithStackTrace": [
{
"count": 97,
"properties": [
{
"name": "[[PromiseState]]",
"type": "string",
"value": "fulfilled"
},
{
"name": "[[PromiseResult]]",
"type": "undefined",
"value": "undefined"
}
],
"originalStack": [
"src/vs/platform/terminal/node/terminalProcess.ts:317:33",
"src/vs/platform/terminal/node/terminalProcess.ts:248:3",
"src/vs/platform/terminal/node/ptyService.ts:840:18",
"src/vs/platform/terminal/node/ptyService.ts:60:12"
]
}
],
"isLeak": true
}Additional information
Test script for leaked promises:
git clone [email protected]:SimonSiefke/vscode-memory-leak-finder.git &&
cd vscode-memory-leak-finder &&
npm ci &&
node packages/cli/bin/test.js --cwd packages/e2e --only terminal.create --runs 97 --check-leaks --measure promises-with-stack-trace --run-skipped-tests-anyway --measure-after --inspect-pty-host &&
cat .vscode-memory-leak-finder-results/pty-host/promises-with-stack-trace/terminal.create.jsonThe script can also be run with a local vscode version by passing --vscode-version "/some/custom/path/to/vscode/scripts/code.sh".
Also, sometimes the test can be flaky, so sometimes it may only work the second time or so.
Other
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.105.1
- OS Version: Ubuntu 25.04
Related: #276610
Metadata
Metadata
Assignees
Labels
freeze-slow-crash-leakVS Code crashing, performance, freeze and memory leak issuesVS Code crashing, performance, freeze and memory leak issuesterminal-processProblems launching processes, managing ptys, exiting, process leaks, etc.Problems launching processes, managing ptys, exiting, process leaks, etc.