Skip to content

GitLens starts watching home directory, causing 100% CPU usage and watcher breakage #4335

@jaens

Description

@jaens

Description

At some random point, GitLens decides to start recursively watching the entire home directory, using up about ~400_000 watches (expected I guess, since the home directory has a lot of files), and causing the VSCode file watcher process CPU usage to spike to 100% and any further file watches to break.

[see logs]

(Perhaps relevant: The home directory has a .git directory for dotfiles).

The watching happens in a random open VSCode project, and the home directory itself is of course not open under any Git repository or GitLens view.

GitLens should probably try not to watch directories completely unrelated to the open project, especially if it basically breaks the IDE watcher.

GitLens Version

v17.1.1

VS Code Version

Version: 1.100.2
Commit: 848b80aeb52026648a8ff9f7c45a9b0a80641e2e
Date: 2025-05-14T21:47:40.416Z
Electron: 34.5.1
ElectronBuildId: 11369351
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Linux x64 6.12.27-amd64

Git Version

git version 2.47.2

Logs, Screenshots, Screen Captures, etc

VSCode developer tools at TRACE level:

log.ts:420 TRACE MainThreadFileSystemEventService#$watch(): request to start watching uncorrelated (extension: eamodio.gitlens, path: file:///home/jaens, recursive: true, session: 0.39231489162946787, excludes: ["**/.git/objects/**","**/.git/subtree-cache/**","**/.hg/store/**","**/.ammonite/**","**/.bloop/**","**/.direnv/**","**/.metals/**","**/.ruff_cache/**","**/.terraform/**","**/.venv/**","**/node_modules/**","/usr/**"], includes: undefined)

log.ts:420 TRACE MainThreadFileSystemEventService#$watch(): request to start watching uncorrelated (extension: eamodio.gitlens, path: file:///home/jaens/.git, recursive: true, session: 0.2615199880606571, excludes: ["**/.git/objects/**","**/.git/subtree-cache/**","**/.hg/store/**","**/.ammonite/**","**/.bloop/**","**/.direnv/**","**/.metals/**","**/.ruff_cache/**","**/.terraform/**","**/.venv/**","**/node_modules/**","/usr/**"], includes: undefined)


inotify-info output:

       Pid Uid        App                                  Watches  Instances
   1912429 1000       code                                 399,247          2

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions