Memory leak during load tests in dynamic rendering mode
Nobody has claimed this yet.
- 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
-
Clone repository (I prepared a small test repository that reproduces this issue):
https://github.com/grzegorz-orbital/nextjs-bug -
To trigger the problem, run
./run_next.shin a terminal — this starts Next in production mode. -
Install Rust — it’s required to run the performance test:
https://rust-lang.org/tools/install/ -
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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