[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Sat, 19 Jul 2003 16:13:35 -0700
I am using monit running from init and I am observing that sharing of file
descriptors across fork/exec is occurring.
The most obvious example is the monit log file, which remains open to every
process started by monit.
I also observe that when processes are "restart"ed that three temporary
sockets are inherited from monit.
These sockets go into a CLOSE_WAIT state in the monit process for a short
At one stage I also had some monitored processes sharing the 2812 HTTPD
Given that the HTTP server runs as a thread then the absence of a critical
section between the socket creation and the fcntl( fd, F_SETFD, FD_CLOEXEC )
is wide enough to allow this. This was a serious problem, as it prevented
monit from restarting as it could not listen on that port because one of its
"monitored" processes was already listening on the port.
Rather than sprinkling more FD_CLOEXEC and critical sections in the code I
think it would be better to close fd's in the spawn.c code.
- Closing files,
Peter Holdaway <=