This service will be undergoing maintenance at 00:00 UTC, 2016-09-28. It is expected to last about 1 hours
Bug 6022 - forked children are not getting tidied up when they die
forked children are not getting tidied up when they die
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: kernel (Show other bugs)
6.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Cristian Gafton
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-10-17 10:58 EDT by jeastmond
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 1999-10-17 12:23:25 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description jeastmond 1999-10-17 10:58:52 EDT
Intel RedHat 6.0, kernel 2.2.12-10

If I run the following program it creates 240 child
processes and then hangs. If I do ps -ef I get 240 entries
like this:

je        5562  5470  0 15:52 pts/1    00:00:00 [a.out
<defunct>]


It looks like the children aren't being cleared up
properly when they die.

John Eastmond

---------------------------

#include <stdio.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
    int i,ch_pid;

    for (i=0; i<1000; i++)
        {
            if (!(ch_pid=fork()))
                break;
            sleep(1);
        }

    if (!ch_pid)
        {
            int pid=getpid();
            printf("child: %d pid: %d\n",i,pid);
            exit(0);
        }
    else
        {
            int pid=getpid();
            printf("parent: %d\n",pid);
            exit(0);
        }
}
Comment 1 Cristian Gafton 1999-10-17 12:23:59 EDT
You need to wait() for the child process in the parent.

Note You need to log in before you can comment on or make changes to this bug.