summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw2001-06-02 05:31:09 +0000
committerbwarsaw2001-06-02 05:31:09 +0000
commitc9aa017891d47e4cfe8800756076b7ccfb34673c (patch)
treeaa798bda0234ea2838d689b1284f143b0b941369
parent2641b2f18fd608367a70a4b4da15f986a85354bf (diff)
downloadmailman-c9aa017891d47e4cfe8800756076b7ccfb34673c.tar.gz
mailman-c9aa017891d47e4cfe8800756076b7ccfb34673c.tar.zst
mailman-c9aa017891d47e4cfe8800756076b7ccfb34673c.zip
sighup_handler(): Be sure to propagate the SIGHUP to all the qrunner
children, so they re-open their log files too. Move the `kids' dictionary (with keys being the pids of the children), to module global `KIDS' so sighup_handler() can have access to it.
-rw-r--r--cron/qrunner20
1 files changed, 12 insertions, 8 deletions
diff --git a/cron/qrunner b/cron/qrunner
index 07ad9d0dc..64707ee9d 100644
--- a/cron/qrunner
+++ b/cron/qrunner
@@ -110,11 +110,16 @@ SNOOZE = mm_cfg.days(1)
# cause a new StampedLogger to be opened the next time a message is logged.
def sighup_handler(signum, frame):
syslog.close()
+ # We also need to HUP all the child processes
+ for pid in KIDS.keys():
+ os.kill(pid, signal.SIGHUP)
# And just to tweak things...
syslog('qrunner', 'qrunner caught SIGHUP. Re-opening log files.')
signal.signal(signal.SIGHUP, sighup_handler)
+KIDS = {}
+
def usage(code, msg=''):
@@ -164,7 +169,6 @@ def start_lock_refresher(lock):
def master(restart, lock):
# Start up the lock refresher process
watchdog_pid = start_lock_refresher(lock)
- kids = {}
# Start up all the qrunners
for classname, count in mm_cfg.QRUNNERS:
modulename = 'Mailman.Queue.' + classname
@@ -173,7 +177,7 @@ def master(restart, lock):
for slice in range(count):
info = (qrclass, slice, count)
pid = start_runner(*info)
- kids[pid] = info
+ KIDS[pid] = info
#
# Now just wait for children to end, but also catch KeyboardInterrupts
if restart:
@@ -200,32 +204,32 @@ qrunner watchdog detected lock refresher exit
if restart:
watchdog_pid = start_lock_refresher(lock)
else:
- qrclass, slice, count = kids[pid]
+ qrclass, slice, count = KIDS[pid]
syslog('qrunner', '''\
qrunner watchdog detected subprocess exit
(pid: %d, sig: %d, sts: %d, class: %s, slice %d of %d) %s'''
% (pid, killsig, exitstatus, qrclass, slice, count,
restarting))
- del kids[pid]
+ del KIDS[pid]
# Now perhaps restart the process
if restart:
newpid = start_runner(qrclass, slice, count)
- kids[newpid] = (qrclass, slice, count)
+ KIDS[newpid] = (qrclass, slice, count)
except KeyboardInterrupt:
pass
finally:
# Should we leave the main loop for any reason, we want to be sure all
# of our children are exited cleanly. Send SIGINTs to all the child
# processes and wait for them all to exit.
- for pid in kids.keys():
+ for pid in KIDS.keys():
try:
os.kill(pid, SIGINT)
except OSError, e:
if e.errno == errno.ESRCH:
# The child has already exited
- del kids[pid]
+ del KIDS[pid]
# Wait for all the childred to go away
- Utils.reap(kids)
+ Utils.reap(KIDS)