Skip to content

Extension Host Keeps Crashing When Enabling Extensions With Tree-Sitter On VS Code > 1.98 #243747

Closed

Description

@lyngai

Type: Bug

  1. Enable a extension that use tree-sitter (e.g. sourcegraph.cody-ai) to parse code when the document was opened.
  2. Open the file HabitApp/ViewModels/HabitViewModel.swift in the provided repo and reload VS Code.
  3. The Extension Host Keeps Crashing and Restart.
  4. But We Cannot Reproduce the Bug under the development mode, only can Reproduce under the production build VS Code.
  5. When downgraded the VS Code to 1.97.2 or lower, all goes well again.

Repo: https://github.com/lyngai/swift-repo-crashes

VS Code version: Code 1.98.1 (Universal) (2fc07b8, 2025-03-10T15:38:08.854Z)
OS version: Darwin arm64 24.3.0
Modes:

System Info
Item Value
CPUs Apple M1 Pro (10 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 7, 6, 5
Memory (System) 32.00GB (0.07GB free)
Process Argv --crash-reporter-id ee6c6063-dc4d-4046-86aa-3ecac86adba5
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyonecf:30548226
962ge761:30959799
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dwnewjupytercf:31046870
nativerepl2:31139839
pythonrstrctxt:31112756
nativeloc2:31192216
iacca1:31171482
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
9064b325:31222308
copilot_t_ci:31222730
f5992895:31259995
jda6j935:31233686
fh1c7952:31258891
6h6a5794:31261449
h6j33387:31256343
0339e702:31259951

Activity

  1. vs-code-engineering commented on Mar 17, 2025

    @vs-code-engineering
    Contributor

    Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.98.2. Please try upgrading to the latest version and checking whether this issue remains.

    Happy Coding!

  2. lyngai commented on Mar 17, 2025

    @lyngai
    Author

    Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.98.2. Please try upgrading to the latest version and checking whether this issue remains.

    Happy Coding!

    Can reproduce using the latest version.

    Image
    #
    # Fatal process out of memory: Zone
    #
    ----- Native stack trace -----
     1: 0x11c445570 fontations_ffi$cxxbridge1$BridgeOutlineCollection$operator$sizeof [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
     2: 0x119ac1988 fontations_ffi$cxxbridge1$BridgeHintingInstance$operator$sizeof [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
     3: 0x1167ec664 node::GetEnvironmentIsolateData(node::Environment*) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
     4: 0x116eb3b64 v8::internal::Version::GetSONAME(v8::base::Vector<char>) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
     5: 0x11703e7d4 v8::internal::Version::GetSONAME(v8::base::Vector<char>) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
     6: 0x1177aa1fc v8::internal::compiler::CompilationDependencies::FieldTypeDependencyOffTheRecord(v8::internal::compiler::MapRef, v8::internal::compiler::MapRef, v8::internal::InternalIndex, v8::internal::compiler::ObjectRef) const [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
     7: 0x1177a9cd0 v8::internal::compiler::CompilationDependencies::FieldTypeDependencyOffTheRecord(v8::internal::compiler::MapRef, v8::internal::compiler::MapRef, v8::internal::InternalIndex, v8::internal::compiler::ObjectRef) const [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
     8: 0x1177a94ec v8::internal::compiler::CompilationDependencies::FieldTypeDependencyOffTheRecord(v8::internal::compiler::MapRef, v8::internal::compiler::MapRef, v8::internal::InternalIndex, v8::internal::compiler::ObjectRef) const [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
     9: 0x1177a8f20 v8::internal::compiler::CompilationDependencies::FieldTypeDependencyOffTheRecord(v8::internal::compiler::MapRef, v8::internal::compiler::MapRef, v8::internal::InternalIndex, v8::internal::compiler::ObjectRef) const [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
    10: 0x1177a84e0 v8::internal::compiler::CompilationDependencies::FieldTypeDependencyOffTheRecord(v8::internal::compiler::MapRef, v8::internal::compiler::MapRef, v8::internal::InternalIndex, v8::internal::compiler::ObjectRef) const [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
    11: 0x11745106c v8::internal::compiler::CompilationDependencies::FieldTypeDependencyOffTheRecord(v8::internal::compiler::MapRef, v8::internal::compiler::MapRef, v8::internal::InternalIndex, v8::internal::compiler::ObjectRef) const [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
    12: 0x117450228 v8::internal::compiler::CompilationDependencies::FieldTypeDependencyOffTheRecord(v8::internal::compiler::MapRef, v8::internal::compiler::MapRef, v8::internal::InternalIndex, v8::internal::compiler::ObjectRef) const [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
    13: 0x1177eb964 v8::internal::compiler::CompilationDependencies::FieldTypeDependencyOffTheRecord(v8::internal::compiler::MapRef, v8::internal::compiler::MapRef, v8::internal::InternalIndex, v8::internal::compiler::ObjectRef) const [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
    14: 0x1170e2230 v8::internal::Version::GetSONAME(v8::base::Vector<char>) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
    15: 0x1170e1e44 v8::internal::Version::GetSONAME(v8::base::Vector<char>) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
    16: 0x1170fe238 v8::internal::Version::GetSONAME(v8::base::Vector<char>) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
    17: 0x1170fdb5c v8::internal::Version::GetSONAME(v8::base::Vector<char>) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
    18: 0x11c442818 fontations_ffi$cxxbridge1$BridgeOutlineCollection$operator$sizeof [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
    19: 0x11c442f14 fontations_ffi$cxxbridge1$BridgeOutlineCollection$operator$sizeof [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
    20: 0x180e082e4 _pthread_start [/usr/lib/system/libsystem_pthread.dylib]
    21: 0x180e030fc thread_start [/usr/lib/system/libsystem_pthread.dylib]
    

    Extension Bisect points out a abnormal extension. But I'm sure this is a bug related to VS Code itself.

    Image
  3. added
    bug
    freeze-slow-crash-leak
    confirmed
    on Mar 18, 2025
  4. deepak1556 commented on Mar 18, 2025

    @deepak1556
    Collaborator

    crash is in the turboshaft optimizing compiler, I haven't looked into why it is crashing yet. Following can serve as a workaround,

    diff --git a/src/vs/workbench/services/extensions/electron-sandbox/localProcessExtensionHost.ts b/src/vs/workbench/services/extensions/electron-sandbox/localProcessExtensionHost.ts
    index 121a0913bd8..d5ea4bc12ba 100644
    --- a/src/vs/workbench/services/extensions/electron-sandbox/localProcessExtensionHost.ts
    +++ b/src/vs/workbench/services/extensions/electron-sandbox/localProcessExtensionHost.ts
    @@ -241,6 +241,7 @@ export class NativeLocalProcessExtensionHost implements IExtensionHost {
     
                    // Refs https://github.com/microsoft/vscode/issues/189805
                    opts.execArgv.unshift('--dns-result-order=ipv4first');
    +               opts.execArgv.unshift('--js-flags=--no-turboshaft-wasm');
     
                    // Catch all output coming from the extension host process
                    type Output = { data: string; format: string[] };
  5. lyngai commented on Mar 18, 2025

    @lyngai
    Author

    crash is in the turboshaft optimizing compiler, I haven't looked into why it is crashing yet. Following can serve as a workaround,

    diff --git a/src/vs/workbench/services/extensions/electron-sandbox/localProcessExtensionHost.ts b/src/vs/workbench/services/extensions/electron-sandbox/localProcessExtensionHost.ts
    index 121a0913bd8..d5ea4bc12ba 100644
    --- a/src/vs/workbench/services/extensions/electron-sandbox/localProcessExtensionHost.ts
    +++ b/src/vs/workbench/services/extensions/electron-sandbox/localProcessExtensionHost.ts
    @@ -241,6 +241,7 @@ export class NativeLocalProcessExtensionHost implements IExtensionHost {

                // Refs https://github.com/microsoft/vscode/issues/189805
                opts.execArgv.unshift('--dns-result-order=ipv4first');
    
    •           opts.execArgv.unshift('--js-flags=--no-turboshaft-wasm');
      
                // Catch all output coming from the extension host process
                type Output = { data: string; format: string[] };
      

    it works fine using this patch

  6. lyngai commented on Mar 18, 2025

    @lyngai
    Author

    Robo (@deepak1556) Will this problem be fixed in the next patch release of VS Code 1.98?

  7. deepak1556 commented on Mar 18, 2025

    @deepak1556
    Collaborator

    I haven't been able to repro the issue in an example extension, using the same steps as cody to load the tree-sitter wasm on the provided swift files. So without identifying the root cause I can't guarantee a fix just yet, will post updates here as I make progress

    function activate(context) {
    	console.log('Congratulations, your extension "helloworld-minimal-sample" is now active!');
    	let disposable = vscode.commands.registerCommand('extension.helloWorld', async () => {
    		await Parser.init();
    		const Swift = await Parser.Language.load("<Path-to>/sourcegraph.cody-ai-1.76.1/dist/tree-sitter-swift.wasm");
    		const parser = new Parser();
    		parser.setLanguage(Swift);
    
    		for (const editor of vscode.window.visibleTextEditors) {
    			const content = editor.document.getText();
    			parser.parse(content);
    		}
    
    		vscode.window.showInformationMessage('Hello World!');
    	});
    
    	context.subscriptions.push(disposable);
    }
  8. lyngai commented on Mar 18, 2025

    @lyngai
    Author

    Robo (@deepak1556) Thanks. Waiting for good news.

    Maybe you can try to parse more file in one instance. It is really hard to repro.

    We first discovered the problem in our in-house extension, which uses tree-sitter in a worker_thread to parse all files in the opened workspace. It doesn't always crash on large repos or files, it even crashes during parsing multiple small files. In our case, the crash point most occurs after invoking parser.parse.

    Finally, we found it stop crashing after changing this module to run as a forked process. Hope this helps.

  9. 29 remaining items

  10. RedCMD commented on Jul 26, 2025

    @RedCMD
    Contributor
  11. eglekaz commented on Sep 30, 2025

    @eglekaz

    Robo (@deepak1556)
    Are there any news on this one?

  12. aventurella-netflix commented on Oct 7, 2025

    @aventurella-netflix
    Version: 1.104.2
    Commit: e3a5acfb517a443235981655413d566533107e92
    Date: 2025-09-24T11:21:37.073Z
    Electron: 37.3.1
    ElectronBuildId: 12404162
    Chromium: 138.0.7204.235
    Node.js: 22.18.0
    V8: 13.8.258.31-electron.0
    OS: Darwin arm64 24.6.0
    

    Just wanted to add a data point on this. I was experiencing the same thing. Using web-tree-sitter, loads the tree-sitter.wasm just fine: Parser.init(). I would create the parser and the language using tree-sitter-swift.wasm from : https://github.com/alex-pinkus/tree-sitter-swift, also just fine. It seemed to be triggered by tree-sitter parsing code.

    If I ran the extension in the developer extension host there was not an issue. It was only when I packaged the extension and attempted to execute the same code paths, where in the developer extension host ran without incident, I received the Fatal process out of memory: Zone error in the non-developer vscode process.

    I did a few things to see investigate. The Swift file I was loading for parsing was quite large, so I trimmed it down to ~ 50 lines; Same issue: Fatal process out of memory: Zone.

    Next I figured I would try runnign it in a Worker thread to see if that would have any impact. The code ran, but then it failed with Fatal process out of memory: Zone. Here at least the code did execute, but again it was immediately followed by the error.

    Finally, I did the same test, but ran the code in a child process via spawn. No Error.

    So it seems to be scoped vscode process. It was not happening when I ran the extension under the development extension host. It only occurred for me when running the packaged extension in vscode. It didn't happen at all when I ran the code in a child process from vscode.

  13. deepak1556 commented on Oct 8, 2025

    @deepak1556
    Collaborator

    Sorry I don't have any additional updates on this

    Finally, I did the same test, but ran the code in a child process via spawn. No Error.

    Thanks, this would be from the heap limit set for VSCode process via V8 sandbox. We cannot bump the heap limit however doing that would only be a workaround.

    Early on in the issue it was confirmed issue only started happening with turboshaft backend for wasm compilation, so there must be some improvements missing or bug in the new backend that should be pursued upstream.

  14. added
    bug
    upstream
    chromium
    on Oct 8, 2025
  15. deepak1556 commented on Nov 7, 2025

    @deepak1556
    Collaborator

    Update, we were able to narrow down the source of the crash and a fix will be available with 1.107 Insiders. More details in #273191

  16. added
    unreleased
    insiders-released
    and removed
    unreleased
    on Nov 13, 2025
  17. locked and limited conversation to collaborators on Dec 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugchromiumfreeze-slow-crash-leakinsiders-releasedupstreamverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions