[Mailman-Developers] os.unlink error with mm 2.0.9

Barry A. Warsaw barry@zope.com
Tue, 9 Apr 2002 16:44:48 -0400


>>>>> "MM" == Marc MERLIN <marc_news@vasoftware.com> writes:

    MM> This happened twice on sf.net about 12H after the upgrade to
    MM> 2.0.9

    MM> Apr 09 02:28:06 2002 usw-sf-list1 qrunner(9416): Traceback
    MM> (most recent call las t): Apr 09 02:28:06 2002 usw-sf-list1
    MM> qrunner(9416): File "/var/local/mailman/cron /qrunner", line
    MM> 282, in ?  Apr 09 02:28:06 2002 usw-sf-list1 qrunner(9416):
    MM> kids = main(lock) Apr 09 02:28:06 2002 usw-sf-list1
    MM> qrunner(9416): File "/var/local/mailman/cron /qrunner", line
    MM> 204, in main Apr 09 02:28:06 2002 usw-sf-list1 qrunner(9416):
    MM> os.unlink(root+'.msg') Apr 09 02:28:06 2002 usw-sf-list1
    MM> qrunner(9416): OSError : [Errno 2] No such fi le or directory:
    MM> '/var/local/mailman/qfiles/c0cd07c04a0599fb40d2251f364aa2d187fc
    MM> af43.msg.msg'

    MM> Note the ".msg.msg" (I am not claiming it's new to 2.0.9, I
    MM> have to admit that my old error log file was getting too big
    MM> for me to read it)

Arrgghh!  Can you say MM2.0.10?  :(

Message.Enqueue() writes a .msg.tmp file and there's a small window of
opportunity for qrunner to see that file before it's flipped over to
just .msg.  qrunner's main needs to be taught to ignore .tmp files.

See attached patch.

    MM> There are also fun ones like: Apr 09 08:48:47 2002
    MM> usw-sf-list1 (517) Exception while calculating message head
    MM> er: unsupported format character '^M' (0xd) at index 87

    MM> or Apr 09 06:35:04 2002 usw-sf-list1 (17060) NNTP gateway
    MM> improperly configured: no newsgroup, no NNTP host

    MM> (there aren't new mind you, and I think Barry said that mm2.1
    MM> was better about telling you which list these errors happened
    MM> in)

It should be.  The first one is because somebody's got something bogus
in their message header, the second because they've enabled gatewaying
but the never set up an NNTP host.

-Barry

Index: qrunner
===================================================================
RCS file: /cvsroot/mailman/mailman/cron/Attic/qrunner,v
retrieving revision 1.18.2.4
diff -u -r1.18.2.4 qrunner
--- qrunner	2 Apr 2002 22:38:50 -0000	1.18.2.4
+++ qrunner	9 Apr 2002 20:44:27 -0000
@@ -194,10 +194,11 @@
         # Keep the qrunner lock alive for a while longer
         lock.refresh()
         root, ext = os.path.splitext(os.path.join(mm_cfg.QUEUE_DIR, file))
-        if ext == '.db':
+        if ext == '.db' or ext == '.tmp':
             # Just trigger off the .msg files.  This may leave stale .db files
             # in qfiles, but these can't be cleaned up without storing a
-            # timestamp and watching out for race conditions.
+            # timestamp and watching out for race conditions.  .tmp files are
+            # created by Message.Enqueue() and are fleeting.
             continue
         if not os.path.exists(root+'.db'):
             syslog('qrunner', 'Unlinking orphaned .msg file: %s.msg' % root)