Handle Deep Queues
To understand the potential problems with deep queues, first consider
how sendmail processes a single queue when its
QueueSortOrder
option (QueueSortOrder) is set to the default of
priority
.[2] When
sendmail is instructed to process a queue it
opens the queue directory for reading and reads that directory to
gather a list of qf files to process. Each
qf file sendmail finds is
opened for reading and scanned for important pieces of information.
The N
line in each qf file,
for example, holds the number of times the message has been tried.
The P
line holds each message’s
current priority.
After all messages have been opened, read, and closed, and after the information from each has been saved internally, sendmail sorts that information. The purpose of the sort is to ensure that new mail is tried before old, and that high-priority mail is tried before low-priority mail.
Under normal circumstances this process occurs quickly. But when queues get abnormally deep, things can go wrong in unusual ways. In the following, we show one way that sendmail could be run on a major mail-sending machine:
/usr/sbin/sendmail -bd /usr/sbin/sendmail -q10m
The idea here is to create two mail-handling daemons. The first handles inbound mail and, because this is a mail-sending machine, we expect that this inbound daemon will perform little work. The second daemon sends all mail it finds in its queue. It will fork(2) a copy of itself once every 10 minutes, and that copy will process all the ...
Get Sendmail, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.