All,
We are losing email messages.
We have a perl program that sends messages via smtp and then pops the
messages to ensure throughput performance and functionality. This is
working well, but.... we are not receiving all of the messages we are
sending.
A review of the logs show a consistent/coinicident error message from the
qmail-scanner-queue.pl script.
"Unable to reopen fd 0. (#4.3.0) - ..." from the qmail_requeue function.
(see below)
The message time stamps, etc match up with the logged sent time.
The qmail_requeue function is called from within the eval block (intention
of the eval is to catch time-outs)
The qmail_requeue function the forks and the parent/child clean up their
respective file handles for the Pipe that exists between them.
The child fails the open, and calls the tempfail which eventually exits with
an error code 111.
The parent should catch this error code and also call tempfail with a
different error message (which is never observed).
Questions:
Does anybody else have this error condition?
An eval can not trap an exit, is the exit the intended action to take?
We never get the "Unable to queue message ($status). (#4.3.0) - ..." error
message, should we?
I would think that the parent should have the child return status IF the
waitpid completed successfully.
Comments, ideas, wild @ss guesses welcome.
Thanks
Mark.
Un-modified code snippets below....
#!/usr/bin/perl
#
# File: qmail-scanner-queue.pl
# Version: 1.12
#
# Author: Jason L. Haar <[EMAIL PROTECTED]>
#
# This file was auto-generated by:
#
# ./configure --spooldir /var/spool/qmailscan --qmaildir /ISP/qmail --bindir
/ISP/qmail/bin --qmail-queue-binary /
var/qmail/bin/qmail-queue --admin ispadmin --domain ***.net --notify
sender,admin,recips --local-domains ***.net,***.com,***.com,***.com --lang
en_GB --debug 1 --unzip 1 --add-dscr-hdrs 0 --archive 0 --re
dundant 0 --log-details 0 --fix-mime 1 --scanners "auto"
...
eval {
$SIG{ALRM} = sub { die "Maximum time exceeded. Something cannot handle
this message." };
alarm $MAXTIME;
...
if ($quarantine_event) {
&debug("unsetting TCPREMOTEIP env var");
delete $ENV{'TCPREMOTEIP'};
&email_quarantine_report;
} else {
&qmail_parent_check;
&qmail_requeue($env_returnpath,$env_recips,"$scandir/$wmaildir/new/$file_id"
);
}
alarm 0;
};
$alarm_status=$@;
if ($alarm_status and $alarm_status ne "" ) {
if ($alarm_status eq "Maximum time exceeded. Something cannot handle this
message.") {
&tempfail("ALARM: taking longer than $MAXTIME secs. Requeuing...");
} else {
&tempfail("Requeuing: $alarm_status");
}
}
...
sub qmail_requeue {
my($sender,$env_recips,$msg)=@_;
my ($temp,$findate);
...
local $SIG{PIPE} = 'IGNORE';
my $pid = fork;
if (not defined $pid) {
&tempfail ("Unable to fork. (#4.3.0) - $!");
} elsif ($pid == 0) {
# In child. Mutilate our file handles.
close EIN;
open(STDIN,"<$msg")|| &tempfail ("Unable to reopen fd 0. (#4.3.0) -
$!");
...
} else {
# In parent.
close EOUT;
# Feed the envelope addresses to qmail-queue.
print EIN "$sender\0$env_recips";
close EIN || &tempfail ("Write error to envelope pipe. (#4.3.0) - $!");
}
# We should now have queued the message. Let's find out the exit status
# of qmail-queue.
waitpid ($pid, 0);
my $status =($? >> 8);
if ($status != 0) { &tempfail ("Unable to queue message ($status).
(#4.3.0) - $!" )}
}
sub tempfail {
syslog('mail|info',"$V_HEADER-$VERSION:[$file_id] @_");
if ($log_details ne "syslog") {
warn "$V_HEADER-$VERSION:[$file_id] ",@_, "\n";
}
$nowtime = sprintf "%02d/%02d/%02d %02d:%02d:%02d", $mday, $mon+1,
$year+1900, $hour, $min, $sec;
&debug("tempfail: $V_HEADER-$VERSION: ",@_);
close(LOG);
&cleanup;
exit 111;
}
-------------------------------------------------------
This sf.net email is sponsored by: Jabber - The world's fastest growing
real-time communications platform! Don't just IM. Build it in!
http://www.jabber.com/osdn/xim
_______________________________________________
Qmail-scanner-general mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/qmail-scanner-general