Zombies, httpd, WordPress, Archives & exec-php

httpd is showing me a lot of zombies the last 2 or 3 days
when checking with ps -aux I see apache …….. “[host] <defunct>”
checking pstree -lp I see that httpd is creating them

httpd is |-httpd(9773)-+-host(10896)
       |              |             |-host(10966)
       |              |             |-host(11015)
       |              |             |-host(11117)
       |              |             |-host(11518)
       |              |             |-host(11591)
       |              |             |-host(11709)
       |              |             |-host(11873)

etc…

top shows me:
382 zombie processes at this time.

Of course I can restart the httpd process (which is does itself every night)

but I want to know; what are zombies, what are they doing and does it hurt?

if it’s not something okay how to get rid of it ?

It’s probably due to ‘WordPress Weblog’ software as I see the live – hits an checking the zombie counting with TOP
Some hours later: I found the issue. Zombies were created due to an incorrect configured plugin (smartarchives) together with the exec-php plugin. the directive to the archive folder was incorrect. The mod_rewrite did show a page.. but .. not the correct one I just discovered (duhhh*) ..

fixing path, restart httpd .. tadaaaaaaahhhh (still some zombies there but not that much).  Seems that more people have this issue. In certain situations, which are unclear, the zombies appear. with following crontab you can remove them:

*/10 * * * * ps auxw|grep apache| awk ‘$10 !~ /0:00/ {print $2}’|xargs kill -9 2> /dev/null

so to make long story short … I think I have to live with it, or someone must have an alternative solution

 

3 thoughts on “Zombies, httpd, WordPress, Archives & exec-php

  1. This is intended behavior by httpd, not a mistake or zombie.
    The cron job is therefore pretty silly ;-)

    These idle processes are spare servers, running so that http can pick up where it was left before with specific caching, proxying and other known to httpd processes. They are a good thing, basically, but if your server is very busy, like tweakers or fok, it would be better to keep it below 32 spare servers, depending on the types of caching that are used etc.

    You can control the maximum in httpd.conf with the MaxSpareServers directive. I usually set it to 20. Depending on how much RAM you have, how fast your RAM is, how much CPU power is available for the httpd processes (and RAM), how many NICs are accessing that httpd, how many requests it needs to be able to handle etc. You can safely raise it above the default of 10 spare servers if you have, say, 1 GB of fast DRAM (400 MHz+) or more.

    In essence what it does is replace hardware functions by letting httpd software resemble them. So, the more spare servers you offer, the more CPU and RAM accesses will occur (and less HD-reads are needed).

    It is also especially useful if you use a lot of php on your site with some caching engine on it, because httpd will be able to serve pages some nanoseconds faster when spare servers already know the accessed material. ;-)

  2. uhm.. that’s a whole other way of thinking ..
    okay let’s try for 1 day to see what’s happening. the server is restarting httpd every night so … we can try it ;-)

  3. I overlooked the fact that you mention over 300 of those spare servers, that is a little strange yes. There shouldn’t be more than the MaxSpareServers entry says in your httpd.conf …
    Do you have that entry in httpd.conf ?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.