|
From: Uli Z. <ul...@ri...> - 2006-06-27 14:57:35
|
Am 27.06.2006 um 05:12 schrieb Uli Zappe:
> The only explanation for this is that fetchmail somehow manages to
> do something to the servers it calls that corrupts future
> getaddrinfo() results for these (and only these) servers. Just what
> that could possibly be, I have no idea.
After further inspection af the code and further testing, it seems I
have found this "something":
When getaddrinfo() is called while the Internet is down, it may take
quite some time until it returns the respective error. Now, if the
"timeout" variable in fetchmail is set to a value shorter than this
time that getaddrinfo() needs, a call to SockOpen() (socket.c, line
266) from (at least) line 1053 in driver.c will be interrupted by the
timeout signal handler. In this situation, freeaddrinfo() (line 311
in socket.c) will never be called to close ai0 correctly. This, in
turn, seems to produce the corrupted behavior of future getaddrinfo()
calls (at least in Mac OS X's implementation).
In my test case, getaddrinfo() may need up to 180s to time out.
However, I had set fetchmail's "timeout" parameter to only 60s. In my
tests, during the time when the Internet connection was down, at
least one "timeout after 60 seconds waiting to connect to server xy"
did indeed appear in the log for each server.
I have now set fetchmail's "timeout" variable to 6000 and repeated my
tests. No timeout message occurred, and after the Internet connection
was up again, fetchmail resumed fetching mails just as it should.
So I'm quite sure that's the bug: Care must be taken that freeaddrinfo
() is called even if SockOpen() is interrupted by a timeout. So you
must either make ai0 a global variable (which won't work if you plan
to make fetchmail open more than one socket simultaneously), or
declare it in the calling code (driver.c or whatever) and pass it to
SockOpen.
My question now is how to proceed. Since you definitely know
fetchmail's code much better than I do, it would make sense that you
fix the bug in all places where it might occur. However, since the
bug is crucial at least for me, I'd need a fix soon. So do you think
you will come up with a fix in a short amount of time, of should I
provide a fix temporarily (but I will probably overlook some of the
situations where this bug might possibly occur - so far I'm only
aware of driver.c line 1053 calling SockOpen())?
Bye
Uli
________________________________________________________
Uli Zappe, Solmsstraße 5, D-65189 Wiesbaden, Germany
http://www.ritual.org
Fon: +49-700-ULIZAPPE
Fax: +49-700-ZAPPEFAX
________________________________________________________
|