Re: [Exim] Opinions sought: hosts_max_try

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Philip Hazel
Datum:  
To: James P. Roberts
CC: exim-users
Betreff: Re: [Exim] Opinions sought: hosts_max_try
On Thu, 29 Aug 2002, James P. Roberts wrote:

> First comment... I see at least 4 repeat IP addresses in the AOL list. This is
> kind of silly on their part, I think. But it does suggest that any list, of
> multiple addresses to try, have duplicates removed as the very first step.


Exim already removes duplicate names from MX lists, keeping only the one
with the lowest valued preference. It should also remove duplicate
addresses for the same host. However, it never entered my mind that
anybody would set up multiple MX records pointing to different host
names that then turned out to have the same IP addresses.

> My suggestion for attempt order would thus be:


Thanks for the comprehensive suggestion. I am not, however, sure that it
is worth doing a huge amount to the existing code. Remember that this
also interacts with retry times, so the order of the list isn't the only
thing that matters.

The current logic sorts identical MX preferences "randomly", and
multi-homed addresses are also sorted "randomly". However, there is one
wrinkle: within a specific MX value, IPv6 addresses are always preferred
over IPv4 addresses.

> I believe that, although this sort algorithm might seem complex, it
> really isn't that hard to code.


But it's always a matter of "getting there from here". At present the
sorting and randomizing is interleaved with fishing the data out of DNS
responses. You may get some IP addresses in the response to the MX
query, but you may not get all of them, so it's quite involved. Exim
does the sorting as it builds the lists rather than sorting them
afterwards.

> OK, that's my 2p worth.


Value for money! I will keep your proposal for possible future thought.
In the meantime, what I have actually done is to make a small change for
4.11. If the hosts_max_try limit is reached, and there are still more
hosts with less preferable MX values, try one IP address for each of
them. This would make no difference in the AOL case - but random sorting
means you "probably" try a different 5 each time (and, depending on your
retry rules, those that failed last time aren't tried anyway). In cases
like

   x   MX   1  ...
       MX   1  ...
       MX   1  ...
       MX   1  ...
       MX   1  ...
       MX   1  ...
       MX   2  ...
       ...


it will try the MX 2 (subject to retry time) after failing on 5 of the
MX 1 hosts. ("5" is of course configurable.)

The other thing I've done, which actually fixes a bug, is that it won't
count hosts whose retry time has expired. That means that an address
won't be finally timed out until an attempt at all the addresses has
failed and they are all past their limit.

--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.