[pypy-commit] pypy reverse-debugger: Correctly close the remote end of the socketpair. Otherwise, the
arigo
pypy.commits at gmail.com
Thu Aug 11 03:54:48 EDT 2016
Author: Armin Rigo <arigo at tunes.org>
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)
More information about the pypy-commit
mailing list