0

How to kill and restart nodejs when the account has run out of processes.

Using username "shee".
Authenticating with public key "imported-openssh-key"
Passphrase for key "imported-openssh-key":
[shee@sg9 ~]$ ps
-bash: fork: Cannot allocate memory
[shee@sg9 ~]$ ls
-bash: fork: Cannot allocate memory
[shee@sg9 ~]$ free
-bash: fork: Cannot allocate memory
[shee@sg9 ~]$

I am running nodejs on fastcomet.com

cPanel Version  68.0 (build 37)
Apache Version  2.4.33
Operating System    linux
Kernel Version  2.6.32-896.16.1.lve1.4.51.el6.x86_64

I am using pm2 to run nodejs

But as you can see above - every command gives the error "fork: Cannot allocate memory"

cPanel says: Number Of Processes 40 / 40 ( 100% )

Any ideas on how I can kill the process?

2 Answers 2

2

FastComet Team here!

Killing a process is quite an easy task as long as you know what the PID is. From what I can see you are trying the correct commands, however your account lacks memory to execute it. That is because you are running an instance of nodejs as well as pm2 process manager and both of these combined are using all the memory.

Unfortunately there is not much you can do from your end since the memory allocated for your web hosting account is 100% used. Therefore I would like to kindly ask you to contact our technical support team and they will gladly assist you with that resolving the issue in a manner of minutes.

Kind Regards and Best Wishes, FastComet Team

3
  • 1
    Wow, you actually made a comment on a public forum for support of your end-clients? +1 from me.
    – DankyNanky
    Commented Apr 25, 2018 at 13:00
  • pkill looks to be the workaround. See my answer. Also, thanks. Commented Apr 26, 2018 at 2:02
  • We are glad to hear it Eddy. It looks like few MBs of RAM got free and you succeeded executing the kill command. In any case our technical support department can solve this kind of issues immediately so please consider contacting them when similar issues arise in future.
    – FastComet
    Commented Apr 26, 2018 at 6:47
1

pkill worked

I used pkill to kill node and pm2

Authenticating with public key "imported-openssh-key"
Passphrase for key "imported-openssh-key":
[shee@sg9 ~]$
[shee@sg9:~ls
-bash: fork: Cannot allocate memory

-bash: fork: Cannot allocate memory
[shee@sg9 ~]$ pkill node
-bash: fork: Cannot allocate memory
-bash: fork: Cannot allocate memory
[shee@sg9 ~]$ pkill pm2
[shee@sg9 ~]$ pkill node
[shee@sg9 ~]$ pkill pm2
-bash: fork: Cannot allocate memory
N/A: version " -> N/A" is not yet installed.

You need to run "nvm install " to install it before using it.
[shee@sg9 ~]$ ls
access-logs  etc   node_modules  public_html      ssl                  tmp
master   mail  public_ftp    treeftp  start.sh  www
[shee@sg9 ~]$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .