summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2008-12-11 22:32:28 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2008-12-11 22:32:28 +0000
commit78375ea7e653be152c45e363149789cb8602fa54 (patch)
tree23979eeeebbed1e203612df86176aec5e7dc99ba /usr.sbin
parent16540b3de5bde08375c98a9b9a2721b33ec8e998 (diff)
- fix a bug that would cause the runner to hit a fatal() when running out
of luck under load. Long story made short: the runner process opens the queue and sequentially opens each bucket to process messages. If a message is delivered by MDA/MTA after the opendir(), then the queue process will garbage collect the message from the queue and the runner will attempt to opendir() a path that no longer exists. Reported by Daniel Lidberg <daniel.lidberg@gmail.com>, observed by jacekm@ and debugged by me, that's collaborative work ;-)
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/smtpd/runner.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/usr.sbin/smtpd/runner.c b/usr.sbin/smtpd/runner.c
index 277230ed45a..6f75aee3b5f 100644
--- a/usr.sbin/smtpd/runner.c
+++ b/usr.sbin/smtpd/runner.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: runner.c,v 1.4 2008/12/07 03:14:24 gilles Exp $ */
+/* $OpenBSD: runner.c,v 1.5 2008/12/11 22:32:27 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -476,7 +476,7 @@ runner_process_bucket(struct smtpd *env, u_int16_t bucket)
dirp = opendir(bucketpath);
if (dirp == NULL)
- fatal("queue_process_bucket: opendir");
+ return;
while ((dp = readdir(dirp)) != NULL) {
@@ -508,7 +508,7 @@ runner_process_message(struct smtpd *env, char *messageid)
dirp = opendir(evppath);
if (dirp == NULL)
- fatal("queue_process_message: opendir");
+ return;
while ((dp = readdir(dirp)) != NULL) {
@@ -533,10 +533,8 @@ runner_process_envelope(struct smtpd *env, char *msgid, char *evpid)
u_int16_t hval;
struct stat sb;
- if (! queue_load_envelope(&message, evpid)) {
- log_debug("failed to load envelope: %s", evpid);
+ if (! queue_load_envelope(&message, evpid))
return;
- }
tm = time(NULL);
@@ -598,7 +596,6 @@ runner_process_runqueue(struct smtpd *env)
unlink(pathname);
if (! queue_load_envelope(&message, dp->d_name)) {
- log_debug("failed to load envelope");
continue;
}