[RFC] Missing signal handling in ndo2db

Hendrik Baecker andurin at process-zero.de
Wed Jul 1 11:51:53 CEST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi List,

regarding the flat ndo2db init script with it's tough "killall
ndo2db..." I reviewed the signal processing in ndo2db.

Intro:
As we know ndo2db forks first to become a daemon, no problem up to here,
and forks again for each client connection.
Each client connection has the daemon as session leader but if we send
this leader a SIGTERM the parent process is exiting, deleting the
socket, cleaning up and 'over and out'.
Bad thing: The forked connection child is still alive, hanging around in
read() from the (non existing) socket descriptor.

Possible Solution:
kill(0,sig);

kill(0,SIGNAL) should send the SIGNAL to the complete process group, the
childs do already recognize SIGTERM resulting in _exit(0).
The existing parent sighandler for SIGCHLD does a waitpid for the childs
and in my opinion the world is nice so far.

I already tested the attached patch and it's working fine so far, I just
want to see if there are better ways to handling those parent/child signals.

Regards,
Hendrik
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpLMbgACgkQlI0PwfxLQjlwPQCeKBoR0TMhVHhCp2OsO8huUpQ6
27sAn1RysNAs4fdMjhV0prlS60Nr9ExO
=uYBW
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ndo2db-fix-child-signals.patch
Type: text/x-patch
Size: 799 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20090701/fa607bf3/attachment.bin>
-------------- next part --------------
------------------------------------------------------------------------------
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list