Patchwork D3720: commandserver: close server's fds explicitly from a worker

login
register
mail settings
Submitter phabricator
Date June 12, 2018, 7:42 p.m.
Message ID <differential-rev-PHID-DREV-mnyus45pnwuctregr3qp-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/32091/
State Superseded
Headers show

Comments

phabricator - June 12, 2018, 7:42 p.m.
quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The forked worker does not need to accept connections from the server's
  socket fd. So let's just close them explicitly to avoid surprises.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/commandserver.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
--- a/mercurial/commandserver.py
+++ b/mercurial/commandserver.py
@@ -494,6 +494,8 @@ 
                     conn.close()  # release handle in parent process
             else:
                 try:
+                    selector.close()
+                    self._sock.close()
                     self._runworker(conn)
                     conn.close()
                     os._exit(0)