summaryrefslogtreecommitdiff
path: root/Mailman/OutgoingQueue.py
diff options
context:
space:
mode:
authorhmeland1999-07-01 13:16:33 +0000
committerhmeland1999-07-01 13:16:33 +0000
commit706a475b6c4cbbd89086ec548a25224c55a1b511 (patch)
tree836ed5397044d69c950cf81b37fdff3139e72bd9 /Mailman/OutgoingQueue.py
parent4cc27c1bb327951c9d6600de0c058664c80ed6d2 (diff)
downloadmailman-706a475b6c4cbbd89086ec548a25224c55a1b511.tar.gz
mailman-706a475b6c4cbbd89086ec548a25224c55a1b511.tar.zst
mailman-706a475b6c4cbbd89086ec548a25224c55a1b511.zip
processQueue(): Catch and log problems with corrupt/inaccessible queue
files. This fixes a problem where one old, invalid queue file would always cause the queue runner to abort before the newer, possibly valid queue files were processed.
Diffstat (limited to 'Mailman/OutgoingQueue.py')
-rw-r--r--Mailman/OutgoingQueue.py30
1 files changed, 26 insertions, 4 deletions
diff --git a/Mailman/OutgoingQueue.py b/Mailman/OutgoingQueue.py
index cd59c27c3..b4ca0560e 100644
--- a/Mailman/OutgoingQueue.py
+++ b/Mailman/OutgoingQueue.py
@@ -36,6 +36,7 @@
# only one such process to happen at a time.
#
+import sys
import os
import stat
import marshal
@@ -117,10 +118,31 @@ def processQueue():
st[stat.ST_CTIME] > (time.time() - MAX_ACTIVE)):
# then
continue
- f = open(full_fname,"r")
- recip,sender,text = marshal.load(f)
- f.close()
- Utils.TrySMTPDelivery(recip,sender,text,full_fname)
+ try:
+ f = open(full_fname,"r")
+ recip,sender,text = marshal.load(f)
+ f.close()
+ Utils.TrySMTPDelivery(recip,sender,text,full_fname)
+ failure = None
+ except (# marshal.load() failed
+ EOFError, ValueError, TypeError,
+ # open() or close() failed
+ IOError):
+ failure = sys.exc_info()
+
+ if failure:
+ # Should we risk moving the queue file out of the way? That
+ # might cause another exception, if the permissions are
+ # wrong enough...
+ t, v = failure[0], failure[1]
+ from Logging.StampedLogger import StampedLogger
+ l = StampedLogger("error", "processQueue", immediate=1)
+ l.write("Processing of queue file %s failed:\n" % full_fname)
+ l.write("\t %s" % t)
+ if v:
+ l.write(' / %s' % v)
+ l.write('\n')
+ l.flush()
lock_file.unlock()