Patchwork D1737: commandserver: unblock SIGCHLD

login
register
mail settings
Submitter phabricator
Date Dec. 20, 2017, 10:12 a.m.
Message ID <differential-rev-PHID-DREV-wvg2q2ftrr6obyznv63m-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/26369/
State Superseded
Headers show

Comments

phabricator - Dec. 20, 2017, 10:12 a.m.
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




To: quark, #hg-reviewers
Cc: mercurial-devel
phabricator - Dec. 20, 2017, 1:29 p.m.
yuja requested changes to this revision.
yuja added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> commandserver.py:454
> +            util.osutil.unblocksignal(signal.SIGCHLD)
> +        except (OSError, AttributeError):
> +            pass

My two cents, add alias `util.unblocksignal()`, and probably better not ignoring OSError.

REPOSITORY
  rHG Mercurial

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

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

Patch

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