SitePoint Sponsor

User Tag List

Results 1 to 18 of 18

Hybrid View

  1. #1
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,862
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)

    Apache using 100% resources

    Every so often httpd.exe decides it needs 100% of the CPU and brings everything on my computer to a halt - resulting in my having to power down the computer and reboot just in order to be able to continue working.

    What do I need to change in the Apache settings to limit it to say 20% CPU maximum? It's Apache 2.2.22 running on Windows XP.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,862
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Additional info:There are two instances of httpd.exe created when I turn on the Apache service - one uses 45660k of memory and the other uses 48120k of memory.

    When I access a local page that isn't cached the 48120k copy goes to about 50% and the memory usage starts growing. Even if the web browser is then closed the memory usage keeps growing. Nothing is written to either the access.log or the error.log at that point but if I leave it like that for a while it eventually starts writing Gigabytes worth of errors to the error log - the error log ends up too big to open but presumably contains billions of out of memory errors.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Stephen,

    Have a look at the httpd.conf for Child Processes and limit the number. That should help. I don't believe that you can limit CPU usage via httpd.conf (especially on a WinDoze box) but, on a production machine, I believe that's a function of Virtuozzo (or other virtual machine software) which you could emulate in a Virtual Machine on your box (Win7's XP can be managed that way as I recall).

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,862
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    I can't find any child process settings in httpd.conf - anyway there are only the two Apache processes running. It looks like limiting access wouldn't fix theproblem anyway as it looks like Apache is getting stuck in an infinite loop just using up more and more resources until they run out.

    The problem occurs when 7 out of 15 files have loaded to display the Wordpress 3.4 admin panel for the first time during a new Wordpress install. So it appears to be a conflict between Apache and Wordpress that initially puts Apache into an infinite loop - which isn't cleared by closing the browser, the only way to stop Apache using more and more resources after that point is to restart Apache.

    Any idea why this might be occurring. Should I reinstall Apache?
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,068
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    It's been a while since I lasted used XP but from a quick google there are apps that can limit the cpu usage. I can't remember if there is any option in XP's task manager to limit the number of cores a process can use.
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  6. #6
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,862
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by SpacePhoenix View Post
    It's been a while since I lasted used XP but from a quick google there are apps that can limit the cpu usage. .
    That will not fix where WordPress puts Apache into an infinite loop though - it would just allow me to keep working until Apache generates enough out of memory errors for the log to fill the hard drive.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  7. #7
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Stephen,

    I'm surprised that you'd need several WP admin scripts open at one time. That's point #1 to consider. It's likely that there is a PHP setting (php.ini - but you'll have to look at your setup to determine which one you're using) which is limiting the overall memory consumption forcing paging which is probably the "hang-up." I'll have another look after dinner, er, tea!

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  8. #8
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,862
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by dklynn View Post
    Stephen,

    I'm surprised that you'd need several WP admin scripts open at one time.
    I don't - I had one tab open in the browser doing a brand new install of WordPress to a new location. It created the tables in the database and then allowed me to log in as admin then hung with the welcome page partly displayed and with Apache trying to take over all the resources in the computer. Nothing else was running on the computer at the time when I tried to go in for the second time after having to reboot when the computer hung the first time apart from the task manager and Apache monitor.

    No plugins installed yet as WordPress itself hasn't completed installing.

    Also since it is my test environment I have maximum error reporting turned on in PHP and there are no messages produced whatsoever from there - just as the Apache error log remains empty (apart from the start up messages) until it runs out of memory.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  9. #9
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,068
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    Is it a clean install (no previous versions of WP already there) or is there an instance already there (if so are you doing a second install or upgrading the current installation?)

    Try cranking PHP's error reporting up to maximum, does anything stand out in PHP's error logs (if you're set up to record errors to a log file)?

    Found this have you got that plugin installed?
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  10. #10
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Stephen,

    Eureka, I found the soap.

    Code:
    ;;;;;;;;;;;;;;;;;;;
    ; Resource Limits ;
    ;;;;;;;;;;;;;;;;;;;
    
    max_execution_time = 30     ; Maximum execution time of each script, in seconds
    max_input_time = 60	; Maximum amount of time each script may spend parsing request data
    ;max_input_nesting_level = 64 ; Maximum input variable nesting level
    memory_limit = 128M      ; Maximum amount of memory a script may consume (128MB)
    Compare your php.ini with that and see if you don't find any improvement.

    I thought I'd seen something where either Apache or PHP was not supporting XP any longer, too, but I can't find any reference for you. Since you didn't mention which version of PHP you've installed on the latest Apache (2.2.22), there may be some incompatibility.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  11. #11
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,096
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    50MB per process for Apache is normal, nothing strange about that, so that's not the problem.

    Are you running 64bit Apache? In my experience that one is extremely buggy for Windows, as is PHP 64 bit. On windows you're a lot better off using 32 bit Apache and PHP as they run just as fast but are a lot more stable.

    Also, is the browser requesting resources over and over, or is it just one request that hangs Apache? Using something like HTTP Live Headers for FireFox you can see which requests are made.
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  12. #12
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,862
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Both Apache and PHP are 32 bit versions - in both cases they are the latest versions that are supported on my system.

    The php.ini resource limits are exactly as David listed. Apache is exceeding those limits so that presumably eliminates PHP as the problem.

    The browser isn't requesting the resources (at least not after the initial call - since I closed the browser and Apache continued to use more and more resources without any browser running at all.

    All of the PHP scripts I wrote myself all run fine - it seems to be something specific to the Wordpress install process.

    I managed to work around the problem by installing Wordpress on my web hosting and then FTPing the files to my computer. It now loads without Apache going into an infinite loop.

    Thanks for all the suggestions David and Remon.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  13. #13
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    No problem, Stephen.

    Saying that, I would think there must be a problem with the database connection. BTW, I'm running Win7/64 with no problems.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  14. #14
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,862
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    When I tried opening a different browser (I usually use Opera) the browser hung straight away and started using more and more memory without displaying anything - happens with IE8, Chrome, Firefox, and Safari. The home page on localhost is defined so as to be parsed for PHP but doesn't actually contain any PHP at the moment. There certainly are not any database calls so the problem can't be database related - all the scripts run fine on Opera except for that one situation where it got as far as displaying the dashboard in a wordpress install.

    I have win32DisableAcceptEx defined in the resources. With that in place the CPU goes to 50% when I open a browser other than Opera and then the memory increases forever even after closing the browser. If I comment it out then the CPU goes to 99% as soon as Apache starts and the only way to open any application at all means trying to get Apache to shut down first.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  15. #15
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,068
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    What's the version number of the PHP version that you're using?
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  16. #16
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Stephen,

    PM/e-mail me your httpd.conf and I'll take a look at that to compare against mine for clues. If I find nothing there, I may ask for your php.ini then ask if you can use your MySQL setup from a command prompt without memory abuse.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  17. #17
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,862
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by dklynn View Post
    Stephen,

    PM/e-mail me your httpd.conf and I'll take a look at that to compare against mine for clues.

    Regards,

    DK
    Thanks for the offer David. I decided to try one more thing before taking you up on it and that was to do a clean reinstall to get rid of any changes I might have made while trying to fix the problems i was having - I'd started having problems when both the drive running apache and mysql started to approach capacity due to the apache log files having got too big and with the data drive with the local copy of my web site on it also having got almost completely full. I am not sure what changes I made while trying to fix the crashes I was getting before I realised it was a space problem and cleaned that up but something I tried there must not have been reversed out properly and was causing the problem. After a clean reinstall, changing the lines in the httpd.conf to point to my site folder and recreating the database users I appear to have all browsers working again. I renamed the original folders prior to starting the reinstall so if I overlooked anything I have a copy of what was there before. Hopefully everything will now work properly as there is now plenty of space on both drives.



    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  18. #18
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)


    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •