* gzip zombie / spawned from init
@ 2005-06-14 8:54 Nico Schottelius
2005-06-14 10:54 ` Bart Hartgers
0 siblings, 1 reply; 6+ messages in thread
From: Nico Schottelius @ 2005-06-14 8:54 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 793 bytes --]
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?
cinit forks() loadkeys and does waitpid() for it. There is no
loadkeys zombie, only gzip.
Thanks for any input,
Nico
P.S.: Replying to me directly will result in a confirmation mail,
I'll read lkml directly anyhow.
--
Keep it simple & stupid, use what's available.
Please use pgp encryption: 8D0E 27A4 is my id.
http://nico.schotteli.us | http://linux.schottelius.org
[-- Attachment #2: Type: application/pgp-signature, Size: 827 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: gzip zombie / spawned from init
2005-06-14 8:54 gzip zombie / spawned from init Nico Schottelius
@ 2005-06-14 10:54 ` Bart Hartgers
2005-06-14 11:03 ` Nico Schottelius
2005-06-14 11:32 ` Måns Rullgård
0 siblings, 2 replies; 6+ messages in thread
From: Bart Hartgers @ 2005-06-14 10:54 UTC (permalink / raw)
To: Nico Schottelius; +Cc: linux-kernel
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.
Groeten,
Bart
--
Bart Hartgers - TUE Eindhoven - http://plasimo.phys.tue.nl/bart/contact/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: gzip zombie / spawned from init
2005-06-14 10:54 ` Bart Hartgers
@ 2005-06-14 11:03 ` Nico Schottelius
2005-06-14 11:32 ` Måns Rullgård
1 sibling, 0 replies; 6+ messages in thread
From: Nico Schottelius @ 2005-06-14 11:03 UTC (permalink / raw)
To: Bart Hartgers; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 939 bytes --]
Thanks for the fast answer, Bart.
Bart Hartgers [Tue, Jun 14, 2005 at 12:54:14PM +0200]:
> Nico Schottelius wrote:
> > [zombie in your head...]
>
> 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.
Ok, so I'll try to contact the loadkeys developer.
> >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.
Well, wait waitpid(-1, ...) cannot be used, as there are many other
children (the system is booting up at the time the gzip process
becomes a zombie).
Still you cleared this issue for me.
Nico
--
Keep it simple & stupid, use what's available.
Please use pgp encryption: 8D0E 27A4 is my id.
http://nico.schotteli.us | http://linux.schottelius.org
[-- Attachment #2: Type: application/pgp-signature, Size: 827 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: gzip zombie / spawned from init
2005-06-14 10:54 ` Bart Hartgers
2005-06-14 11:03 ` Nico Schottelius
@ 2005-06-14 11:32 ` Måns Rullgård
2005-06-14 12:19 ` Richard B. Johnson
1 sibling, 1 reply; 6+ messages in thread
From: Måns Rullgård @ 2005-06-14 11:32 UTC (permalink / raw)
To: linux-kernel
Bart Hartgers <bart@etpmod.phys.tue.nl> 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
mru@inprovide.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: gzip zombie / spawned from init
2005-06-14 11:32 ` Måns Rullgård
@ 2005-06-14 12:19 ` Richard B. Johnson
0 siblings, 0 replies; 6+ messages in thread
From: Richard B. Johnson @ 2005-06-14 12:19 UTC (permalink / raw)
To: Måns Rullgård; +Cc: linux-kernel
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1817 bytes --]
On Tue, 14 Jun 2005, [iso-8859-1] Måns Rullgård wrote:
> Bart Hartgers <bart@etpmod.phys.tue.nl> 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
> mru@inprovide.com
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: gzip zombie / spawned from init
@ 2005-06-14 16:07 Chad Kitching
0 siblings, 0 replies; 6+ messages in thread
From: Chad Kitching @ 2005-06-14 16:07 UTC (permalink / raw)
To: Nico Schottelius, Bart Hartgers; +Cc: linux-kernel
From: Nico Schottelius
>
>Well, wait waitpid(-1, ...) cannot be used, as there are many other
>children (the system is booting up at the time the gzip process
>becomes a zombie).
>
try waitpid(-1, &status, WNOHANG)
You will need to implement this in your replacement init because
one of init's jobs is to wait on unparented zombie tasks. In the
sysvinit package, see chld_handler() in init.c which handles the
SIGCHLD signal.
Basically, I believe all you need to do is waitpid() in the SIGCHLD
handler until you get a 0 return code.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-06-14 16:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-14 8:54 gzip zombie / spawned from init Nico Schottelius
2005-06-14 10:54 ` Bart Hartgers
2005-06-14 11:03 ` Nico Schottelius
2005-06-14 11:32 ` Måns Rullgård
2005-06-14 12:19 ` Richard B. Johnson
2005-06-14 16:07 Chad Kitching
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®