nextjs - 💡(How to fix) Fix Memory leak fix from canary (PRs #88577, #89040) still not in any 16.x stable release 45+ days later — production OOMs ongoing on 16.2.4

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

Not filing this as a new bug — the bug is identified and the fixes exist. Filing it because it's been 45+ days since the canary fix landed, and every 16.x stable release since — including `16.2.4` three days ago — has been cut without it, while real production services continue to OOM every few hours.

Fix Action

Fix / Workaround

  1. Is a `16.2.5` backport on the table, or is the intent to ship only via `16.3.0` stable?
  2. If `16.3.0` only, is there a rough ETA users can plan against?
  3. In the meantime, is running `[email protected].*` in production the recommended workaround, or is there a safer path?
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/Tib-Gridello/nextjs-memory-leak-repro

(Originally used in #90898. Still reproduces on current stable 16.2.4.)

To Reproduce

  1. npm i [email protected] (latest stable at the time of filing, released 2026-04-15)
  2. Run the production server and send modest traffic — or even leave it idle
  3. Observe process.memoryUsage().arrayBuffers grow monotonically
  4. npm i [email protected] → growth disappears, memory stabilises
  5. WriteWrap._chunks retainer chain is the same one documented in #90898

Current vs. Expected behavior

Current (as of 2026-04-20): All 16.x stable releases — 16.0.x, 16.1.x, 16.2.0, 16.2.1, 16.2.2, 16.2.3, 16.2.4 — ship without the fixes from #88577 (register both tee'd response clones with FinalizationRegistry) and #89040 (enforce LRU minimum size). Production services on stable slowly accumulate arrayBuffers until OOM. The only way to avoid this today is to pin a 16.3.0-canary.* in production, which isn't acceptable for many teams.

Expected: A stable release in the 16.x line containing these two fixes.

Real-world impact (production data)

Redacted excerpt from a Render service ([email protected], Node 22, next start, 512 MiB, single instance, output default — not standalone, no cacheComponents):

  • 4 confirmed `oomKilled` events in the last 7 days (Render event type `server_failed`, reason `oomKilled { memoryLimit: "512Mi" }`).
  • Memory after fresh boot: ~245 MiB. Steady climb of ~30 MiB/hour at effectively 0% CPU, ~1 MB/30min bandwidth. Reaches 512 MiB cap in ~8 hours and gets SIGKILLed. Repeats.
  • Profile is classic "idle leak not proportional to request volume" — matches the `tee'd response clone never finalized + LRU zero-size bug` fingerprint from #90898 exactly.

This shows the leak is not limited to `output: standalone` or `cacheComponents` configs (#92287). Any Next.js 16 server with internal `fetch` usage or route handlers forwarding upstream response bodies is affected.

Context — what's already been filed

  • #85914 — closed 2026-01-19 as "completed" (fix in canary, not released)
  • #90431 — closed 2026-02-24 as "completed"
  • #90898 — closed 2026-03-09 as "completed" (explicit confirmation that #88577 + #89040 are in canary but no 16.x stable)
  • #90897 — backport PR closed unmerged on 2026-03-04 with the maintainer note: "a new minor release will contain it for sure"
  • #92287 — still open, narrowly scoped to `standalone + cacheComponents`

Ask

Not filing this as a new bug — the bug is identified and the fixes exist. Filing it because it's been 45+ days since the canary fix landed, and every 16.x stable release since — including `16.2.4` three days ago — has been cut without it, while real production services continue to OOM every few hours.

Concrete questions for the team:

  1. Is a `16.2.5` backport on the table, or is the intent to ship only via `16.3.0` stable?
  2. If `16.3.0` only, is there a rough ETA users can plan against?
  3. In the meantime, is running `[email protected].*` in production the recommended workaround, or is there a safer path?

Provide environment information

```bash Operating System: Platform: linux Arch: amd64 (Render Starter instance) Binaries: Node: 22.x pnpm: 10.6.1 Relevant Packages: next: 16.2.4 (affected) / 16.3.0-canary.2 (not affected) react: 19.2.5 react-dom: 19.2.5 typescript: 6.0.3 Next.js Config: output: N/A (NOT using 'standalone') cacheComponents: false ```

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

Performance

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

Other (Deployed)

extent analysis

TL;DR

The most likely fix for the memory leak issue in Next.js 16.x stable releases is to backport the fixes from #88577 and #89040 to a new minor release, such as 16.2.5, or to upgrade to 16.3.0 stable once it is released.

Guidance

  • The issue is caused by a memory leak due to unregistered tee'd response clones and an LRU minimum size of zero, which is fixed in the 16.3.0-canary releases.
  • To mitigate the issue, users can try running [email protected].* in production, but this may not be acceptable for all teams due to the canary status.
  • The Next.js team should consider backporting the fixes to a new minor release, such as 16.2.5, to provide a stable and supported solution for users.
  • Users can monitor their memory usage and adjust their deployment configurations to minimize the impact of the leak until a fix is released.

Example

No code example is provided as the issue is related to a specific Next.js version and configuration.

Notes

The issue is specific to Next.js 16.x stable releases and may not affect other versions or configurations. The fixes are already available in the 16.3.0-canary releases, but a stable and supported solution is needed.

Recommendation

Apply workaround by running [email protected].* in production, as this is the only currently available solution that includes the fixes for the memory leak issue. However, users should be aware of the potential risks and limitations of using a canary release in production.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - 💡(How to fix) Fix Memory leak fix from canary (PRs #88577, #89040) still not in any 16.x stable release 45+ days later — production OOMs ongoing on 16.2.4