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

Typegen high CPU/Memory usage #12721

Open
SeanLatimer opened this issue Jan 11, 2025 · 1 comment
Open

Typegen high CPU/Memory usage #12721

SeanLatimer opened this issue Jan 11, 2025 · 1 comment
Labels

Comments

@SeanLatimer
Copy link

I'm using React Router as a...

framework

Reproduction

  1. Create project with pnpx create-react-router@latest
  2. Run pnpm dev (CPU/Memory usage is fine)
  3. Re-run pnpm dev, this time CPU/Memory usage will be increased.

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 AMD Ryzen 7 5800X3D 8-Core Processor
    Memory: 15.02 GB / 31.93 GB
  Binaries:
    Node: 22.12.0 - ~\.proto\shims\node.EXE
    npm: 10.8.3 - ~\.proto\shims\npm.EXE
    pnpm: 9.15.0 - ~\.proto\shims\pnpm.EXE
    bun: 1.1.38 - ~\.proto\shims\bun.EXE
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    @react-router/dev: ^7.1.1 => 7.1.1
    @react-router/node: ^7.1.1 => 7.1.1
    @react-router/serve: ^7.1.1 => 7.1.1
    react-router: ^7.1.1 => 7.1.1
    vite: ^5.4.11 => 5.4.11

Used Package Manager

pnpm

Expected Behavior

CPU/Memory usage would remain the consistent between multiple sessions of running 'dev'.

Actual Behavior

On initial run, after creating the project, CPU/Memory usage is as I would expect. Subsequent runs, this increases (in my case 20%+ CPU usage + what appears to be leaking memory).

The issue only presents itself when .react-router exists when running dev, deleting the folder resolves the issue until the next run of dev. I took 2 CPU profiles, one of the initial run and another of the subsequent run, which seems to point to a file watcher.

react-router-0.cpuprofile
react-router-1.cpuprofile

@SeanLatimer
Copy link
Author

I've uncovered that the issue only happens on Node v22.12 and greater, so a temporary workaround for now would be to downgrade to v22.11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant