Problems with $forward_method and list of peer socket specifications

Michael Storz Michael.Storz at lrz.de
Thu Apr 12 17:44:30 CEST 2012


Hi Mark,



I have some problems with $forward_method and list of peer socket 
specifications:


1) The randomization of the destinations does not work correctly. If 
you have 2 values in the list, always the first one is used. The 
correction for this error is, changing

       my($j) = int(rand($n_candidates-1));

to

       my($j) = int(rand($n_candidates));

because rand(X) is always less than X.

2) There is a case where the amavisd process hangs, when the 
destination MTA is gone away:

Apr 12 15:44:53 lxmhs36a amavis[32200]: (32200-01-5) about to connect 
to (smtp:mailrelay2.mail.lrz.de:625, smtp:mailrelay1.mail.lrz.de:625), 
FWD from <conferences at mail.elsevier-alerts.com> -> 
<felix.sedlmeyer at wzw.tum.de>
Apr 12 15:44:53 lxmhs36a amavis[32200]: (32200-01-5) get_deadline 
fwd_init - deadline in 1198.5 s, set to 1199.000 s
Apr 12 15:44:53 lxmhs36a amavis[32200]: (32200-01-5) smtp session reuse 
(smtp:[mailrelay1.mail.lrz.de]:625), 4 transactions so far
Apr 12 15:44:53 lxmhs36a amavis[32200]: (32200-01-5) 
establish_or_refresh, state: quitsent
Apr 12 15:44:53 lxmhs36a amavis[32200]: (32200-01-5) rw_loop: 
needline=0, flush=1, wr=1, timeout=1
Apr 12 15:44:53 lxmhs36a amavis[32200]: (32200-01-5) rw_loop: receiving
Apr 12 15:44:53 lxmhs36a amavis[32200]: (32200-01-5) rw_loop read: got 
eof
Apr 12 15:44:53 lxmhs36a amavis[32200]: (32200-01-5) rw_loop: sending
Apr 12 15:44:53 lxmhs36a amavis[32200]: (32200-01-5) mail_via_smtp: 
session failed: Error writing to socket: Broken pipe at 
/usr/local/sbin/amavisd line 6884.
...
Apr 12 15:44:54 lxmhs36a amavis[32200]: (32200-01-6) smtp session reuse 
(smtp:[mailrelay1.mail.lrz.de]:625), 4 transactions so far
Apr 12 15:44:54 lxmhs36a amavis[32200]: (32200-01-6) 
establish_or_refresh, state: quitsent
Apr 12 15:44:54 lxmhs36a amavis[32200]: (32200-01-6) rw_loop: 
needline=0, flush=1, wr=1, timeout=1
Apr 12 15:44:54 lxmhs36a amavis[32200]: (32200-01-6) rw_loop: receiving
Apr 12 15:44:54 lxmhs36a amavis[32200]: (32200-01-6) rw_loop read: got 
eof
Apr 12 15:44:54 lxmhs36a amavis[32200]: (32200-01-6) rw_loop: sending
Apr 12 15:44:54 lxmhs36a amavis[32200]: (32200-01-6) mail_via_smtp: 
session failed: Error writing to socket: Broken pipe at 
/usr/local/sbin/amavisd line 6884.

and so on till the process is killed.

Call chain:

establish_or_refresh -> $smtp_handle->close -> $self->flush -> 
$self->rw_loop(0,1) -> die "Error writing to socket ..."

If the '$self->flush' is evaled, the error disappears, but I do not 
know if this is the correct solution.

3) If a crashed MTA comes back, it takes too long, if it is used again, 
if there is a high load. I think the reason is, that a cached connection 
is used indefinitely, if it is not idle or the process ends its life. It 
would be nice if we could limit the lifetime of such a connection, for 
example if we could specify a maximal lifetime and/or the maximal number 
of transactions.

Best regards,
Michael



More information about the amavis-users mailing list