Re: gzip zombie / spawned from init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 14 Jun 2005, [iso-8859-1] Måns Rullgård wrote:

Bart Hartgers <[email protected]> writes:

Nico Schottelius wrote:
Hello!
I wrote an init replacement (cinit), which is now in the beta-phase.
The only problem I do have currently is that when calling
'loadkeys dvorak' directly from init (without a shell or anything)
it will leave behind a gzip zombie (which was forked by loadkeys).
Now my question is: Is that a problem of loadkeys or from my init
and what could be the reasons that it's still there?

Not really a kernel issue but:

Yes and no. If a parent exits before its child, the child is
reparented to init. loadkeys probably doesn't wait properly for gzip
to finish.

cinit forks() loadkeys and does waitpid() for it. There is no
> loadkeys zombie, only gzip.

Use waitpid(-1,...) or wait(...) to wait on all childeren in your
init. gzip will become a child of cinit.

In fact, init must reap any zombies that are reparented to it.
Otherwise, the system will sooner or later run out of PIDs.  There are
a lot of misbehaving programs out there, and even if they were all
well-behaved, they could be killed before having waited for their
children, leaving zombies behind.

--
Måns Rullgård
[email protected]


Normally an `init` program will provide a SIGCHLD handler like:

void reaper(int sig)
{
    while(wait3(&sig, WNOHANG, NULL) > 0)
        ;
}

This will 'reap' and throw away the status of all dead children,
preventing zombies.


Cheers,
Dick Johnson
Penguin : Linux version 2.6.11.9 on an i686 machine (5537.79 BogoMips).
 Notice : All mail here is now cached for review by Dictator Bush.
                 98.36% of all statistics are fiction.

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux