Urgent: MailScanner apparently stopped processing...

Julian Field mailscanner at ecs.soton.ac.uk
Fri May 9 21:54:12 IST 2003

I agree it would stay in the queue and, due to the sorting, would always 
appear as the first message in the batch. But why would it jam anything?
It would get found and logged at the start of each batch, but any other 
messages that later appeared would still be added to the batch.
So it would cause a log warning at the start of each batch, but what harm 
would it do otherwise?
I could add it to a hash of known bad messages if you like, so that it 
ignored that message id in subsequent queue scans. But I don't see how the 
current system actually breaks.

At 20:05 09/05/2003, you wrote:
>Leo Helman (the guy who actually wrote most of ZMailer support) spotted this
>one a few days ago and I thought it was just unelegant, but it might indeed
>be a bug... if it is so, it affects _all_ versions (sendmail, exim, zmailer &
>postfix)... maybe it showed up because of some problem in the postfix queue
>file parser, but it is there anyway.
>Leo says that within MailScanner::Sendmail::CreateBatch() you have the
>following code excerpt:
>       $batchempty = 1;
>       while(($file = shift @SortedFiles) &&
>             $HitLimit1+$HitLimit2+$HitLimit3+$HitLimit4<1) {
>         .... .... ....
>         .... .... ....
>         $newmessage = MailScanner::Message->new($id, $queuedirname);
>         next unless $newmessage;
>         .... .... ....
>         .... .... ....
>       }
>       # Wait a bit until I check the queue again
>       sleep(MailScanner::Config::Value('queuescaninterval')) if $batchempty;
>     } while $batchempty; # Keep trying until we get something
>now, newmessage is false when a lock fails or when there was an error parsing
>the envelope (e.g. missing envelope from, to or origin).
>If the lock failed, that is because another MailScanner locked it and the
>next round of the loop or so, the file will probably be not there, 'cause the
>other MailScanner that had it locked, processed it and removed it from the
>But, if the envelope was corrupt, the file stays in the queue forever, and as
>$batchempty is not modified, it never quits the loop (the $HitLimitX stay
>always 0).
>At first I thought that the only problem would be that the queue file would
>stay there forever (or until an operator read the log message produced within
>MailScanner::Sendmail::ReadQf() (smtp MailScanner[xxxx]: Batch: Found invalid
>queue file for message xxxxxx) and would manually remove it from the queue...
>In fact, I dismissed a message I was writing to you about this when I thought
>that... now that Leo read this thread and recalls our dialog back then, I re-
>read it and notice that, as we always sort the queue files by age, this
>corrupt file will _always_ be the first to be processed and, hence, would
>stuck the queue...
>I think we should differntiate the way ReadQf() fails if the queue file is
>locked or if it is ill-formed... or change the while() condition...
>El 9 May 2003 a las 8:46, Julian Field escribió:
> > At 19:25 08/05/2003, you wrote:
> > >I'm hoping someone can shed some light on this one - recently I had
> > >MailScanner which I've implemented on RedHat 8 w/Postfix just yesterday,
> > >abruptly stop processing mail.
> > >
> > >I only happened to notice as the only indication was that no mail was
> > >passing through to my internal mail/pop servers, etc.
> > >
> > >When I checked the maillog I found only entries from the postfix demon
> > >that receives incoming mail, nothing from MailScanner or the postfix demon
> > >that then delivers what MailScanner gives it. All processes including the
> > >MailScanner processes were running - in fact, MailScanner was using a
> > >majority of cpu time. I tried manually starting up MailScanner and found
> > >that this fact of "MailScanner starting" and "xxx messages found to be
> > >scanned" did show up in the maillog, however, no other change, mail did
> > >not start to flow.
> > >
> > >I finally restarted the server and then everything started to move.
> >
> > But was it scanning after you restarted?
> >
> > Have you use redhat-switchmail-nox to set which email system RedHat thinks
> > it is trying to run?
> >
> > >So, based on this I have a few questions:
> > >
> > >1. Any ideas why this happened and how can I prevent it and also does
> > >anyone have any scripts out there that detect this kindof thing and then
> > >cleanly shut down mailscanner and restart it?
> > >
> > >2. I realized I don't even know how to cleanly shut down MailScanner
> > >manually. This may seem a stupid question but if someone could answer it
> > >that would be great.
> >
> > service MailScanner stop
> >
> > You can do "service MailScanner" to get a list of the command options you
> > can give it.
> > Does "service MailScanner start" work cleanly, or does it output any 
> errors?
> >
> > >4. I have an error message repeatedly showing up in the maillog that I
> > >have been unable to discover the cause of. It is:
> > >smtp MailScanner[xxxx]: Batch: Found invalid queue file for message xxxxxx
> >
> > For some reason it thinks one of your incoming queue files is corrupt. It
> > needs to be able to find the sender and recipient addresses, and the last
> > hop IP address, in the file it lifts from the queue.
> >
> > Can you send me one of the files from /var/spool/postfix.in/deferred that
> > exhibits this problem.
> > Then I can improve the Postfix parser to stop it happening again.
> > --
> > Julian Field
> > www.MailScanner.info
> > MailScanner thanks transtec Computers for their support
>Mariano Absatz
>El Baby
>I am not afraid of death, I just don't want to
>be there when it happens.
>         -- Woody Allen

Julian Field
Professional Support Services at www.MailScanner.biz
MailScanner thanks transtec Computers for their support

More information about the MailScanner mailing list