Next Deployment With NGINX gets 'killed' out of nowhere without any logs on a VPS
Unanswered
Pip gall wasp posted this in #help-forum
Pip gall waspOP
My nextjs deployment is done on a a very decent server with the stats in the screenshot attached.
I have used nginx to deploy and am starting npm run start as a pm2 service, and when this crash was happening in pm2 then in screens. Its a debian 11 deployment.
The problem is that it randomly gets killed out of nowhere. it just says 'Killed'. The htop logs is also shared. I'm confused as to what is killing it. It works fine for 30 mins or so then crashes itself. This is so confusing.
It works fine on a server without crashing or being killed in a VPS with 8 vcpus and 30 gigs, but i see no way that it uses 4 vcpus and take up so much memory. Any clues?
I have used nginx to deploy and am starting npm run start as a pm2 service, and when this crash was happening in pm2 then in screens. Its a debian 11 deployment.
The problem is that it randomly gets killed out of nowhere. it just says 'Killed'. The htop logs is also shared. I'm confused as to what is killing it. It works fine for 30 mins or so then crashes itself. This is so confusing.
It works fine on a server without crashing or being killed in a VPS with 8 vcpus and 30 gigs, but i see no way that it uses 4 vcpus and take up so much memory. Any clues?
23 Replies
Pm2 Will kill / restart your server your processes if they take up too much memory. Maybe you need to change the settings for how much memory they may use individually
Pip gall waspOP
Screens is also killing it. I don't understand though if there is so much free storage and memory, how does pm2 decide too much memory is being taken??
Where you might think i can change this memory
cause its certianly not just pm2, screens kills it too
Just this
in screens logs
Its the “max_memory_restart” setting in the ecosystem config file
Pip gall waspOP
@MikeTheTechLead max_memory_restart is only for pm2 tho right
screens is killing it as wel
Im not sure what screens is and how youve implemented it. PM2 is a process manager for node. So it spins up next etc processes
Pip gall waspOP
@MikeTheTechLead screens basically keeps the session going even if u close the ssh session
multiple terminal isntances basically u can do that run even if ssh session is broken
let me see if it works with pm2
with increased max_memory_restart
Why would you need to keep the session running like that
Pip gall waspOP
npm run start
either needs to be running on pm2, or screen
pm2 crashed
so i tested it on screen
to see if it was a pm2 related issue, screen crashes too
Pip gall waspOP
Does not work
It says 504 gateway timeout always