skip to Main Content

I have a single node.js app running on my shared web host. The cPanel shows 67/100 processes, and 7 entry processes.

The thing is, the site currently doesn’t do anything except letting users see it.

The number of processes when I first deployed the app a week ago was only 11/100. But it keeps rising gradually, for no apparent reason..

I was wondering if my code has any issue to be causing this.. It is fairly simple, but there may be something I do not see.

My entire project is hosted on github at https://github.com/ravindukrs/HackX-Jr-Web

===================

What I tried

I Stopped the app from cPanel. But number of processes didn’t go down. It slightly reduced the CPU Usage though.

Note

CPU Usage remains 0/100 even when the app is running.

I am not a great developer, so code may not be optimized. But was just wondering if I am creating any processes that do not end..

The site is currently hosted at https://hackxjr.lk

Thank you in advance.

cpanel processes

Update: Count is still going up

4

Answers


  1. Here is my experience with this same problem and how I resolved it.

    I setup a simple NodeJs app on my Namecheap host and about a day later my whole domain was unavailable. I checked CPANEL and noticed 200/200 processes were running. So I contacted Support and they said this:

    As I have checked, there are a lot of stuck NodeJS processes, I will take necessary actions from my end and set up a cron job for you that will remove the stuck processes automatically, so you won’t face such issue again. Please give me 7-10 minutes.

    Here is the cron job they setup:

    ps faux | grep lsnode | grep -v 'grep' > $HOME/tmp_data; IFS=$'n'; day=$(date +%d); for i in $(cat $HOME/tmp_data); do for b in $i; do echo $i | awk -F[^0-9]* '{print $2" "$9}' | awk -v day1=$(date +%d) '{if($2+2<day1)print$1}' | xargs kill -9 && echo "NodeJS process killed"; done; done >/dev/null 2>&1
    

    I have not had an issue since.

    Login or Signup to reply.
  2. You can stop unused processes by run this command:

    /usr/bin/pkill -9 lsnode
    
    Login or Signup to reply.
  3. I also had the problem on Namecheap. Strange that it is always them…

    Support told me it had to do with their CageFS and that it only can be fixed/reseted via support.

    Edit:
    support gave me a new cronjob to run

    kill -9 $(ps faux | grep node | grep -v grep | awk {'print $2'})
    

    For me, this one is working better than the command from Gerardo.

    Login or Signup to reply.
  4. I have encountered the exact same issue like you are describing. My hosting provider for NodeJS apps and PHP sites is Namecheap too. Strange that their name keeps popping up on this thread.

    This is what Namecheap support said:

    According to our check, the issue was caused by the numerous stuck processes generated by the Node.js app. We have removed them and the websites are now up. In case the issue reappears, we would recommend contacting a web developer to optimize your app and/or setting up the following cron job to kill the processes:

    /usr/bin/pkill -9 lsnode >/dev/null 2>&1
    

    If you are using cPanel, this article might help you to setup a cron job: https://www.namecheap.com/support/knowledgebase/article.aspx/9453/29/how-to-run-scripts-via-cron-jobs/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search