vscode: Bug: Battery drain even when app off due to Shan.code-settings-sync extension

Issue Type: Performance Issue

on brand new Apple 2022 Macbook Pro 14" M1

  1. download vscode (universal mac version)
  2. watch battery drain

I had >90% power 2hr ago and now I’m down to 46%, and I was using chrome but my mac tells me that vscode was using more power than anything else EVEN THOUGH I HAD YET TO TURN IT ON TODAY

image

Please look at this insane amount of battery usage for an app that’s turned off:

image

Update: It looks like there was a Code Helper (Renderer) (50803) task running from vscode that was using half of my CPU. I stopped that process. I opened vscode up again and it seems to be using a reasonable amount of CPU now (both that task and the Electron/other vscode-related tasks in total, that is). so maybe a background task just doesn’t quit and slowly snowballs over time.

Update: Looks like everything is going fine now! So it must be due to some task that gets started right after install or first startup. Below, you can see my usage with vscode off and before I turned that task off, then I charged my comp, then I reopened vscode to do things and it’s consuming expected amount of power.

image

VS Code version: Code 1.66.2 (Universal) (dfd34e8260c270da74b5c2d86d61aee4b6d56977, 2022-04-11T07:49:20.994Z) OS version: Darwin arm64 21.1.0 Restricted Mode: No

System Info
Item Value
CPUs Apple M1 Pro (10 x 24)
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
Load (avg) 8, 8, 8
Memory (System) 16.00GB (0.20GB free)
Process Argv –crash-reporter-id 8fff6564-6630-48c8-8217-d84848fc2769
Screen Reader no
VM 0%
Process Info
CPU %	Mem MB	   PID	Process
   26	   213	 47499	code main
    0	    66	 47506	   gpu-process
    0	    33	 47508	   utility-network-service
    0	   279	 47509	   window (Get Started)
    1	   164	 47532	   shared-process
    3	    66	 47535	     ptyHost
    1	    49	 47560	     fileWatcher
    0	     0	 47605	     /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command=
    3	    98	 47534	   extensionHost
    0	    98	 47591	   issue-reporter
Workspace Info
;
Extensions: none
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyl392:30443607
pythontb:30283811
pythonvspyt551:30345470
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805:30301674
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
pythonvsnew555:30457759
vscscmwlcmt:30465135
cppdebugcf:30466690
vscaac:30438847

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 35
  • Comments: 38 (9 by maintainers)

Most upvoted comments

I had this issue for days until I uninstalled the settings sync extension.

I really hope there is one soon… My 16 inch MBP 2021 went from full to 10% in under two hours. It hit 198 in the energy tab of activity monitor, and it hit 432% cpu usage… Crazy bug!

Thanks for opening this issue. We have reached out to Shan the author of the Settings Sync extension and he told us he would fix the issue in the next month.

My personal recommendation is to use the VS Code built-in Settings Sync functionality instead. More details here: https://code.visualstudio.com/docs/editor/settings-sync

Kill the process Code Helper (Renderer) in activity monitor. After that it works fine for me.

Related ticket: https://github.com/microsoft/vscode/issues/101555

The extension author of the Settings Sync extension agreed that we mark it as deprecated until they fix the performance issue. There is no follow up work on our side, thus I am closing this issue as done. Everyone that is using the settings sync extension can use the built-in settings sync functionality instead https://code.visualstudio.com/docs/editor/settings-sync

Image

Given the comments in this issue and the extra information we received, I chose to change this issue into a tracking item for the 100% CPU used by the Shan.code-settings-sync extension.

@miyurusankalpa If you are not using the Shan.code-settings-sync extension and experiencing high CPU usage from one of VS Code’s processes, please take a look at https://github.com/microsoft/vscode/wiki/Performance-Issues#consuming-cpu and create a new issue pointing out the process which causes high CPU usage, your platform (universal or arm), etc and we can try to troubleshoot together what’s going on. You can also link here to the new issue. Many thanks!

I don’t have this extension installed, but still got the issue. However I’m developing my own extension, which uses a separate process as well, so I suspect the problem is caused there in my case. What I’m trying to say with this: Maybe just fixing the issue in the settings sync extension isn’t enough, as this might occur again in other extensions.

A great tool to find a bad extension - https://code.visualstudio.com/blogs/2021/02/16/extension-bisect In my case, the problem was settings sync, and there are many complains for high CPU in their issues.

Thanks for this, the vscode decreased to normal usage level once i uninstalled Settings Sync. Hate to let it go but its not worth my mac running for 1 hour at full charge. My battery health is already at 95% for a 3 months old Macbook Pro M1 14"

Same problem here, it is very boring to kill every time the Code Helper (renderer) process. Is there any permanent solution?