Bug 6022 - forked children are not getting tidied up when they die
Summary: forked children are not getting tidied up when they die
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel
Version: 6.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Cristian Gafton
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-10-17 14:58 UTC by jeastmond
Modified: 2018-02-13 16:54 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 1999-10-17 16:23:25 UTC
Embargoed:


Attachments (Terms of Use)

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


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