Change:
VSCode Version: 1.17.0 () OS Version: Ubuntu 16.04 LTS Steps to Reproduce: "files.useExperimentalFileWatcher": true and close VS Code a symlink to root directory (must be an absolute link, not relative!): directory containing that symlink in VS Code: processes - one of vs code processes takes high CPU Reproduces without extensions: Yes See also:
Just noticed the same thing on osx...
Updating issue with: vs code version 1.17.0 reproduces without extensions ! Also, I found memory usage increasing over time...
Same issue here vs code version 1.17.2 Even after closing the VsCode the Code Helpers is still running with 100% CPU usage.
Reported upstream
Upstream PR
The original PR was closed so I opened one which was merged , just need a release to pull this in.
I have vscode 1.19.2 on Ubuntu. The various nodemodules directories have symbolic links point to each other that form the circular links. The nodemodules 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.
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).
yeah I'll fork the module to get this in, was hoping I wouldn't need to.
what's the expected behavior after the change? I'm still seeing high CPU on today's insiders version on Ubuntu ! on Mac
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).
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.
thanks, I'll mark as verified since you saw it before :+1:

Discussion:
.pipe(util.cleanNodeModule('gc-signals', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node', 'src/index.js'])) .pipe(util.cleanNodeModule('keytar', ['binding.gyp', 'build/**', 'src/**', 'script/**', 'node_modules/**'], ['**/*.node'])) .pipe(util.cleanNodeModule('node-pty', ['binding.gyp', 'build/**', 'src/**', 'tools/**'], ['build/Release/*.exe', 'build/Release/*.dll', 'build/Release/*.node'])) <del> .pipe(util.cleanNodeModule('nsfw', ['binding.gyp', 'build/**', 'src/**', 'openpa/**', 'includes/**'], ['**/*.node', '**/*.a'])) </del> <ins> .pipe(util.cleanNodeModule('vscode-nsfw', ['binding.gyp', 'build/**', 'src/**', 'openpa/**', 'includes/**'], ['**/*.node', '**/*.a'])) </ins> .pipe(util.cleanNodeModule('vsda', ['binding.gyp', 'README.md', 'build/**', '*.bat', '*.sh', '*.cpp', '*.h'], ['build/Release/vsda.node'])) .pipe(createAsar(path.join(process.cwd(), 'node_modules'), ['**/*.node', '**/vscode-ripgrep/bin/*', '**/node-pty/build/Release/*'], 'app/node_modules.asar'));

"native-keymap": "1.2.5", "native-watchdog": "0.3.0", "node-pty": "0.7.4", <del> "nsfw": "1.0.16", </del> "semver": "4.3.6", "spdlog": "0.6.0", "sudo-prompt": "^8.0.0", "v8-inspect-profiler": "^0.0.7", "vscode-chokidar": "1.6.2", "vscode-debugprotocol": "1.27.0", <ins> "vscode-nsfw": "1.0.17", </ins> "vscode-ripgrep": "0.7.1-patch.0.1", "vscode-textmate": "^3.2.0", "vscode-xterm": "3.3.0-beta2",

<del> /*--------------------------------------------------------------------------------------------- *  Copyright (c) Microsoft Corporation. All rights reserved. *  Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ declare module 'nsfw' { interface NsfwWatcher { start(): any; stop(): any; } interface NsfwWatchingPromise { then(): void; } interface NsfwStartWatchingPromise { then(fn: (watcher: NsfwWatcher) => void): NsfwWatchingPromise; } interface NsfwEvent { action: number; directory: string; file?: string; newFile?: string; oldFile?: string; } interface NsfwFunction { (dir: string, eventHandler: (events: NsfwEvent[]) => void, options?: any): NsfwStartWatchingPromise; actions: { CREATED: number; DELETED: number; MODIFIED: number; RENAMED: number; } } var nsfw: NsfwFunction; export = nsfw; } </del>

<ins> /*--------------------------------------------------------------------------------------------- *  Copyright (c) Microsoft Corporation. All rights reserved. *  Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ declare module 'vscode-nsfw' { interface NsfwWatcher { start(): any; stop(): any; } interface NsfwWatchingPromise { then(): void; } interface NsfwStartWatchingPromise { then(fn: (watcher: NsfwWatcher) => void): NsfwWatchingPromise; } interface NsfwEvent { action: number; directory: string; file?: string; newFile?: string; oldFile?: string; } interface NsfwFunction { (dir: string, eventHandler: (events: NsfwEvent[]) => void, options?: any): NsfwStartWatchingPromise; actions: { CREATED: number; DELETED: number; MODIFIED: number; RENAMED: number; } } var nsfw: NsfwFunction; export = nsfw; } </ins>

import * as path from 'path'; import * as platform from 'vs/base/common/platform'; import * as watcher from 'vs/workbench/services/files/node/watcher/common'; <del> import * as nsfw from 'nsfw'; </del> <ins> import * as nsfw from 'vscode-nsfw'; </ins> import { IWatcherService, IWatcherRequest } from 'vs/workbench/services/files/node/watcher/nsfw/watcher'; import { TPromise, ProgressCallback, TValueCallback, ErrorCallback } from 'vs/base/common/winjs.base'; import { ThrottledDelayer } from 'vs/base/common/async';

resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" asap@~2.0.3: <del> version "2.0.5" resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.5.tgz#522765b50c3510490e52d7dcfe085ef9ba96958f" </del> <ins> version "2.0.6" resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" </ins> asar@^0.14.0: version "0.14.0"

version "2.5.1" resolved "https://registry.yarnpkg.com/nan/-/nan-2.5.1.tgz#d5b01691253326a97a2bbee9e61c55d8d60351e2" <del> nan@^2.0.0, nan@^2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45" </del> <ins> nan@^2.0.0: version "2.9.2" resolved "https://registry.yarnpkg.com/nan/-/nan-2.9.2.tgz#f564d75f5f8f36a6d9456cca7a6c4fe488ab7866" </ins> nan@^2.0.9, nan@^2.3.0: version "2.4.0"

version "2.7.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.7.0.tgz#d95bf721ec877e08db276ed3fc6eb78f9083ad46" <ins> nan@^2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45" </ins> nan@^2.8.0: version "2.8.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.8.0.tgz#ed715f3fe9de02b57a5e6252d90a96675e1f085a"

dependencies: path-key "^2.0.0" <del> nsfw@1.0.16: version "1.0.16" resolved "https://registry.yarnpkg.com/nsfw/-/nsfw-1.0.16.tgz#78ba3e7f513b53d160c221b9018e0baf108614cc" dependencies: fs-extra "^0.26.5" lodash.isinteger "^4.0.4" lodash.isundefined "^3.0.1" nan "^2.0.0" promisify-node "^0.3.0" </del> nth-check@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-1.0.1.tgz#9929acdf628fc2c41098deab82ac580cf149aae4"

xml2js "^0.4.19" yargs "^10.1.1" <ins> vscode-nsfw@1.0.17: version "1.0.17" resolved "https://registry.yarnpkg.com/vscode-nsfw/-/vscode-nsfw-1.0.17.tgz#da3820f26aea3a7e95cadc54bd9e5dae3d47e474" dependencies: fs-extra "^0.26.5" lodash.isinteger "^4.0.4" lodash.isundefined "^3.0.1" nan "^2.0.0" promisify-node "^0.3.0" </ins> vscode-ripgrep@0.7.1-patch.0.1: version "0.7.1-patch.0.1" resolved "https://registry.yarnpkg.com/vscode-ripgrep/-/vscode-ripgrep-0.7.1-patch.0.1.tgz#f05d2f093fd7f6a9d10fb935171e72620feaf999"