App Router + Axios cause memory leak #74307
Replies: 3 comments 6 replies
-
@thinceller We've observed a memory leak on 15.1.x in our application and we are using a dependency that uses Axios under the hood. I haven't had time to investigate but downgrading to 15.0.x has been our "hot fix". Do you happen to know if you are observing this issue on 15.0.x? |
Beta Was this translation helpful? Give feedback.
-
Environment
I also encountering memory leak issues. I cannot confirm whether it is related to Axios. Unfortunately, I am unable to investigate the problem further due to company policy. Issue resolved by downgrading NextJS to I did NOT test v15.0.x thanks everyone |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Memory leak occurs when using Next.js App Router with Axios when Axios throws an error during React Server Component (RSC) rendering. The heap size keeps increasing with multiple requests and doesn't get released over time. This issue doesn't occur when using the fetch API instead of Axios.
For a detailed reproduction of this issue, please refer to our reproduction repository linked below.
Additional information
Environment
next info
Problem Details
Expected Behavior
The heap size should stabilize after requests are completed, and unused memory should be released, even when errors occur.
Actual Behavior
When Axios throws an error during RSC rendering, the heap size keeps increasing with each request and doesn't get released, leading to a memory leak.
Example
https://github.com/thinceller/reproduction-app-router-axios-memory-leak
Beta Was this translation helpful? Give feedback.
All reactions