exim 4.14
I only took the relevent bits from exim -d on this:
3935 MYSQL new connection: host=cd port=3306 socket=NULL database=NULL user=exim
3935 MYSQL using cached connection for cd:3306//exim
3935 MYSQL using cached connection for cd:3306//exim
3935 MYSQL using cached connection for cd:3306//exim
3935 MYSQL using cached connection for cd:3306//exim
3935 MYSQL: no data found
3935 MYSQL using cached connection for cd:3306//exim
3935 MYSQL: no data found
3935 MYSQL using cached connection for cd:3306//exim
3935 MYSQL: no data found
3935 MYSQL using cached connection for cd:3306//exim
3935 MYSQL using cached connection for cd:3306//exim
3935 MYSQL using cached connection for cd:3306//exim
3935 MYSQL using cached connection for cd:3306//exim
3935 MYSQL using cached connection for cd:3306//exim
3935 close MYSQL connection: cd:3306//exim
3935 MYSQL new connection: host=cd port=3306 socket=NULL database=NULL user=exim
3935 MYSQL connection failed: Unknown MySQL Server Host 'cd' (4)
3935 lookup deferred: MYSQL connection failed: Unknown MySQL Server Host 'cd' (4)
If you notice, it connects to the server correctly the first time. However,
the 2nd time, it doesn't.
the host "cd" is a valid name. In the dns it's a cname to coredump.
# host -a cd
cd.electro-mechanical.com CNAME coredump.electro-mechanical.com
coredump.electro-mechanical.com A 168.10.1.89
#
I have:
mysql_servers = cd::3306//exim/xxxxxxxxxxxxxxxxxxxxxxx
I had:
mysql_servers = cd//exim/xxxxxxxxxxxxxxxxxxxxxxx
because the 2nd connect that was attempted looked like this:
MYSQL new connection: host=cd port=0 socket=NULL database=NULL user=exim
I did:
mysql_servers = coredump//exim/xxxxxxxxxxxxxxxxxxxxxxx
which works.
On each SMTP connection, the first MySQL connection works, but subsequent
ones didn't.
After digging a little further, /etc/hosts contains:
168.10.1.89 coredump.electro-mechanical.com coredump
If I comment out that line, mysql_servers = coredump//exim/xxxxxxxxxxxxx
no longer works, it exibits the same problem.
It appears that on 2nd connections, exim or the mysql lookup is not using
the DNS to get the IP address.