Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problems with $forward_method and list of peer socket specifications

14 views
Skip to first unread message

Michael Storz

unread,
Apr 12, 2012, 11:44:30 AM4/12/12
to
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 <confe...@mail.elsevier-alerts.com> ->
<felix.s...@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

Mark Martinec

unread,
Apr 13, 2012, 2:50:48 PM4/13/12
to
Michael,

> 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.

A bug indeed. What was I thinking?!
Will be fixed in 2.7.1 and 2.8.0.
Will prepare a bug fix, haven't done so yet.

> 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.

Makes sense, will do something about it.

Thanks a lot!

Mark

0 new messages