Fork again...
michael at optusnet.com.au
michael at optusnet.com.au
Thu Feb 3 03:38:05 CET 2005
Andreas Ericsson <ae at op5.se> writes:
> Oscar Paniagua wrote:
> > I need to make the next question:
> > - For what in check.c you make two fork's:
> > /* fork a child process */
> > pid=fork();
> > /* fork again... */
> > pid=fork();
>
> So as to not create zombie processes in case something goes wrong with
> plugin execution. Otherwise an uninterruptable IO request could quite
> possibly hang the entire daemon.
>
That doesn't make much sense. How can an IO request in the
child affect the parent? The parent should be doing non-blocking
wait() requests to reap the child processes, which will clean up
any zombies as they appear.
Right now the code is mildly awful. The parent does a fork()
following by a blocking wait(). the child does fork() and exit.
the grandchild does the check.
The much better thing to do would be to just fork() and in the
main loop do a wait(WNOHANG) to clean up the children as they
exit.
Nagios number one problem at the moment is the terrible scalability
and the penchant to make things much more expensive than they should
be doesn't help. :)
Michael.
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
More information about the Developers
mailing list