[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Closing files

From: Martin Pala
Subject: Re: Closing files
Date: Tue, 22 Jul 2003 22:04:03 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030714 Debian/1.4-2

Hi, thanks for problem report :)

It is fixed in CVS version and upcoming release now .


Peter Holdaway wrote:


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
listener port.

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.


To unsubscribe:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]