Memory leak #35526
Replies: 4 comments 6 replies
-
Hi, I don't know if this would help at all, but I could try and guess a few things. Let's, see it's been a while since Next 10.2.9, did you also upgrade to Node 15 around the same time? Perhaps something is going on with unhandled promises? Although those should break the entire application. Do you use Are you using Do you have any globals? Maps, Sets, arrays, plain JS objects that could potentially prevent garbage collection, or just keep on increasing memory consumption. I know this is a vague one, and hard to track, but still possible. Are you properly closing handlers to databases? outgoing requests, etc? In general, is asynchronous work properly finished, cleaned up and deleted? I think you can check this out through |
Beta Was this translation helpful? Give feedback.
-
Hey @icyJoseph ! Any help is appreciated 😃 Yeah its been a while, we plan to update to newer next version but we want to get this sorted before looking into updating. Not using any getStatic so that one thing to check off Currently not using any Next/image components so that should not be a problem. We have som globals and we are looking into this but as you said a bit hard to track 99% sure we don't have any outgoing request and so on but will have a look into this just to be sure |
Beta Was this translation helpful? Give feedback.
-
are you using next-connect? Bug in versions <0.12.1 hoangvvo/next-connect#178 |
Beta Was this translation helpful? Give feedback.
-
I ran into this problem as well - pretty much the exact memory curve and behaviour - and took me ages to track down. Not sure this would be the same cause for everyone, but in my situation this stemmed from a combination an async call on the server side - to fetch auth data - and a health check configured in AWS. The health check just gets the header response code, but doesn't load the site so the promise never settles. Changing the health-check away from a page performing that async request - ie. the index page of the site - to a specific static health check page immediately resolved this problem. I could be wrong about the cause described above, but as this is a no-code change it might be worth trying out to see if it alleviates the problem. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Introduction
2 month ago we started seeing problems with the memory increasing constantly until reaching a point where the app restarted.
Specifications
Next.js: v.10.2.3
React: v.16.14.0
Node local: v.15.14.0
Hosting: AWS ECS Fargate
Docker Node: v.15.12.0
Application Background
https://etonshirts.com/
E-commerce store selling globally. around 10.000 users daily
The problem
Steady increase of memory usage. When the memory reaches 50% it restarts and then the memory immediately starts increasing.
First arrow (from left) was a deploy that failed due to logging added to express. We removed this logging and made a new deploy that was able to finish without any problem (second arrow) 12-14 hours after this deploy the memory leak started.
We have reverted or changed more or less all changes in this second deploy but the memory leak still exist
We have tried this locally and on staging environments but we are not able to reproduce it there.
Also found an article about adding: experimental: { isrMemoryCacheSize: 0 }, but sadly it did not help.
A bit lost here so any help/ideas is appreciated 😀
Beta Was this translation helpful? Give feedback.
All reactions