0

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.

  • 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. – shearn89 Mar 17 '22 at 08:42
  • @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. – Imtiaz Chowdhury Mar 17 '22 at 19:18

0 Answers0