Author: Armin Rigo <[email protected]>
Branch: reverse-debugger
Changeset: r86132:5797950d42c5
Date: 2016-08-11 09:53 +0200
http://bitbucket.org/pypy/pypy/changeset/5797950d42c5/

Log:    Correctly close the remote end of the socketpair. Otherwise, the
        subprocess may remain alive forever, trying to read from its own end
        of the socketpair, because it also happens to keep the remote end
        open.

diff --git a/rpython/translator/revdb/process.py 
b/rpython/translator/revdb/process.py
--- a/rpython/translator/revdb/process.py
+++ b/rpython/translator/revdb/process.py
@@ -228,7 +228,7 @@
         s1, s2 = socket.socketpair()
         initial_subproc = subprocess.Popen(
             [executable, '--revdb-replay', revdb_log_filename,
-             str(s2.fileno())])
+             str(s2.fileno())], preexec_fn=s1.close)
         s2.close()
         child = ReplayProcess(initial_subproc.pid, s1,
                               linecacheoutput=linecacheoutput)
diff --git a/rpython/translator/revdb/test/test_basic.py 
b/rpython/translator/revdb/test/test_basic.py
--- a/rpython/translator/revdb/test/test_basic.py
+++ b/rpython/translator/revdb/test/test_basic.py
@@ -263,7 +263,7 @@
         s1, s2 = socket.socketpair()
         subproc = subprocess.Popen(
             [str(self.exename), '--revdb-replay', str(self.rdbname),
-             str(s2.fileno())], **kwds)
+             str(s2.fileno())], preexec_fn=s1.close, **kwds)
         s2.close()
         self.subproc = subproc
         child = ReplayProcess(subproc.pid, s1)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to