Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a problem with the sendmail DNS timeout period when trying to sent to a email address which has a DNS issue.

Let's say the problematic email address is test@problemdomain.com (not real one)

I can see there is a DNS issue with this domain using:

>host -t mx problemdomain.com
;; connection timed out; no servers could be reached

I can test and time the sendmail call to the problematic email address using:

> time echo "This is a test message" | /usr/lib/sendmail -ftest@test.com test@problemdomain.com
real    2m36.252s
user    0m0.004s
sys 0m0.005s

Currently, it takes 2m36s for sendmail to timeout! This causes our PHP webpages that try to send to this email address to hang and eventually return an error to the browser.

My question is... How do I reduce this timeout?

I have seen a few sendmail related timeout configurations:

> grep resolver /etc/mail/sendmail.cf
Timeout.resolver.retrans=5s
Timeout.resolver.retry=4

Sendmail seems to be set to retry 4 times, with a 5s delay each re-transmission.

But I haven't found the actual DNS timeout period?

For reference: This is occurring on Red Hat Enterprise Linux Server release 5.2, sendmail 8.13.8, Linux Kernel: 2.6.18, Apache version: 2.2.3, PHP version: 5.3.0. Note: This question is a follow up from http://serverfault.com/questions/92545/sendmail-delays-on-some-email-addresses

share|improve this question

1 Answer 1

up vote 1 down vote accepted

As a quick work-around you can fiddle with your /etc/resolv.conf. Of course this changes how the system resolver works, this is not at all sendmail-specific issue.

timeout: n
    sets the amount of time the resolver will wait for a response from a remote name server before retrying the query via a different name server. Measured in seconds, the default is RES_TIMEOUT (see <resolv.h> ). 
attempts: n
    sets the number of times the resolver will send a query to its name servers before giving up and returning an error to the calling application. The default is RES_DFLRETRY (see <resolv.h> ).

In the long run, the above is not so good solution. Your DNS server setup is broken and it needs to be fixed. If there is a query about non-existing MX/domain the server should QUICKLY respond with NXDOMAIN. It should not wait such long time, as it generally causes all sorts of problems with many programs (sendmail for starters, but typically also sshd and NFS).

share|improve this answer
2  
To test if its your dns setup thats broken try: host -t mx problemdomain.com 8.8.8.8 This tries to resolv with googleDNS (8.8.8.8) –  artifex Dec 9 '09 at 20:10
    
Thank you - you were correct - It seems the DNS server setup was temporarily broken. Our hosting company (Peer1) seemed to get around to fixing the issue before I diagnosed what the fault was. No Sendmail config changes were necessary. –  Tom Dec 10 '09 at 8:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.