summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Mailman/Cgi/admindb.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/Mailman/Cgi/admindb.py b/Mailman/Cgi/admindb.py
index cc061be26..72680ed9e 100644
--- a/Mailman/Cgi/admindb.py
+++ b/Mailman/Cgi/admindb.py
@@ -16,6 +16,7 @@
"""Produce and process the pending-approval items for a list."""
+import sys
import os
import types
import cgi
@@ -75,18 +76,27 @@ def main():
doc = Document()
doc.set_language(mlist.preferred_language)
- # Lock the list for the next operation. BAW: Strictly speaking, the list
- # should not need to be locked just to read the request database. However
- # the request database asserts that the list is locked in order to load
- # it and it's not worth complicating that logic.
+ # We need a signal handler to catch the SIGTERM that can come from Apache
+ # when the user hits the browser's STOP button. See the comment in
+ # admin.py for details.
#
- # Also, see the comment in admin.py about the need for the signal handler.
+ # BAW: Strictly speaking, the list should not need to be locked just to
+ # read the request database. However the request database asserts that
+ # the list is locked in order to load it and it's not worth complicating
+ # that logic.
def sigterm_handler(signum, frame, mlist=mlist):
+ # Make sure the list gets unlocked...
mlist.Unlock()
+ # ...and ensure we exit, otherwise race conditions could cause us to
+ # enter MailList.Save() while we're in the unlocked state, and that
+ # could be bad!
+ sys.exit(0)
mlist.Lock()
try:
+ # Install the emergency shutdown signal handler
signal.signal(signal.SIGTERM, sigterm_handler)
+
realname = mlist.real_name
if not cgidata.keys():
# If this is not a form submission (i.e. there are no keys in the