Hello,
I'm new to this mail list so please excuse me if I break traditions.
I have mail server running Sun Solaris 10 with postfix-2.4.6 mta in one
zone and amavisd-new-2.5.2 in another one. They are communicating via
TCP. amavisd-new processes ~15000 messages a day.
I'm running this setup for some time and it seems quiet stable. However,
strange error periodically occurs. When mta is done submitting message
to amavisd and says "QUIT" sometimes it responds with error message "Bad
SMTP code".
I've traced down this problem and found that error occurs in rw_loop
function. Here is excerpt from amavisd log (log level 5):
<---snip--->
smtp cmd> DATA
rw_loop: needline=0, flush=1, wr=1, timeout=120
rw_loop: sending
rw_loop send 126> MAIL FROM:<[EMAIL PROTECTED]>
BODY=7BIT\r\nRCPT TO:<[EMAIL PROTECTED]>
ORCPT=rfc822;[EMAIL PROTECTED]
rw_loop: needline=1, flush=0, wr=0, timeout=293
rw_loop: receiving
rw_loop read 65 chars< 250 2.1.0 Ok\r\n250 2.1.5 Ok\r\n354 End data with
<CR><LF>.<CR><LF>\r
smtp resp to MAIL (pip): 250 2.1.0 Ok
smtp resp to RCPT (pip) (<[EMAIL PROTECTED]>): 250 2.1.5 Ok, id=11908-07,
from MTA([10.240.240.20]:10025): 250 2.1.5 Ok
smtp resp to DATA: 354 End data with <CR><LF>.<CR><LF>
write_header: 0, Amavis::Out::SMTP::Protocol=HASH(0xb167434)
smtp cmd> QUIT
rw_loop: needline=0, flush=1, wr=1, timeout=293
rw_loop: sending
rw_loop send 6829> X-Virus-Scanned: ClamAV at
mailscan.mikrovisata.net\r\nX-Spam-Flag: NO\r\nX-Spam-Score:
1.723\r\nX-Spam-Level: *\r\nX-Spam-Status: No, score=1.723 required=6.31
tests=[AWL=-0.097,\r\n\tHTML_MESSAGE=0.001, MIME_Q [...]
rw_loop: needline=1, flush=0, wr=0, timeout=293
rw_loop: receiving
(!)rw_loop read failed: Resource temporarily unavailable
smtp resp to data-dot (<[EMAIL PROTECTED]>):
Negative SMTP resp. to data-dot (<[EMAIL PROTECTED]>):
rw_loop: needline=1, flush=0, wr=0, timeout=10
rw_loop: receiving
rw_loop read 52 chars< 250 2.0.0 Ok: queued as 1D46E149F1B\r\n221 2.0.0
Bye\r
smtp resp to QUIT: 250 2.0.0 Ok: queued as 1D46E149F1B
<---snip--->
The side effect of this problem is that user gets 2 messages instead of
one. This occurs because amavisd returns error to MTA but still checks
message and submits it back (this message is delivered). MTA got error
code, so it holds the message for 5 mins and after that _re-submits_ it
to amavisd. Then it is checked and delivered one more time.
Here is code excerpt where problem occurs:
<---snip--->
if (vec($rout,$fd_sock,1)) {
do_log(5,"rw_loop: receiving");
my($inbuf) = ''; $! = 0;
# my($paddr) = recv($sock,$inbuf,32768,0);
my($nread) = sysread($sock,$inbuf,32768);
if (!defined($nread)) {
do_log(-1,"rw_loop read failed: %s", $!);
$!==0 || $!==EAGAIN || $!==EINTR
or die "Error receiving from socket: $!";
} elsif ($nread < 1) { # sysread returns 0 at eof
$self->{inpeof} = 1; do_log(3,"rw_loop read: got eof");
} else {
$self->{inpeof} = 0;
ll(5) && do_log(5,"rw_loop read %d chars< %s", length($inbuf),$inbuf);
$self->{inp} .= $inbuf; $idle_cnt = 0;
length $self->{inp} < 500000
or die "rw_loop: Aborting on a runaway server";
}
}
<---snip--->
sysread($sock,$inbuf,32768) returns undef sometimes, and I don't know
why. here is also commended function recv($sock,$inbuf,32768,0). may be
it is a clue?
Please help me with this.
Because of strict regulations I've received together with subscription
confirmation, I put log files and confs into WWW.
log where amavisd is behaving good:
http://x.mikrovisata.net/amavis_problem/amavisd_good.txt
log where amavisd is behaving bad:
http://x.mikrovisata.net/amavis_problem/amavisd_bad.txt
amavisd-new startup log:
http://x.mikrovisata.net/amavis_problem/amavisd_startup.txt
amavisd-new configuration file:
http://x.mikrovisata.net/amavis_problem/amavisd.conf
perl version output:
http://x.mikrovisata.net/amavis_problem/perl_version.txt
postfix's master.cf:
http://x.mikrovisata.net/amavis_problem/master.cf
pastfix's main.cf:
http://x.mikrovisata.net/amavis_problem/main.cf
Best regards,
Aleksandr
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
AMaViS-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/