Rohit Kumar <rohitk(_at_)whitepj(_dot_)com>:
We found that there is an file descriptor leak after each iteration.
Here is the sequence of events which we believe results in descriptor leak
a) do_protocol calls do_session.
b) do_session sets a timer and then call setjmp().
c) SockOpen is called to open a connection to the desired mailbox.
d) SockOpen allocates a socket and calls connect().
e) While the call is in the connect, timer goes on.
f) The timer handler function timeout_handler() is called. (This is before
fm_close is called. SO socket is not closed)
g) The timeout_handler() calls longjmp() which clears the current context
and thus the socket remains open.
If we are wrong please correct us.
I believe you are correct. To deal with this, I now block signals during
the critical region around the connect(2) call in SockOpen() and UnixOpen().
--
<a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a>
As war and government prove, insanity is the most contagious of
diseases.
-- Edward Abbey