Solved: Entry processes limit reached in cPanel hosting

I have an account at a webhost that is shared between 6 addon domains. Today all the 6 websites served an ugly server error 508 message:

“508 Resource limit is reached”

What the heck and phuck.

I was able to log in to my cpanel, but none of the websites (or their admins) served. So in cPanel I investigated all the traffic and saw nothing particularly wrong with it. No massive hits to any of the sites.

entry-processes-cpanel-limit-50
Entry processes maxed out in cPanel

What I did see under Metrics -> CPU and concurrent Connection usage  was that You have reached entry processes (number of simultaneously running php and cgi scripts, as well as cron jobs and shell sessions) limit 398 times

resource-usage-site-limited-24-hours-php-scripts-entry-processes
Resource Usage Oveerview in cPanel – entry processes limit reached 398 times

So the fault is in entry processes.

Entry Processes
Entry processes are the number of processes that enter your account. For example, every PHP page that is accessed by a user will usually generate a single entry process. Many people misinterpret this value as “number of visitors you can have on your website at once”. Whilst it is true that each visitor accessing a PHP page will spawn an entry process, these processes usually end so quickly that it is extremely unlikely that 10 will be spawned  concurrently and at a single moment unless you had a significantly large number of simultaneous visitors on your website at once. SSH sessions and cron jobs also count towards entry processes.

If the limit for entry processes is met then further processes will be denied. If you are trying to access a PHP page you may receive a 508 (Resource Limit Reached) page.

I have only 6 websites and a couple of development sites (be it mentioned – all WordPress sites with a couple of plugins) and it seemed impossible that I had a 1,5 days of permanent 50 concurrent scripts running.

If only cPanel had an option to see concurrent scripts that are running (I know some hosts have it, mine doesn’t). Only option left – log in via SSH and try to find what processes are running. 

How to enable SSH login on cPanel? 

It could be a whole new article, but basically navigate to Security -> SSH, then generate new SSH keys pair and use a SSH client (like Putty or Bitvise SSH client) to connect to your server.

Once SSH connection active type in this command to see long running PHP scripts. 

ps --sort etime -A -o etime,pid,user,args | grep php | grep -vE 'php-fpm|\-\-mode daemon|grep'

You will see a result something like:
00:11 552452 virt23422 lsphp:1671/domains/tompai.pro/public_html/index.php

The second number here is the PID or process ID.

To see all processes in live mode, type in:

top -icd1

To exit from live mode, just type q.

Now look around and start killing the processes

Killing is simply typing in which PID you want to kill

kill -9 552452

After killing a process, re-run the ps command (just hit the up arrow to see previously launched commands) to see what else pops up.

 

After killing 2 longest run processes my entry processes count dropped to 0 in one minute and the resources exceeded message disappeared – all websites loaded normally immediately. Problem solved. 

 

I wrote this article to share how I managed to solve the problem with entry processes limit reached. I this helps you or gives you hints how to solve your issue, like or comment. If you could improve this solution, add your thoughts in the comments.

 

Additional links:

Helped: https://webmasters.stackexchange.com/questions/51805/how-to-find-what-is-maxing-out-my-entry-processes

Didn’t work: https://stackoverflow.com/questions/9468332/how-can-i-find-out-which-php-script-a-process-is-running-in-linux

Helped: https://support.hypernode.com/knowledgebase/identifying-and-stopping-long-running-processes/

Helped: https://www.inmotionhosting.com/support/product-guides/dedicated-hosting/view-running-processes

Helped: https://www.thiswebhost.com/blog/cloudlinux-shared-hosting-limits-explained/

Post Author: Tom Pai