amavis doesn't notice SQL server down

Jernej Porenta via amavis-users amavis-users at amavis.org
Wed May 7 21:29:32 CEST 2014


On 07/05/14 18:12, Patrick Ben Koetter via amavis-users wrote:
> * Mark Martinec via amavis-users <Mark.Martinec+amavis at ijs.si>:
>> Patrick,
>>
>>> I don't recall if this has been addressed before.
>>> When an LDAP or SQL server goes away while amavis is running
>>> amavis doesn't
>>> seem to note the LDAP or SQL server has come back until you
>>> restart/reload
>>> amavis. Instead it keeps rejecting (TMPFAIL) messages.
>>>
>>> It would be great if a fix for that made it into 2.9.

Are you sure that this is really happening in recent amavis releases?

I remember having some issues with failing MySQL servers a year or more 
ago (timeouts due dropping long living idling TCP connections over FW) 
and I remember Mark did some code improvements to handle MySQL 
connection timeouts. Since our setup was completely redesigned, I cannot 
test it again :(

I did a short grep on amavisd and there are some snippets about that:
# grep -n 'Server has gone away; Lost connection to' amavisd
24421:    } else {  # Server has gone away; Lost connection to...
# grep -n 'reconnect' amavisd
18904:      $self->ldap or die "do_search: reconnect failed";
21582:    # whether the session is still alive - reconnecting at this 
time is cheap;
23460:      # eof, try reconnecting
24315:  # In other words, you should disconnect and reconnect again
24325:             "probably disconnected by server, reconnecting (%s)", 
$eval_stat);
24359:    do_log(-1,"sql rollback error, reconnecting (%s)", $eval_stat);
24429:        do_log(0,"NOTICE: reconnecting in response to: %s", $msg);
24434:        $self->dbh or die "sql execute: reconnect failed";
24437:        $sth or die "sql: prepare (reconnected) failed: 
".$DBI::errstr;
24486:# $dbh->{mysql_auto_reconnect} = 1;  # questionable benefit

cheers, Jernej





More information about the amavis-users mailing list