Abhilash Raj pushed to branch master at GNU Mailman / Mailman Core


Commits:
8e5da156 by Mark Sapiro at 2021-05-11T23:51:39+00:00
Fix master watcher to restart child exits.

- - - - -
a0159d93 by Abhilash Raj at 2021-05-11T23:51:39+00:00
Merge branch 'runner' into 'master'

Fix master watcher to restart child exits.

See merge request mailman/mailman!858
- - - - -


3 changed files:

- setup.py
- src/mailman/bin/master.py
- src/mailman/docs/NEWS.rst


Changes:

=====================================
setup.py
=====================================
@@ -115,7 +115,7 @@ case second 'm'.  Any other spelling is incorrect.""",
         'atpublic',
         'authheaders>=0.9.2',
         'authres>=1.0.1',
-        'click>=7.0.0',
+        'click>=7.0.0,<8.0',
         'dnspython>=1.14.0',
         'falcon>=3.0.0',
         'flufl.bounce',


=====================================
src/mailman/bin/master.py
=====================================
@@ -420,11 +420,14 @@ class Loop:
             # Find out why the subprocess exited by getting the signal
             # received or exit status.
             if os.WIFSIGNALED(status):
-                why = os.WTERMSIG(status)
+                why = os.WTERMSIG(status)                    # pragma: nocover
+                sig_or_exit = 'SIGNAL '                      # pragma: nocover
             elif os.WIFEXITED(status):
                 why = os.WEXITSTATUS(status)
-            else:
+                sig_or_exit = 'EXIT '
+            else:                                            # pragma: nocover
                 why = None
+                sig_or_exit = 'UNKNOWN'
             # We'll restart the subprocess if it exited with a SIGUSR1 or
             # because of a failure (i.e. no exit signal), and the no-restart
             # command line switch was not given.  This lets us better handle
@@ -432,7 +435,8 @@ class Loop:
             rname, slice_number, count, restarts = self._kids.pop(pid)
             config_name = 'runner.' + rname
             restart = False
-            if why == signal.SIGUSR1 and self._restartable:
+            if ((why == signal.SIGUSR1 or sig_or_exit != 'SIGNAL ') and
+                    self._restartable):                      # pragma: nocover
                 restart = True
             # Have we hit the maximum number of restarts?
             restarts += 1
@@ -442,8 +446,8 @@ class Loop:
             # Are we permanently non-restartable?
             log.debug("""\
 Master detected subprocess exit
-(pid: {0:d}, why: {1}, class: {2}, slice: {3:d}/{4:d}) {5}""".format(
-                     pid, why, rname, slice_number + 1, count,
+(pid: {0:d}, why: {1}{2}, class: {3}, slice: {4:d}/{5:d}) {6}""".format(
+                     pid, sig_or_exit, why, rname, slice_number + 1, count,
                      ('[restarting]' if restart else '')))
             # See if we've reached the maximum number of allowable restarts.
             if restarts > max_restarts:


=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -60,6 +60,7 @@ Bugs
   (Closes #858)
 * Improve performance of the bounce runner by decreasing the number of
   database queries executed.
+* The master watcher will now restart a process that exits.  (See #887)
 
 Command line
 ------------



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/3d8ac31202d466843c0b5a3cf794d7322a822f3c...a0159d938fbf5231e6f85d190cce15b55c3cd98f

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/3d8ac31202d466843c0b5a3cf794d7322a822f3c...a0159d938fbf5231e6f85d190cce15b55c3cd98f
You're receiving this email because of your account on gitlab.com.


_______________________________________________
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org

Reply via email to