[Mimedefang] MySQL Greylisting - server has gone away

Paul Murphy pjm at ousekjarr.org
Mon Mar 20 08:23:41 EST 2006

> Your software will probably become a lot more robust if you solve
> this problem in MIMEDefang, by testing the database handle before
> using it.

The problem with this approach is that the test has to identify that the
handle is stale, close it, and then re-open it again - and all outside of
"filter_initialise", which is where this sort of thing really has to be.

> If you're using "connect_cached" in your filter, that might be all
> you need, since that automatically tests the database handle to see if
> it is valid.

I am indeed using "connect_cached", but when the handle has timed out, and
the DBI still has it open, the slave dies as described.

My code contains:

$greylist_dbh =
        { RaiseError => 1, AutoCommit => 0 })
        or die $DBI::errstr;    

I've also now realised that this isn't helping, as "RaiseError" effectively
causes a die() if anything goes wrong. This should almost certainly be
changed, and then each use of the handle should check the return code.

Best Wishes,


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.2.5/284 - Release Date: 17/03/2006

More information about the MIMEDefang mailing list