Charles-François Natali <neolo...@free.fr> added the comment:
Duh, don't know what I was thinking: the syscall is not restarted
(even though ERESTARTSYS is displayed by strace): the real problem is
that the 3s timeout to communicate is not enough, because spawning a
new interpreter can take a long time (Antoine created an issue some
time ago about the high number of syscalls per import). If it takes
more than 1s, the test will fail.
Also, I guess it's worst on FreeBSD because subprocess.Popen uses
close_fds=True by default, and FreeBSD has a huge default
_SC_OPEN_MAX.
I've attached a patch passing close_fds=False to spawn_python, and
running the test only once, because otherwise this would require a
timeout quite large.
----------
Added file: http://bugs.python.org/file22420/test_siginterrupt.diff
_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12363>
_______________________________________
diff -r 10ecf8576eb2 Lib/test/test_signal.py
--- a/Lib/test/test_signal.py Tue Jun 21 17:24:21 2011 +0200
+++ b/Lib/test/test_signal.py Tue Jun 21 23:03:18 2011 +0200
@@ -337,21 +337,19 @@
if interrupt is not None:
signal.siginterrupt(signal.SIGALRM, interrupt)
- # run the test twice
- for loop in range(2):
- # send a SIGALRM in a second (during the read)
- signal.alarm(1)
- try:
- # blocking call: read from a pipe without data
- os.read(r, 1)
- except OSError as err:
- if err.errno != errno.EINTR:
- raise
- else:
- sys.exit(2)
+ # send a SIGALRM in a second (during the read)
+ signal.alarm(1)
+ try:
+ # blocking call: read from a pipe without data
+ os.read(r, 1)
+ except OSError as err:
+ if err.errno != errno.EINTR:
+ raise
+ else:
+ sys.exit(2)
sys.exit(3)
""" % (interrupt,)
- with spawn_python('-c', code) as process:
+ with spawn_python('-c', code, close_fds=False) as process:
try:
stdout, stderr = process.communicate(timeout=3.0)
except subprocess.TimeoutExpired:
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com