What can cause cpu usage 100% entry processes max

Discussion in 'IT & Internet' started by UKSBD, May 13, 2019.

  1. UKSBD

    UKSBD Not a real duck Staff Member

    9,204 1,725
    One of my sites is giving Resource Limit Is Reached error message.

    It is running 2 Wordpress installations in 2 separate directories, I've renamed both and deleted everything else except an index page

    I renamed the index.php as 1.php and uploaded an index.html page

    The index.html page loads, but not the 1.php page

    Would the cpu usage and entry processes being at max only effect the .php pages and is there any way of finding out what is causing it?

    Could it just be traffic causing the resource limits as my control panel still shows the resources errors even though everything has been deleted (or re-named)
     
    Posted: May 13, 2019 By: UKSBD Member since: Dec 30, 2005
    #1
  2. WESH.UK

    WESH.UK UKBF Contributor Free Member

    69 16
    Hi UKSBD

    The most common cause of this could simply be down to people trying to login to your wordpress install.

    Depending on your hosting, do you have a way to view live visitors on your website?

    Within cPanel for example, the "Visitors" section lets you see who is on your website and from where, and what URL they are on, and a common cause of your issues is that the "wp-login.php" is being flooded with login attempts from various IP's all over the place.

    Its a form of "Brute Force Attack" / Denial of Service" attempt.

    That's 1 possibility of several.

    The best people to speak to about this is your hosting company, they have access to log files and can also help you make sense of them and should be able to show you where to look if things go pear shaped.

    Have you spoken to them already?
     
    Posted: May 13, 2019 By: WESH.UK Member since: Aug 11, 2018
    #2
  3. UKSBD

    UKSBD Not a real duck Staff Member

    9,204 1,725
    No visitors who look like problems and as I've deleted everything they are just getting an error page

    My host says;

    "Your account has a set limit of hardware resources. If your site is running slow at times, or you're receiving 508 errors this will because you're hitting the limits of your hosting package.
    Overall this problem occurs because of either
    1) Your site is getting a lot of traffic, or
    2) Each request uses a lot of CPU / Memory, so although you have low traffic, your site uses a lot of resources to generate each page, or
    3) A combination of the above"

    As there are no files now that can be using any CPU / memory I'm at a loss to knowing why it still using 100% CPU
     
    Posted: May 13, 2019 By: UKSBD Member since: Dec 30, 2005
    #3
  4. Dominic Taylor

    Dominic Taylor UKBF Ace Full Member

    1,174 254
    Only your host can tell - ask them to look at your account properly. They can see what processes are running, watch what they're doing, what files they have open etc.

    Hopefully just a bug in a script causing an infinite loop or something innocuous like that :)
     
    Posted: May 13, 2019 By: Dominic Taylor Member since: Jun 19, 2008
    #4
  5. WESH.UK

    WESH.UK UKBF Contributor Free Member

    69 16
    WOW, that was about as unhelpful as can possibly be. Go back to them and ask them "Can you help me see what is causing the problem and how I can check in future?"

    They should have done that to start with by saying "here is what can possibly cause it, here is what is causing your issues and here is how you can keep an eye on it going forward.

    Dominic is also right, it can also be caused by a bug in some code, going round in circles creating never ending loops of processes that will never finish.
     
    Posted: May 13, 2019 By: WESH.UK Member since: Aug 11, 2018
    #5
  6. Dominic Taylor

    Dominic Taylor UKBF Ace Full Member

    1,174 254
    When this landed in my inbox I misread and thought you meant my reply and had a small heart attack :D

    It would take them 5 seconds to look at the process list and figure the issue so hopefully they can be a little more helpful.

    Cloudlinux is great but it does cause these unnecessary problems where you can't see what's going on, but also can't fix it.

    The way I look at it, limits should never be reached when things are behaving. I've accidentally run quite a busy site on very small limits before but the site was efficient, so it was surprisingly (and fortunately) fine.
     
    Posted: May 13, 2019 By: Dominic Taylor Member since: Jun 19, 2008
    #6
  7. UKSBD

    UKSBD Not a real duck Staff Member

    9,204 1,725
    That's what I tried to rule out 1st by deleting almost everything.

    Should deleting everything stop the resource errors messages straight away or would there be a delay in the reporting?

    In the end I left everything deleted for a few hours then gradually started reloading them and site appears fine now
     
    Posted: May 14, 2019 By: UKSBD Member since: Dec 30, 2005
    #7
  8. Dominic Taylor

    Dominic Taylor UKBF Ace Full Member

    1,174 254
    Usually though you'd hit the PHP max execution time (say 10 minutes?) and the script would stop.

    If a rogue script was running you could only see / stop it from SSH by doing a 'ps' so you're kinda stuck without advanced knowledge or their help unfortunately.

    Certainly with no files there, there's no possible way for there to be new usage, which proves their reply wrong and unhelpful!
     
    Posted: May 14, 2019 By: Dominic Taylor Member since: Jun 19, 2008
    #8
  9. HostXNow

    HostXNow UKBF Regular Full Member

    350 23
    Yes, that does not sound right. I would copy the site to another provider and test the difference.
     
    Posted: Jun 4, 2019 By: HostXNow Member since: Mar 7, 2011
    #9
  10. Karl M

    Karl M UKBF Newcomer Free Member

    20 0
    it could be many things but one of the obvious - crypto mining malware.
    in this case, they trying to steal your processor power to mine cryptocurrency.
     
    Posted: Jul 6, 2019 By: Karl M Member since: Jul 5, 2019
    #10
  11. Diane1

    Diane1 UKBF Newcomer Free Member

    10 0
    Checking account regularly can help to reduce these type of issues.
     
    Posted: Jul 12, 2019 By: Diane1 Member since: Jun 28, 2019
    #11
  12. Dan_HiHosting

    Dan_HiHosting UKBF Ace Full Member

    1,104 270
    There will be a delay, yes.

    It's best to ask your host to reset the limits after you've made the changes.

    Then you can easily see if it's fixed.

    The first thing I'd check is the error_log file, although I imagine you did that.

    Often it's plugins or other issues with the WordPress installation eating up resources, and you'll find the error_log file flooded with PHP warnings or errors.

    You can rename the current file to for example error_log~ after you think you've addressed the issue, and monitor it for any new output.

    Also if you harden WordPress from the start, secure the installation, and block bad bots that can help.

    For example you can add the following to your .htaccess file:
    Code:
    # Block wp-config.php access
    <files wp-config.php>
    order allow,deny
    deny from all
    </files>
    
    # Block the include-only files
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^wp-admin/includes/ - [F,L]
    RewriteRule !^wp-includes/ - [S=3]
    RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
    RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
    RewriteRule ^wp-includes/theme-compat/ - [F,L]
    </IfModule>
    And you can block bad bots.

    Bad traffic, brute force attempts and so forth can also cause elevated resource usage.

    A healthy, locked down installation on decent hosting, with a good firewall shouldn't have any issues.

    Best of luck,

    Dan
     
    Posted: Jul 26, 2019 By: Dan_HiHosting Member since: Mar 7, 2011
    #12