[Nagios-devel] event_handler pipe fd inheritation
Nagios network monitoring software is enterprise server monitoring
Brought to you by:
egalstad,
sawolf-nagios
From: Bastian F. <bf+...@co...> - 2009-02-27 11:27:07
|
Hi, we are using a mechanism in our event_handlers that shall try to restart broken local services; eventually, normal init scripts (/etc/init.d/...) are started, which in turn start arbitrary daemons (say, mysql). nagios creates a pipe to its event_handlers (and possibly other executables) in base/util.c for parent/child communication. The file descriptor to this pipe is (currently) not given the FD_CLOEXEC. This results in this fd being inherited by the event_handler (started by "popen()"), and, in our case, by the daemon (say, mysql). (The pipe is, e.g., visible in /proc/<whatever>/fd). As our daemons do not tend to close arbitrary fd's, this fd is never closed from the event_handler. As nagios waits for the file to be closed to continue its work, this results in a "denial of service" for the time that the daemon runs. The pipe fd should be set the FD_CLOEXEC flag; it is then not inherited by the event_handler. Patch attached. Best regards Bastian -- Collax GmbH . Burkheimer Straße 3 . 79111 Freiburg . Germany p: +49 (0) 761-45684-28 f: +49 (0) 761-45684-10 www.collax.com Geschäftsführer: Boris Nalbach AG München HRB 158898 . Ust.-IdNr: DE 814464942 \ "I am two fools, I know, for loving, and for saying so." \ John Donne |