Skip to content

High memory/file-system-watcher usage #2468

Open
@GrumpyMeow

Description

@GrumpyMeow

Current Behavior

For a while we have been having issues with high memory usage. I thought the reason of this might be the number of linting-issues we have in our codebase. Or maybe some wrong configuration. We sometimes had a spinner appear, especiialy when copying and pasting code (even single line code). The small spinner appears at the textcursor in the code-window.

A month ago we also noticed error messages about "file watcher count too low" when starting our mock-app, which indeed uses watchers. But never before we'd seen these error messages before. Our workaround is to close VSCode and do wsl --shutdown. This so we could continue working.

And also we started to notice that the disk would quickly fill up.
We noticed dump files being created in the folder: C:\Users\me\AppData\Local\Temp\wsl-crashes. Sometimes the dump files have a size of 4gb. Although this time this snapshot the dmp files were quite small:
Image

I also noticed this out-of-memory notice running dmesg:
Image

Expected Behavior

We would not expect our workspace to cause these kinds of problems

Steps to Reproduce

I'm unable to provide a description of steps how to trigger the issue. It happens after a while.

Failure Logs / Images / Videos

When running htop i saw high memory usage:
Image

I check the limit:

Image

Especially this snapshot makes me think of NX causing the high file watcher count errors. On the left you see that i retrieved a list of the pids with the number of watchers. On the right you can see the processes. Most of them are vscode/nx related:

Image

Environment

Windows 11, wslg

Image

 NX   Report complete - copy this into the issue template

Node           : 22.13.0
OS             : linux-x64
Native Target  : x86_64-linux
npm            : 10.9.2

nx                     : 20.4.4
@nx/js                 : 20.4.4
@nx/jest               : 20.4.4
@nx/eslint             : 20.4.4
@nx/workspace          : 20.4.4
@nx/angular            : 20.4.4
@nx/cypress            : 20.4.4
@nx/devkit             : 20.4.4
@nx/eslint-plugin      : 20.4.4
@nx/express            : 20.4.4
@nx/module-federation  : 20.4.4
@nx/node               : 20.4.4
@nx/plugin             : 20.4.4
@nx/storybook          : 20.4.4
@nx/web                : 20.4.4
@nx/webpack            : 20.4.4
typescript             : 5.7.3

Nx Powerpack
---------------------------------------
Nx key is expired. Renew license, or contact support ([email protected]) for more assistance.

---------------------------------------
Registered Plugins:
nx-stylelint/plugin
@nx/jest/plugin
---------------------------------------
Community plugins:
@compodoc/compodoc     : 1.1.26
@ngrx/component-store  : 19.0.1
@ngrx/effects          : 19.0.1
@ngrx/entity           : 19.0.1
@ngrx/eslint-plugin    : 18.1.1
@ngrx/operators        : 19.0.1
@ngrx/router-store     : 19.0.1
@ngrx/schematics       : 19.0.1
@ngrx/signals          : 19.0.1
@ngrx/store            : 19.0.1
@ngrx/store-devtools   : 19.0.1
@spaceribs/nx-betterer : 5.0.0
@storybook/angular     : 8.6.4
ng-mocks               : 14.13.2
nx-stylelint           : 18.0.0
---------------------------------------
Local workspace plugins:
         @athora-nx/storybook-test-runner
         @athora-nx/static-server
         @athora-nx/azuredevops
         @athora-nx/chromatic
         @athora-nx/workspace-plugin
         @athora-nx/coverage

wsl image:

root@dtl2024-q2:~/AthoraNx# uname -r
5.15.167.4-microsoft-standard-WSL2
  • Nx Console version: 18.44.2
  • VSCode version:
Version: 1.98.2 (system setup)
Commit: ddc367ed5c8936efe395cffeec279b04ffd7db78
Date: 2025-03-12T13:32:45.399Z
Electron: 34.2.0
ElectronBuildId: 11161602
Chromium: 132.0.6834.196
Node.js: 20.18.2
V8: 13.2.152.36-electron.0
OS: Windows_NT x64 10.0.22631

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions