D1737: commandserver: unblock SIGCHLD

quark (Jun Wu) phabricator at mercurial-scm.org
Wed Dec 20 10:12:55 UTC 2017


quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This enables the SIGCHLD handler to work properly if some buggy program
  started chg server with SIGCHLD blocked.
  
  A test of this probably requires C code, but we don't have such kind of
  tests already. Since this is a simple and clear fix, I'm leaving it as
  "untested" but I did a manual test and there were no longer zombie workers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1737

AFFECTED FILES
  mercurial/commandserver.py

CHANGE DETAILS

diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
--- a/mercurial/commandserver.py
+++ b/mercurial/commandserver.py
@@ -449,6 +449,10 @@
     def init(self):
         self._sock = socket.socket(socket.AF_UNIX)
         self._servicehandler.bindsocket(self._sock, self.address)
+        try:
+            util.osutil.unblocksignal(signal.SIGCHLD)
+        except (OSError, AttributeError):
+            pass
         o = signal.signal(signal.SIGCHLD, self._sigchldhandler)
         self._oldsigchldhandler = o
         self._socketunlinked = False



To: quark, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list