:: Re: [DNG] BUG: zombies increase whi…
Página Inicial
Delete this message
Reply to this message
Autor: Rainer Weikusat
Data:  
Para: dng
Assunto: Re: [DNG] BUG: zombies increase while running netman
Edward Bartolo <edbarx@???> writes:
> OK, poWaitOnExit added and zombies creation has been reduced. However,
> I am still getting these:
>
> 3584 ?        00:00:00 kworker/u8:0
>  3586 ?        00:00:00 kworker/1:3
>  3588 ?        00:00:01 netman
>  3623 ?        00:00:00 ifdown <defunct>
>  3644 ?        00:00:00 kworker/0:0
>  3645 ?        00:00:00 kworker/0:3
>  3898 ?        00:00:00 ifup <defunct>
>  4142 ?        00:00:00 ifdown <defunct>
>  4163 ?        00:00:00 kworker/0:4
>  4186 pts/0    00:00:00 ps

>
> This means, I have to also add code to the backend to properly clean
> up after terminating on every run.
>
> It looks like the culprit is execl which is used in core_functions.c.
> We must add some code to rid ourselves of zombies.


The 'culprit' is the program invoking the backend: It's not collecting
the exit status of child processes created by it. Hence, the kernel
keeps them around forever. In case you really don't care, code creating
new processes can set the dispostion of SIGCHLD to SIG_IGN. In case the
backend replace itself with another program by doing an exec system
call, eg, via execl (one of serveral wrappers for execve), this needs to
be done in the front end.

Alternatively, the backend can fork and let the new child do the exec
while the parent waits for the process to terminate. This will give you
access to the exit status of the 'worker' process which might be
useful. Since parent and child share the set of open file descriptors,
the frontend will still be able to read data written by 'worker' command
in the same way.