vercel / vercel/next.js

Memory leak during load tests in dynamic rendering mode

Open
#84,648 23 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dynamic Routes
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://github.com/grzegorz-orbital/nextjs-bug

To Reproduce
  1. Clone repository (I prepared a small test repository that reproduces this issue):
    https://github.com/grzegorz-orbital/nextjs-bug

  2. To trigger the problem, run ./run_next.sh in a terminal — this starts Next in production mode.

  3. Install Rust — it’s required to run the performance test:
    https://rust-lang.org/tools/install/

  4. In a second terminal run ./run_goose_attack_api.sh. You only need Rust installed locally because the load tests are written in Rust.

When I run this test on my MacBook the test finishes in about one minute. It executes 40,000 requests.
After the test finishes, the Next process memory stays around ~15 GB and does not drop.

I tested it on the canary version as well (the canary branch). The behavior is the same.

Current vs. Expected behavior

I would expect that after the load test completes, the process memory usage would return to approximately the same level as before the test started.

Provide environment information
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:40 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6041
  Available memory (MB): 24576
  Available CPU cores: 14
Binaries:
  Node: 24.4.0
  npm: 11.4.2
  Yarn: 1.22.22
  pnpm: 10.14.0
Relevant Packages:
  next: 15.5.4 // Latest available version is detected (15.5.4).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: N/A
Next.js Config:
  output: N/A
Which area(s) are affected? (Select all that apply)

Dynamic Routes

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local)

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by cloning the linked nextjs-bug reproduction and running ./run_next.sh, then ./run_goose_attack_api.sh as described. Measure the Next process before and after the 40,000-request load and trace the dynamic-rendering path implicated by the reproduction. Done means the leak is identified and memory returns near its pre-test level after the load completes.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, next.js, react
Domain
backend, performance, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.