Hi Thuy Giang Ngo,
Thank you for replying back to us again with the error details!
I have gone through the logs, and it shows Killed error Command failed with exit code 137. Your VM is running out of RAM, and the system is forcibly stopping the PM2 process. This happens even if you're testing only a few requests because of a memory leak in your Node.js application, too many concurrent processes running and also PM2 consuming more RAM than available.
Monitor Memory Usage: Use free -m
or htop
to check memory usage.
Limit PM2 Memory Usage --max-memory-restart
(prevents PM2 from consuming too much RAM).
You need to make a pm2 save
to hope pm2 will restart your app when using pm2 resurrect
, and we are aware of this behavior but can't really fix it, we added the options max-memory-restart
for this reason.
source: https://github.com/Unitech/pm2/issues/2206?utm
VM reboots after an OS update, causing PM2 to stop running. Restarting PM2 with the processes you manage on server boot/reboot is critical. To solve this, just run this command to generate an active startup script:
$ pm2 startup
And to freeze a process list for automatic respawn:
$ pm2 save
https://pm2.keymetrics.io/docs/usage/startup/
Also, address the TypeErrors and ensure that your data structures are correctly defined. Check for duplicate entries in your MongoDB collections and handle them appropriately. Ensure that all modules are correctly imported, and paths are accurate.
Hope this helps!
Let me know if you have any further queries!
If the comment is helpful, please click "upvote" to let us know.