Consultor Eletrônico



Kbase P17840: What are defunct processes and what causes them?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   26/08/2009
Status: Verified

GOAL:

What are defunct processes and what causes them?

FIX:

A defunct process is one which no longer exists but still occupies an entry in the system's process table. This occurs when a process forks a sub process and the sub process finishes doing whatever it does and exits. When it exits, it emits an exit status which can be collected by its parent process. In order that the exit status can be kept until the parent asks for it, it is stored in the process table entry of the sub process.

So, when the sub process (also called a child process) has exited, it is "defunct" until the parent asks the system for the exit status. Once the parent has done this, the entry is deleted by the system. Usually, the parent process will retrieve the exit status very soon after the child exits, so you don't see the defunct processes.

If the parent never asks for the child's exit status, the process table entry stays there.

Scenarios where Progress creates a sub process:

1. During the startup of a database using proserve <db-name> an instance of _mprosrv is created. It then forks a copy of itself to run in the background, and exits, leaving the background process there. This background process is the broker.
2. The broker forks servers to access the database on behalf of remote clients. The servers are supposed to detach themselves from their parent to become "detached" or "background" processes like the broker.
3. Executing a UNIX escape, a sub process is created.
4. Using "input through" or "output through" a sub process is created.
5. Bugs in the code for any of these operations can cause defunct processes to appear.