[comp.mail.sendmail] sendmail queue run interferes with active transactions

e07@nikhefh.hep.nl (Eric Wassenaar) (11/23/88)

A sendmail queue run may destructively interfere with other active
sendmail transactions. As a result, mail may be lost, left-over queue
files may remain in the mqueue directory, and various error messages
may appear in the syslog file.

Analysis:
The routine runqueue() in queue.c scans the queue, calling dowork()
for each individual entry. If an entry is found busy, dowork() will
syslog such entry as "AAxxxxx: locked", and return immediately.
After the queue scan, runqueue() calls finis() to terminate.
However, if the last queue entry examined by dowork() was locked,
'CurEnv->e_id' still contains the id of this entry, and dropenvelope()
which is called by finis() will inappropriately perform cleanup action
for this queue entry, possibly unlinking associated queue files.

Remedy:
Either make CurEnv->e_id = NULL again in dowork() when returning after
signaling a locked entry, or put CurEnv->e_id = NULL in runqueue()
just before calling finis(). Now dropenvelope() will exit immediately.
Note that in case dowork() could process a non-active entry, it will
internally call dropenvelope() for this entry.

Eric Wassenaar
-- 
Organization: NIKHEF-H, National Institute for Nuclear and High-Energy Physics
Address: Kruislaan 409, P.O. Box 41882, 1009 DB Amsterdam, the Netherlands
Phone: +31 20 5920412   Home phone: +31 20 909449    Telex: 10262 (hef nl)
Internet: e07@nikhefh.hep.nl  Bitnet: nikhefh!e07@mcvax.bitnet

Lennart_Lovstrand.EuroPARC@Xerox.COM (11/26/88)

In article <580@nikhefh.hep.nl> e07@nikhefh.hep.nl (Eric Wassenaar) writes:
> A sendmail queue run may destructively interfere with other active
> sendmail transactions. As a result, mail may be lost, left-over queue
> files may remain in the mqueue directory, and various error messages
> may appear in the syslog file.
> 
> Analysis:
> The routine runqueue() in queue.c scans the queue, calling dowork()
> for each individual entry. If an entry is found busy, dowork() will
> syslog such entry as "AAxxxxx: locked", and return immediately.
> [...]

Hmm, nice work and a very well specified problem description, but what
version of sendmail are you using?  I believe this bug was fixed
somewhere between 5.51 and 5.59.

(BTW, the same fix as you propose used to be part of the IDA Kit and
is described in section 7.14 of the doc.  The current version of
queue.c just calls exit instead of finis and therefore shouldn't need
any patching.)

--Lennart <Lovstrand.EuroPARC@Xerox.COM>
Rank Xerox EuroPARC, 61 Regent St, Cambridge, England