diff options
author | msapiro <> | 2006-07-22 01:53:41 +0000 |
---|---|---|
committer | msapiro <> | 2006-07-22 01:53:41 +0000 |
commit | b89f016fd9e853ebd7d1f03fd62327cc2be83f76 (patch) | |
tree | 19029eb178b95db3af2dca5f155f2a0e2f72a0ae /bin/unshunt | |
parent | c837367f2365d261d00dda2215804da481f8facc (diff) | |
download | mailman2-b89f016fd9e853ebd7d1f03fd62327cc2be83f76.tar.gz mailman2-b89f016fd9e853ebd7d1f03fd62327cc2be83f76.tar.xz mailman2-b89f016fd9e853ebd7d1f03fd62327cc2be83f76.zip |
- bin/unshunt
- Queue/Runner.py
- Queue/Switchboard.py
Backported the gfiles backup changes from the trunk. The following comments
are from the trunk checkin. Note that the test cases are not added.
Added robustness to Switchboards and Runners so that if a runner crashes
uncleanly (e.g. segfaults the Python interpreter), messages being processed
will not be lost.
The vulnerability, ideas, and patches are credited to Richard Barrett and Mark
Sapiro. Their original work was modified by Barry for this commit and any
bugs are his fault.
The basic idea is that instead of unlinking a .pck file in dequeue(), the file
is renamed to a .bak file. The Switchboard grows a finish() method which then
unlinks the .bak file. That class's constructor also grows a 'restore'
argument (defaulting to false), which when true moves all .bak files it finds
in its hash space to .pck, thereby restoring a file lost while "in flight".
This relies on the fact that even with multiple qrunners, exactly one process
will be responsible for one hash space slice, so it's never possible (under
normal operation) for a .bak file to be renamed to .pck by some other process.
Test cases for both the new Switchboard behavior and the use of that by Runner
subclasses has been added.
There are two things to watch out for, either of which may require some
additional changes. There is some small potential to duplicate messages in
various queues, if say 'mailmanctl' were improperly started more than once by
a site admin. This usually won't happen unless an admin is overly eager with
the mailmanctl -s switch, so we can chalk this one up to operator error. I'm
not sure what more we can do about that.
There's also a possibility that if we're processing a message that continually
causes the Python interpreter to crash, we could end up duplicating messages
endlessly. This is especially troublesome for the Outgoing runner which could
conceivably cause a mail flood. I consider this the more critical issue to
defend against, probably by adding a numbering scheme to the .bak file names
and refusing to restore a .bak file more than say 3 times without human
intervention.
Diffstat (limited to '')
-rw-r--r-- | bin/unshunt | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/bin/unshunt b/bin/unshunt index 8b675587..8c1c117f 100644 --- a/bin/unshunt +++ b/bin/unshunt @@ -1,6 +1,6 @@ #! @PYTHON@ -# Copyright (C) 2002 by the Free Software Foundation, Inc. +# Copyright (C) 2002-2006 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -14,7 +14,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Move a message from the shunt queue to the original queue. @@ -69,6 +70,7 @@ def main(): usage(1) sb = get_switchboard(qdir) + sb.recover_backup_files() for filebase in sb.files(): try: msg, msgdata = sb.dequeue(filebase) @@ -80,6 +82,9 @@ def main(): # other shunted messages. print >> sys.stderr, _( 'Cannot unshunt message %(filebase)s, skipping:\n%(e)s') + else: + # Unlink the .bak file left by dequeue() + sb.finish(filebase) |