MySQL Connection Problems

Michael Jeung mjeung at
Thu Feb 9 14:40:25 PST 2006

Hello all,

I'm running into a intermittent and very annoying problem with all of  
my servers. I'm currently running FreeBSD 4.11, exim-4.51-0, and  
mySQL 4.1.13. My exim config is setup to have exim do a mySQL lookup  
in order to determine whether a given user's e-mail is hosted by our  
e-mail servers.

Periodically, Exim throws the following error into its panic log:
Feb 9 13:24:51 mx_server_1 exim[69953]: 2006-02-09 13:24:51 failed to  
expand "${lookup mysql {select distinct domain from email_table where  
domain='$domain'}{$value}}" while checking a list: lookup of "select  
distinct domain from email_table where domain=''" gave DEFER:  
MYSQL connection failed: Can't connect to MySQL server on  
'' (61)
(where is one of our customer's domains that we host.)

This has been happening for months, and I'm trying to get rid of  
these errors. The come in bursts - in a single second, I could get as  
many as 30 to 40 of these messages.

Now, I've taken a few different steps to track this down, but the  
problem is very elusive and hard to replicate. The mySQL error logs  
are unhelpful. I'm sure that my mySQL server isn't running out of  
connections, because if it was, I would receive a "too many  
connection" error message. (I deliberately lowered the max number of  
mySQL connections to test this.)

I'm wondering if there's a system level limit that I'm running into  
that would be independant of exim or mySQL's configuration. I'm a  
little hazy in this area, but I would be talking about some sysctl  
variable, a ulimit on open sockets, or something to that effect.

I'm rather stumped on this issue, so if anyone has any suggestions or  
hints on what might be causing this error or where I might start  
looking to find the root cause of the problem, I would be very grateful.

Michael Jeung

More information about the freebsd-questions mailing list