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

Memory spike issue with Next.js 15.1.4 on Azure #74855

Open
1 task
skerdi-zogaj opened this issue Jan 14, 2025 · 8 comments
Open
1 task

Memory spike issue with Next.js 15.1.4 on Azure #74855

skerdi-zogaj opened this issue Jan 14, 2025 · 8 comments
Labels
linear: next Confirmed issue that is tracked by the Next.js team.

Comments

@skerdi-zogaj
Copy link

skerdi-zogaj commented Jan 14, 2025

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.2.0: Fri Dec  6 18:51:28 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T8112
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 20.13.1
  npm: 10.8.1
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 15.1.4 // Latest available version is detected (15.1.4).
  eslint-config-next: 14.2.3
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.4.5
Next.js Config:
  output: standalone

Which example does this report relate to?

This issue is not related to any specific example in the examples folder. The problem occurs in a general Next.js application deployed on Azure.

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

We are experiencing a significant memory spike and auto-scaling issues when using Next.js 15.1 in our Azure deployments. Memory usage increases unpredictably under typical traffic conditions, leading to higher resource utilization and triggering unnecessary auto-scaling.

When downgrading to Next.js 14.2, these issues are resolved, and memory usage returns to stable levels. This suggests a regression introduced in version 15.1.

Graphs comparing memory usage for versions 15.1 and 14.2 are attached below for reference.

Image

Image

Expected Behavior

Memory usage should remain stable and consistent under typical traffic conditions when using Next.js 15.1, similar to the behavior observed in Next.js 14.2.

To Reproduce

Deploy a Next.js 15.1 application on Azure with typical production traffic patterns.
Monitor the memory usage and auto-scaling behavior using Azure's monitoring tools.
Observe that memory usage increases significantly and unpredictably, causing auto-scaling to trigger even under normal load.
Downgrade the application to Next.js 14.2.
Re-monitor the application, noticing that memory usage stabilizes and auto-scaling behaves as expected.

Image

Image

@skerdi-zogaj skerdi-zogaj added the examples Issue was opened via the examples template. label Jan 14, 2025
@frankbo
Copy link

frankbo commented Jan 14, 2025

We are facing a similar issue in our kubernetes pods. With Nextjs 15.1.3 the memory consumption was/is fine and the pods run as expected, but with the update to 15.1.4 the pods want to consume more and more memory and die at some point. Normally our pods use 110mb memory and are fine with that. With the update to Nextjs 15.1.4 they start with 115 and the memory get up to 300mb, then they die and it starts over again. From the graphs it looks like a memory leak or at least something that consumes more memory then necessary over time.
Let me know if you need further information.

@skerdi03 did you try version 15.1.3 as well. And do you face the same issues there?

@vitalyiegorov
Copy link

vitalyiegorov commented Jan 15, 2025

We are facing the same issue with the node:18-alpine image on NextJS 15.1.4

@cjcheshire
Copy link

I don't want to do the me too… node:20-alpine + NextJS 15.1.4. We have dropped back to NextJS 15.1.3 to see if it settles.

Hard to create an example repo for this. We have 40+ page templates (1400 pages) that use unstable_cache to revalidate every 10 minutes. We also have a couple of apis.

You can see when we deployed 15.1.4:

Image

@skerdi-zogaj
Copy link
Author

We are facing a similar issue in our kubernetes pods. With Nextjs 15.1.3 the memory consumption was/is fine and the pods run as expected, but with the update to 15.1.4 the pods want to consume more and more memory and die at some point. Normally our pods use 110mb memory and are fine with that. With the update to Nextjs 15.1.4 they start with 115 and the memory get up to 300mb, then they die and it starts over again. From the graphs it looks like a memory leak or at least something that consumes more memory then necessary over time. Let me know if you need further information.

@skerdi03 did you try version 15.1.3 as well. And do you face the same issues there?

Yes, we had the same issue with 15.1.3 as well

@justinadkins
Copy link

We've experienced memory issues since 15.1.x, 15.0.x is stable for us. Deployed on AWS via FlightControl. We're running Node 18 right now.

@samcx samcx added bug Issue was opened via the bug report template. and removed examples Issue was opened via the examples template. bug Issue was opened via the bug report template. labels Jan 16, 2025
@lubieowoce
Copy link
Member

lubieowoce commented Jan 17, 2025

We've identified one leak that became much more noticeable in 15.1.4 -- specifically, since that release, each revalidation (in next start) would leak a promise that'd then stick around forever. That fix is here: #75041). We're gonna ship a patch with this soon, and update this thread when it's out

@github-actions github-actions bot added the linear: next Confirmed issue that is tracked by the Next.js team. label Jan 20, 2025
@huozhi
Copy link
Member

huozhi commented Jan 22, 2025

The fix mentioned above is landed in v15.1.6, please upgrade and let us know if that fixes your issue 🙏 Thanks

@sbehrends
Copy link

For us looks like the latest version fixed the issue.

Here is memory usage before and after the update.
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear: next Confirmed issue that is tracked by the Next.js team.
Projects
None yet
Development

No branches or pull requests

9 participants