vscode: VS Code freezes regularly on macOS 12.3 with Apple M1

I’m using the latest stable VS Code on my MacBook Pro 2021 with M1 chip for programming Python (and C++). I have been having issues with VS Code randomly slowing down and freezing until macOS asks to stop it. Then I have to terminate VS Code and restart it. That happens multiple times within a couple of hours, so it’s really annoying when coding & debugging.

The freeze happens out of nowhere. CPU load is very low, I’m not doing anything special or running expensive other programs in the background. I can’t really reproduce the freeze quickly, but it does happen regularly (roughly every 0,5-2h).

Seems like other users also have this issue: https://github.com/microsoft/vscode/issues/122111 and https://github.com/microsoft/vscode/issues/129076 Unfortunately, these issues were closed and locked without providing a solution.

  • VS Code Version: 1.65.2
  • OS Version: macOS 12.3
  • MacBook Pro 2021 with Apple M1 Pro chip

My extensions are:

code --install-extension alefragnani.Bookmarks
code --install-extension cschlosser.doxdocgen
code --install-extension eamodio.gitlens
code --install-extension jeff-hykin.better-cpp-syntax
code --install-extension mhutchie.git-graph
code --install-extension ms-python.python
code --install-extension ms-python.vscode-pylance
code --install-extension ms-toolsai.jupyter
code --install-extension ms-toolsai.jupyter-keymap
code --install-extension ms-toolsai.jupyter-renderers
code --install-extension ms-vscode-remote.remote-containers
code --install-extension ms-vscode-remote.remote-ssh
code --install-extension ms-vscode-remote.remote-ssh-edit
code --install-extension ms-vscode-remote.remote-wsl
code --install-extension ms-vscode.cmake-tools
code --install-extension ms-vscode.cpptools
code --install-extension ms-vscode.cpptools-extension-pack
code --install-extension ms-vscode.cpptools-themes
code --install-extension njpwerner.autodocstring
code --install-extension trond-snekvik.simple-rst
code --install-extension twxs.cmake

Since I need the extensions for development and I can’t quickly reproduce the freeze, I couldn’t test if the freeze eventually occurs with all extensions disabled.

Also, I tried recording a crash dump as described here, but no dump was created. Maybe because VS Code froze and didn’t crash.

Any help is really appreciated. This really disturbs my coding workflow.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 24
  • Comments: 69 (10 by maintainers)

Most upvoted comments

Same issue. And I found something strange. When VS Code is not responding, my Chrome costs CPU over 50%: image image

After a few secs: image

Only VS Code is not responding. Other Apps works well. After 10-20 sec, everything turns to good. This happens regularly when I switch apps bewteen chrome and vscode.

Run code -status seems good:

Version:          Code 1.68.1 (30d9c6cd9483b2cc586687151bcbcd635f373630, 2022-06-14T12:52:13.188Z)
OS Version:       Darwin x64 21.5.0
CPUs:             Apple M1 (8 x 24)
Memory (System):  16.00GB (0.04GB free)
Load (avg):       2, 1, 2
VM:               0%
Screen Reader:    no
Process Argv:     --crash-reporter-id 76ce2e8d-304c-4701-abd6-0229d6cd3a3a
GPU Status:       2d_canvas:                              enabled
                  canvas_oop_rasterization:               disabled_off
                  direct_rendering_display_compositor:    disabled_off_ok
                  gpu_compositing:                        enabled
                  metal:                                  disabled_off
                  multiple_raster_threads:                enabled_on
                  oop_rasterization:                      enabled
                  opengl:                                 enabled_on
                  rasterization:                          enabled
                  raw_draw:                               disabled_off_ok
                  skia_renderer:                          enabled_on
                  video_decode:                           enabled
                  video_encode:                           enabled
                  webgl:                                  enabled
                  webgl2:                                 enabled

CPU %	Mem MB	   PID	Process
   10	    66	   994	code main
    0	    49	   997	   gpu-process
    0	    16	  1000	   utility-network-service
    0	    33	  1001	   window (xxxx.py — xxx9)
    0	   180	  1004	   window (Content.js — XXX)
    0	    33	  1534	   shared-process
    0	    16	  1547	     ptyHost
    0	     0	  2259	       /bin/zsh -l
    0	     0	  2430	       /bin/zsh -l
    0	     0	 75606	       /bin/zsh -l
    0	     0	 96607	       /bin/zsh -l
    0	    16	  2054	     fileWatcher
    0	    16	 60364	     fileWatcher
    0	     0	 96606	     fileWatcher
    0	    16	  1544	   extensionHost
    0	    16	  4718	     /Applications/APPs/Visual Studio Code.app/

Update chrome not help. (Current version 103.0.5060.53 )

same issue here on M1 mac 12.5

For future reference and FYI @deepak1556:

I have removed CMake and CMake tool extensions and my freeze problem went away.

image

I think this is a hard issue to reproduce and debug, I suggest anyone facing this issue to disable some part of their extensions to see what is causing the problem and report it here. For me, it was CMake however I am still suspecting that there might be a problematic API that is called from the extension that causes the problem.

I get this issue (same behaviour but perhaps different reasons to OP) when I run a bash script for deployment which does a lot of cleaning and building of js packages in a monorepo/workspace that I currently have open in VS Code. I also get it sometimes when just doing a npx npkill to dump all node_module folders in the monorepo, sometimes followed by a yarn install. The commands don’t error out, but often I’ll have to restart VS Code.

Same behaviour; VS Code freezes and after a while it either recovers or gives me an unresponsive modal. Most of the time I have to force quite the app and restart.

I’m using macOS Monterey 12.4 on an M1 Pro.

I just had a complete macos crash on M1 when opening vscode.

Vscode opened and It popped a recommendation for an angular extension, after clicking on extension it first froze my mouse and keyboard and then the mac restarted. After it restarted I got a send report to apple popup, by clicking on send report it then also froze the whole computer. Not sure if it’s vscode or M1 related issue. IMHO M1 is the worst computer experience i’ve ever had including windows 98 and windows vista. Vscode on my old intel mac has never crashed and is still working fine.

@trkee As in the workspace folder or the actual vscode app?

@deepak1556 I’d closed my ticket - I’m on an Intel Mac - and it is still doing the same thing. I cannot get you a sample because the process is not responding - the sample window just hangs. I can’t even screen capture it because nothing responds now.