Serious issue with Mailman MR 238, PEP 475

It appears that the subject fix has the following nasty effect, at least with Python 3.4
I.e. when logrotate SIGHUPs the master to reopen logs, all the runners except for 'rest' exit.
Ordinarily, I'd report this on GitLab, but they are having problems of their own right now.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

On Jan 31, 2017, at 09:28 PM, Mark Sapiro wrote:
I.e. when logrotate SIGHUPs the master to reopen logs, all the runners except for 'rest' exit.
Can you try this? -Barry diff --git a/src/mailman/core/runner.py b/src/mailman/core/runner.py index 9f80941..707ad5e 100644 --- a/src/mailman/core/runner.py +++ b/src/mailman/core/runner.py @@ -92,23 +92,24 @@ class Runner: signal.SIGINT: 'SIGINT', signal.SIGUSR1: 'SIGUSR1', }.get(signum, signum) - if signum in (signal.SIGTERM, signal.SIGINT, signal.SIGUSR1): + if signum == signal.SIGHUP: + reopen() + rlog.info('%s runner caught SIGHUP. Reopening logs.', self.name) + elif signum in (signal.SIGTERM, signal.SIGINT, signal.SIGUSR1): self.stop() self.status = signum rlog.info('%s runner caught %s. Stopping.', self.name, signame) - elif signum == signal.SIGHUP: - reopen() - rlog.info('%s runner caught SIGHUP. Reopening logs.', self.name) - # As of Python 3.5, PEP 475 gets in our way. Runners with long - # time.sleep()'s in their _snooze() method (e.g. the retry runner) will - # have their system call implemented time.sleep() automatically retried - # at the C layer. The only reliable way to prevent this is to raise an - # exception in the signal handler. The standard run() method - # automatically suppresses this exception, meaning, it's caught and - # ignored, but effectively breaks the run() loop, which is just what we - # want. Runners which implement their own run() method must be - # prepared to catch RunnerInterrupts, usually also ignoring them. - raise RunnerInterrupt + # As of Python 3.5, PEP 475 gets in our way. Runners with long + # time.sleep()'s in their _snooze() method (e.g. the retry runner) + # will have their system call implemented time.sleep() + # automatically retried at the C layer. The only reliable way to + # prevent this is to raise an exception in the signal handler. The + # standard run() method automatically suppresses this exception, + # meaning, it's caught and ignored, but effectively breaks the + # run() loop, which is just what we want. Runners which implement + # their own run() method must be prepared to catch + # RunnerInterrupts, usually also ignoring them. + raise RunnerInterrupt def set_signals(self): """See `IRunner`."""

On Jan 31, 2017, at 09:28 PM, Mark Sapiro wrote:
I.e. when logrotate SIGHUPs the master to reopen logs, all the runners except for 'rest' exit.
Can you try this? -Barry diff --git a/src/mailman/core/runner.py b/src/mailman/core/runner.py index 9f80941..707ad5e 100644 --- a/src/mailman/core/runner.py +++ b/src/mailman/core/runner.py @@ -92,23 +92,24 @@ class Runner: signal.SIGINT: 'SIGINT', signal.SIGUSR1: 'SIGUSR1', }.get(signum, signum) - if signum in (signal.SIGTERM, signal.SIGINT, signal.SIGUSR1): + if signum == signal.SIGHUP: + reopen() + rlog.info('%s runner caught SIGHUP. Reopening logs.', self.name) + elif signum in (signal.SIGTERM, signal.SIGINT, signal.SIGUSR1): self.stop() self.status = signum rlog.info('%s runner caught %s. Stopping.', self.name, signame) - elif signum == signal.SIGHUP: - reopen() - rlog.info('%s runner caught SIGHUP. Reopening logs.', self.name) - # As of Python 3.5, PEP 475 gets in our way. Runners with long - # time.sleep()'s in their _snooze() method (e.g. the retry runner) will - # have their system call implemented time.sleep() automatically retried - # at the C layer. The only reliable way to prevent this is to raise an - # exception in the signal handler. The standard run() method - # automatically suppresses this exception, meaning, it's caught and - # ignored, but effectively breaks the run() loop, which is just what we - # want. Runners which implement their own run() method must be - # prepared to catch RunnerInterrupts, usually also ignoring them. - raise RunnerInterrupt + # As of Python 3.5, PEP 475 gets in our way. Runners with long + # time.sleep()'s in their _snooze() method (e.g. the retry runner) + # will have their system call implemented time.sleep() + # automatically retried at the C layer. The only reliable way to + # prevent this is to raise an exception in the signal handler. The + # standard run() method automatically suppresses this exception, + # meaning, it's caught and ignored, but effectively breaks the + # run() loop, which is just what we want. Runners which implement + # their own run() method must be prepared to catch + # RunnerInterrupts, usually also ignoring them. + raise RunnerInterrupt def set_signals(self): """See `IRunner`."""
participants (2)
-
Barry Warsaw
-
Mark Sapiro