vscode icon indicating copy to clipboard operation
vscode copied to clipboard

VS Code crashes when I open .gitignore in a Mac workspace, both locally and from Windows

Open jasonftl opened this issue 1 week ago • 1 comments

VS Code runs out of memory during workspace.findFiles() in a large workspace with symlink loops.

Although it is an extension calling vscode.workspace.findFiles() I beleive the bug to be within VS Code itself. I would expect vscode.workspace.findFiles() to handle symlink loops without crashing.

My project is on a Mac and has a link to a large folder that contains symlink loops. When I open .gitignore, my extension, called IgnoreLens, counts the files covered by each rule. VS Code crashes while I wait for the counts. This happens both when I open the workspace directly on the Mac and when I connect to it from Windows. It works if I remove the symlink loops. It works if I use my own logic to count the files rather than vscode.workspace.findFiles(). I have that update to my extension in UAT but first thought I'd report the potential VS Code bug here to see if others agree.

What I did

  1. I opened the large workspace with nested symlink loops. I tried this directly on the Mac and from Windows using Remote - SSH. In both tests, I used the version of IgnoreLens that counts files with vscode.workspace.findFiles().
  2. I selected .gitignore and waited for the file counts to appear.

I expected to see the counts and carry on editing. On both computers, VS Code crashed and the window closed before I saw the counts.

On Windows, VS Code showed the error The window terminated unexpectedly (reason: 'oom', code: '-536870904') and offered to reopen the window.

On the Mac, VS Code showed the error The window terminated unexpectedly (reason: 'crashed', code: '5') and offered to reopen the window.

Evidence

  • Setup: VS Code 1.147.0 on both desktops. The local test used macOS 27.2.1 (arm64). The remote test used Windows x64 (build 26300.9974), Remote - SSH 0.128.0, and VS Code Server 1.147.0 on the Mac.
  • Search: The extension calls vscode.workspace.findFiles(new vscode.RelativePattern(folder, '**/*'), null). The workspace contains nested directory symlink loops. Reproduction is with all extensions disabled except the one extension that calls vscode.workspace.findFiles().
  • Windows crash: The log reports CodeWindow: renderer process gone (reason: oom, code: -536870904). The Windows renderer reached 7.51 GiB of private memory. The remote extension host on the Mac stayed running.
  • Local Mac crash: The log reports CodeWindow: renderer process gone (reason: crashed, code: 5). The renderer peaked at 6.44 GiB RSS. Its crash dump shows that 4,023.8 MB of JavaScript heap remained in use after the last garbage collection.
  • What the dumps have in common: The local Mac dump and two Windows dumps record MarkCompactCollector: young object promotion failed. The Mac dump and one Windows dump both name getResults. I don't know which allocation caused the crash.
  • Windows and Mac evidence. vscode-renderer-oom-evidence.zip contains screenshots of both error dialogues, log excerpts, crash-dump extracts, and memory samples from both tests.

jasonftl avatar Nov 25 '26 10:11 jasonftl