Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental File Watcher - high CPU on "circular" symlinks #36307

Closed
promansk opened this issue Oct 15, 2017 · 13 comments · Fixed by #45225
Closed

Experimental File Watcher - high CPU on "circular" symlinks #36307

promansk opened this issue Oct 15, 2017 · 13 comments · Fixed by #45225
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug file-watcher File watcher linux Issues with VS Code on Linux perf upstream Issue identified as 'upstream' component related (exists outside of VS Code) verified Verification succeeded
Milestone

Comments

@promansk
Copy link

promansk commented Oct 15, 2017

  • VSCode Version: 1.17.0 (be377c0)
  • OS Version: Ubuntu 16.04 LTS

Steps to Reproduce:

  1. Set "files.useExperimentalFileWatcher": true and close VS Code
  2. Create a symlink to root directory (must be an absolute link, not relative!):
$ mkdir loop
$ ln -s / loop/root
  1. Open directory containing that symlink in VS Code:
$ code --disable-extensions loop
  1. Watch processes - one of vs code processes takes high CPU

Reproduces without extensions: Yes

See also: #3998

@xeor
Copy link

xeor commented Oct 15, 2017

Just noticed the same thing on osx...

@promansk
Copy link
Author

promansk commented Oct 16, 2017

Updating issue with:

  • vs code version 1.17.0
  • reproduces without extensions

vscode-high-cpu

Also, I found memory usage increasing over time...

@lukszy
Copy link

lukszy commented Oct 18, 2017

Same issue here
vs code version 1.17.2
Even after closing the VsCode the Code Helpers is still running with 100% CPU usage.

@Tyriar Tyriar added file-watcher File watcher perf upstream Issue identified as 'upstream' component related (exists outside of VS Code) labels Oct 21, 2017
@Tyriar
Copy link
Member

Tyriar commented Oct 21, 2017

Reported upstream Axosoft/nsfw#40

@Tyriar Tyriar added the linux Issues with VS Code on Linux label Oct 27, 2017
@Tyriar
Copy link
Member

Tyriar commented Oct 27, 2017

Upstream PR Axosoft/nsfw#41

@Tyriar
Copy link
Member

Tyriar commented Dec 13, 2017

The original PR was closed so I opened one which was merged Axosoft/nsfw#47, just need a release to pull this in.

@Tyriar Tyriar added this to the December 2017/January 2018 milestone Dec 13, 2017
@Tyriar Tyriar added the bug Issue identified by VS Code Team member as probable bug label Dec 13, 2017
@hebo-hebo
Copy link

hebo-hebo commented Jan 20, 2018

I have vscode 1.19.2 on Ubuntu. The various node_modules directories have symbolic links point to each other that form the circular links. The node_modules is set excluded in "files.watcherExclude". After vscode is started, it uses 100% CPU and memory usage increased dramatically and soon reached the max memory and hang the system. This problem happens whatever useExperimentalFileWatcher is set true or false. The ps shows the problem code process has parameter '--type=watcherService". Attached gdb to the process, it shows the watcher follows through the circular symbolic links in circular. Set "search.followSymlinks": false has no effect,.

So this problem still happens in 1.19.2 even with all the right settings in place.

@jwulf
Copy link

jwulf commented Mar 6, 2018

@Tyriar is it possible/easy to patch VS Code to stop this behaviour while waiting for it to hit a release? I have a workspace that causes a 20GB VM to exhaust its memory in about 15 mins because of circular symlinks (it uses lerna).

@Tyriar
Copy link
Member

Tyriar commented Mar 7, 2018

@jwulf yeah I'll fork the module to get this in, was hoping I wouldn't need to.

@RMacfarlane
Copy link
Contributor

@Tyriar what's the expected behavior after the change? I'm still seeing high CPU on today's insiders version

on Ubuntu
loop_cpu

on Mac

~$ code-insiders --status

Version:          Code - Insiders 1.22.0-insider (6c22e21cdcd6811770ddcc0d8ac3174aaad03678, 2018-03-30T05:10:29.002Z)
OS Version:       Darwin x64 17.4.0
CPUs:             Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2800)
Memory (System):  16.00GB (0.04GB free)
Load (avg):       3, 3, 2
VM:               29%
Screen Reader:    no
Process Argv:     /Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron --disable-extensions loop

CPU %	Mem MB	   PID	Process
    1	   115	 77391	code-insiders main
    0	   246	 77394	   window (Welcome — loop)
    0	    66	 77396	     extensionHost
  146	   672	 77398	     watcherService
    0	    98	 77395	   shared-process

@RMacfarlane RMacfarlane added the verification-found Issue verification failed label Mar 30, 2018
@Tyriar
Copy link
Member

Tyriar commented Mar 31, 2018

@RMacfarlane the fix is specific to Linux only when you have experimental file watcher set to true in settings (or you have a multi-root workspace open).

@Tyriar Tyriar removed the verification-found Issue verification failed label Mar 31, 2018
@jwulf
Copy link

jwulf commented Apr 2, 2018

If you have this issue, it's not just high CPU usage - your memory will be exhausted within minutes. With a workspace with circular symlinks in it (it uses lerna and has circular dependencies), I was seeing 20GB of RAM get sucked up in about 15 minutes.

Insiders has had the fix for a while now.

@Tyriar Tyriar added the verified Verification succeeded label Apr 2, 2018
@Tyriar
Copy link
Member

Tyriar commented Apr 2, 2018

@jwulf thanks, I'll mark as verified since you saw it before 👍

@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug file-watcher File watcher linux Issues with VS Code on Linux perf upstream Issue identified as 'upstream' component related (exists outside of VS Code) verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants