From e8641a172f45b17b654332248994260a5041e867 Mon Sep 17 00:00:00 2001 From: cotton Date: Tue, 13 Oct 1998 20:13:34 +0000 Subject: a little stress testing revealed a bug in OutgoingQueue: the processQueue procedure assumed that files existed that it had recently found in the directory listing, but they may have been dequeued by another process between the time when the directory was listed and when processQueue stats the file. the fix is just to try: it and continue iff the file doesn't exist. scott --- Mailman/OutgoingQueue.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'Mailman/OutgoingQueue.py') diff --git a/Mailman/OutgoingQueue.py b/Mailman/OutgoingQueue.py index f5b9cbfc3..faedc5654 100644 --- a/Mailman/OutgoingQueue.py +++ b/Mailman/OutgoingQueue.py @@ -75,7 +75,24 @@ def processQueue(): if TEMPLATE != file[:len(TEMPLATE)]: continue full_fname = os.path.join(mm_cfg.DATA_DIR, file) - st = os.stat(full_fname) + # + # we need to stat the file if it still exists (atomically, we + # can't use use os.path.exists then stat. + # if it doesn't exist, it's been dequeued since we saw + # it in the directory listing + # + try: + st = os.stat(full_fname) + except os.error, rest: + try: + code, msg = rest + except ValueError: + code = "" + msg = str(rest) + if code == errno.ENOENT: # file does not exist, it's already been dequeued + continue + else: + raise os.error, rest # # if the file is not a deferred q message, we check to # see if the creation time was too long ago and process -- cgit v1.2.3-70-g09d2