Bug 6022

Summary: forked children are not getting tidied up when they die
Product: [Retired] Red Hat Linux Reporter: jeastmond
Component: kernelAssignee: Cristian Gafton <gafton>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-10-17 16:23:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description jeastmond 1999-10-17 14:58:52 UTC
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 16:23:59 UTC
You need to wait() for the child process in the parent.

Comment 2 openshift-github-bot 2018-02-13 16:54:00 UTC
Commit pushed to master at https://github.com/openshift/openshift-docs

https://github.com/openshift/openshift-docs/commit/1626634fc9681d134633b1a30624048fc67b1bbf
Merge pull request #7442 from tmorriso-rh/Issue-6022-broken-links-for-CNS

Issue 6022: Fixed broken links to CNS for OCP content