[Exim] Opinions sought: hosts_max_try

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: exim-users
Subject: [Exim] Opinions sought: hosts_max_try
Sorry this is so long, but if anyone has any bright ideas...

The hosts_max_try option (default 5) was added to the smtp transport to
cope with sites like AOL, who use the DNS like this:

aol.com.                 MX 15 mailin-04.mx.aol.com.
aol.com.                 MX 15 mailin-01.mx.aol.com.
aol.com.                 MX 15 mailin-02.mx.aol.com.
aol.com.                 MX 15 mailin-03.mx.aol.com.
mailin-04.mx.aol.com.    A  64.12.137.121
mailin-04.mx.aol.com.    A  64.12.137.152
mailin-04.mx.aol.com.    A  152.163.224.122
mailin-04.mx.aol.com.    A  64.12.136.153
mailin-01.mx.aol.com.    A  205.188.156.122
mailin-01.mx.aol.com.    A  64.12.136.57
mailin-01.mx.aol.com.    A  64.12.137.89
mailin-01.mx.aol.com.    A  64.12.137.184
mailin-01.mx.aol.com.    A  152.163.224.26
mailin-02.mx.aol.com.    A  64.12.136.89
mailin-02.mx.aol.com.    A  64.12.136.121
mailin-02.mx.aol.com.    A  64.12.137.89
mailin-02.mx.aol.com.    A  64.12.137.184
mailin-02.mx.aol.com.    A  205.188.156.154
mailin-03.mx.aol.com.    A  64.12.136.249
mailin-03.mx.aol.com.    A  64.12.137.121
mailin-03.mx.aol.com.    A  64.12.137.152
mailin-03.mx.aol.com.    A  205.188.158.25
mailin-03.mx.aol.com.    A  64.12.136.217


In this situation, Exim ends up with 19 possible IP addresses to try.
Since they all have the same MX preference, they will be sorted into a
random order. The idea of hosts_max_try was that if sufficient of them
are unreachable, it isn't worth trying any more. (Remember that SMTP
timeouts are typically 5 minutes.)

However, the current implementation of just counting IP addresses and
then giving up after so many doesn't work well in cases where different
MX preferences are used. Consider:

yahoo.com.               MX  1 mx2.mail.yahoo.com.
yahoo.com.               MX  5 mx4.mail.yahoo.com.
yahoo.com.               MX  1 mx1.mail.yahoo.com.
mx2.mail.yahoo.com.      A  64.157.4.88
mx2.mail.yahoo.com.      A  64.157.4.82
mx4.mail.yahoo.com.      A  216.136.129.11
mx4.mail.yahoo.com.      A  216.136.129.14
mx4.mail.yahoo.com.      A  216.136.129.16
mx4.mail.yahoo.com.      A  216.136.129.17
mx4.mail.yahoo.com.      A  216.136.129.4
mx1.mail.yahoo.com.      A  64.157.4.85
mx1.mail.yahoo.com.      A  64.157.4.89
mx1.mail.yahoo.com.      A  64.157.4.81


There are 5 addresses at the MX=1 preference level, so those are the
only ones that will ever be tried if hosts_max_try=5. This seems wrong.

What do do about this? I have had several ideas:

1. Very simple. Make hosts_max_try apply *per MX value*. So it would try
up to 5 at MX=1 and up to 5 at MX=5 in the yahoo case, with no change in
the aol case.

2. Distribute the count among the MX values. Again no change in the aol
case, but in the yahoo case, try 3 at MX=1 and 2 at MX=5.

3. Pay attention to the different host names. There are 4 names for aol,
and 3 for yahoo. Ensure that (as long as there are not more names than
hosts_max_try) each name within the same MX level is tried before trying
another address for the same name. This would affect aol and not yahoo
because all 5 MX=1 addresses would be tried, just in a different order.

4. Something else more complicated with names that would also affect the
yahoo case.

Personally, I'm leaning towards (1) because it is simple. All the others
would be tricky to implement and explain.

Comments?

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