:: Re: [DNG] Doing away with multi-thr…
Top Pagina
Delete this message
Reply to this message
Auteur: Laurent Bercot
Datum:  
Aan: dng
Onderwerp: Re: [DNG] Doing away with multi-threading in my project (netman)
On 03/09/2015 18:35, Steve Litt wrote:
> I'd figure out how to stop those zombies from happening in the first
> place. It's pretty hard to create a zombie: I think you have to
> doublefork and then terminate.


Nope, a zombie is actually very easy to create:
- have a process parent that spawns a child and stays alive
- have the child die first, and the parent not reap it.
That's it. A dead child is a zombie until the parent acknowledges its
death, and if the parent is failing its duties, the zombie will remain,
an empty soulless shell spawned inconsiderately with no love or
regards for consequences that will haunt the system forever.

...not quite forever. If the parent dies, the child process' paternity
will be reassigned to PID1, and PID1 will receive a SIGCHLD. Basically
every PID1 program correctly handles that and reaps every zombie it gets,
even if it's not the one that fathered it.

But when the parent is a daemon, it's not supposed to die, so counting
on PID1 to do the dirty work is obviously not a solution, and it has to
reap children.

Edward's problem is that his "backend" process is spawning children and
not reaping them. It has nothing to do with the frontend. To make sure
what process the zombies are children of, use the "f" option to ps, or
the pstree utility.

--
Laurent