[comp.mail.misc] Sendmail loses mail ?

pdb@sei.cmu.edu (Patrick Barron) (05/19/87)

Keywords:



Here's a rather interesting phenomenon I've noticed with Sendmail 5.54.  Every
once in a while, for no readily apparent reason, it will drop a mail message
without warning.  The symptom is that the 'qf' file in the queue directory
mysteriously vanishes.  The 'df' file stays.  The message in question could
be either one being delivered to a user on my machine, or one being sent from
it.

If I look in syslog, I see that the message gets queued up just like it
should (the [IPC] mailer is marked as "expensive"), but it is never logged
as "stat=Sent".  Sometimes it'll be a message on which several failed
delivery attempts have already been logged; all the sudden, the qf file
goes away, and delivery attempts stop.

The following items are also worthy of note:
1)  On my system, it is possible (even probable) for two, or even three,
    queue runs to be going on at the same time.
2)  Sendmail 5.54 will unlink a 'qf' file of zero length and exit without
    logging anything.

I'd suspected that perhaps the lock file was being unlinked while the qf
was still open for writing (i.e., hadn't been fflushed, and therefore would
be of zero length), but I can't find anyplace in the code where this might
occur.

This has been driving my crazy for weeks now!  I've seen it happen on each
of half a dozen or so machines that I'm running 5.54 on.  Has anyone else
seen this before?  Anyone have a fix?

--Pat.

matt@oddjob.UChicago.EDU (I am not a Grook) (05/19/87)

In article <1359@aw.sei.cmu.edu> pdb@sei.cmu.edu (Pat Barron) writes:
) 
) The symptom is that the 'qf' file in the queue directory
) mysteriously vanishes.  The 'df' file stays.  ...
) Has anyone else seen this before?  Anyone have a fix?

It happens here too.  No ideas.

lel@ida.liu.se (Lennart Lovstrand) (05/25/87)

In article <1359@aw.sei.cmu.edu> pdb@sei.cmu.edu (Pat Barron) writes:
>Here's a rather interesting phenomenon I've noticed with Sendmail 5.54.  Every
>once in a while, for no readily apparent reason, it will drop a mail message
>without warning.  The symptom is that the 'qf' file in the queue directory
>mysteriously vanishes.  The 'df' file stays.  The message in question could
>be either one being delivered to a user on my machine, or one being sent from
>it.

There is a bug at least with the 5.51 release of sendmail which causes
the queue deamon to sometimes misbehave with locked entries.  It seems
to happen whenever the queue daemon ends up processing a locked entry as
its last for the run.

At first, the queue deamon leaves the files alone when it discoveres
that the lock file exists, but then it exists and while doing general
cleanup in finis/dropenvelope, it removes some [all?] of its current
envelope's queue files.  Especially if there is a another concurrently
running sendmail, the net result will only be a df file with the message
contents but no recipient/sender information.

The fix is to explicitly set the current envelope's id to NULL before
leaving the current queue pass, since it should not exist anyway.  The
following extremely small context-diff should cure the problem:

*** queue.c.orig	Fri Mar 13 18:51:03 1987
--- queue.c	Fri Apr 17 22:43:30 1987
***************
*** 352,357 ****
--- 353,362 ----
  		free(w->w_name);
  		free((char *) w);
  	}
+ 	/*
+ 	 *	Don't let dropenvelope() trash locked queue files!
+ 	 */
+ 	CurEnv->e_id = NULL;
  	finis();
  }
  /*

This about 0.3% of The IDA Sendmail Enhancement Kit, *now* ready for
distribution!  Read more about it in an accompanying article!

Cheers,
--Lennart
--
Dept of Computer and Information Science, University of Linkoping, Sweden
Internet: Lennart.Lovstrand@IDA.LiU.SE       EAN/X.400: lel@ida.liu.sunet
UUCP: {mcvax,munnari,seismo}!enea!liuida!lel    EARN/BITNET: LEL@SELIUI51