0

Whenever Apache kills child process to create new ones after the MaxRequestPerChild is satisfied, I see Defunct Apache processes in the ps output. There defunct processes clear by themselves in a short while. However, there is temporary sharp hike in Load Average of the server.

I am not able to understand, why do these processes go to defunct state when they are killed.

I am running a PHP application with mod_php module in Apache, Pre-fork module of Apache. I can't upgrade PHP on server due to application need.

Any Idea?

1
  • can you give us more information about your setup and settings.
    – ADM
    Jul 3, 2014 at 9:48

2 Answers 2

2

You can't kill it because it is already dead. The only thing left is an entry in the process table. On Unix and Unix-like computer operating systems, a zombie process or defunct process is a process that has completed execution but still has an entry in the process table. This entry is still needed to allow the parent process to read its child's exit status. There is no harm in letting such processes be unless there are many of them. Zombie is eventually reaped by its parent (by calling wait(2)). If original parent hasn't reaped it before its own exit then init process (pid == 1) does it at some later time. Zombie Process is just:

A process that has terminated and that is deleted when its exit status has been reported to another process which is waiting for that process to terminate.
3
  • Well, I was just curious why Apache does that.
    – Ankit
    Jul 3, 2014 at 9:43
  • 1
    check access & error logs in the respective directory of your server.Or provide here the logs.
    – Innovator
    Jul 3, 2014 at 9:54
  • 2
    PHP Website or application,mysql queries,bad coded scripts or something might be possible reasons.
    – Innovator
    Jul 3, 2014 at 10:14
2

I guess you host some heavy PHP applications (such as Magento or Drupal with some heavy 3rd party modules) and cleaning up the resources used (database connections etc) during the exit takes some time. Similarly, spawning the new processes takes some time.

Of course your Apache might have some heavy modules installed too, for example mod_security. Or your PHP has some additional modules loaded. Hard to tell since your question is quite vague and lacking details.

1
  • Yes. A old and heavy PHP application is run with a old version of PHP(5.2.7). Does not has Apache has mod_security enabled or any extra module. mod_php is used to run PHP app with Apache. The thing is same application has been running fine on the server for a long time. However, I started to see this strange issue 2-3 days back only. Only the application is getting a lot of requests these days. Server is 8 core, 16 Gb of RAM
    – Ankit
    Jul 3, 2014 at 10:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .