Score:0

AWS EC2 Next JS server stop responding after some time

cn flag

I am running NextJS server on AWS EC2 instances. I use pm2 to manage my applications. The setup works pretty fine but the problem is after a few days the server stops responding with a 522 status code.

Once I restart the apache server with /opt/bitnami/ctlscript.sh restart apache it starts responding again.

I has been happening a long time and I have no clue what makes it happen. Last it happened there was around 730MB of free memory available out of 966MB. And processors were almost idle.

Here is the htop output image. image of htop output

here is output from cat /opt/bitnami/apache/logs/error_log I have replaced the domain name with example.com and IP address with *** https://pastebin.mozilla.org/YatsOA3i

Thanks for your time and help.

cn flag
Can you add more logging to your application to record extra metrics or information? If it stops after a few days my guess would be a resource leak. Things like file handles, connections, memory, etc.
cn flag
@shearn89 nextjs image has a known issue, the sharp library causing a memory leak. But as you can see from the ```htop`` output, there seems to be enough memory left.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.