You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test_subprocess: sporadic failure of test_communicate_epipe() on Windows 8 #63811
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2014-07-28.22:10:58.454>created_at=<Date2013-11-15.16:29:59.634>labels= ['tests', 'OS-windows']
title='test_subprocess: sporadic failure of test_communicate_epipe() on Windows 8'updated_at=<Date2014-07-28.22:10:58.453>user='https://github.com/vstinner'
The test failed on a buildbot, see the message below. By the way, the test should use a value based on test.support.PIPE_MAX_SIZE rather than an hardcoded size of 2**20 bytes.
Traceback (most recent call last):
File "E:\home\cpython\buildslave\x86\3.x.snakebite-win2k8r2sp1-x86\build\lib\test\test_subprocess.py", line 1095, in test_communicate_epipe
p.communicate(b"x"*2**20)
File "E:\home\cpython\buildslave\x86\3.x.snakebite-win2k8r2sp1-x86\build\lib\subprocess.py", line 952, in communicate
stdout, stderr =self._communicate(input, endtime, timeout)
File "E:\home\cpython\buildslave\x86\3.x.snakebite-win2k8r2sp1-x86\build\lib\subprocess.py", line 1188, in _communicateself.stdin.write(input)
OSError: [Errno 22] Invalid argument
(...)
test_communicate_epipe (test.test_subprocess.ProcessTestCase) ... ok
test_communicate_epipe_only_stdin (test.test_subprocess.ProcessTestCase) ... ok
changed the title [-]test_subprocess: sporadic failure of test_communicate_epipe()[/-][+]test_subprocess: sporadic failure of test_communicate_epipe() on Windows 8[/+]on Nov 24, 2013
I don't know much about subprocess.py and I don't have access to Windows 8. But it looks like the kind of thing that might happen if the other end of the "pipe" is closed, which might happen if the subprocess exits early, either because it's just fast or because it's encountered some other bug.
If I add a sleep of 1 second before stdin.write(), the test always fail with OSError(22, "Invalid parameter"). So it becomes obvious that the write fails if the process already exited.
Attached patch should fix the issue. Can someone review it?
If I add a sleep of 1 second before stdin.write(), the test always fail
with OSError(22, "Invalid parameter"). So it becomes obvious that the write
fails if the process already exited.
Attached patch should fix the issue. Can someone review it?
Oh, it looks like my patch is not enough: the test still fails sometimes :-/ It looks like the process was still running (poll() didn't return None) whereas stdin.write() got an OSError(errno.EINVAL).
Activity
vstinner commentedon Nov 15, 2013
The test failed on a buildbot, see the message below. By the way, the test should use a value based on test.support.PIPE_MAX_SIZE rather than an hardcoded size of 2**20 bytes.
http://buildbot.python.org/all/builders/x86%20Windows%20Server%202008%20%5BSB%5D%203.x/builds/1661/steps/test/logs/stdio
test_communicate_epipe (test.test_subprocess.ProcessTestCase) ... ERROR
test_communicate_epipe_only_stdin (test.test_subprocess.ProcessTestCase) ... ok
======================================================================
ERROR: test_communicate_epipe (test.test_subprocess.ProcessTestCase)
----------------------------------------------------------------------
(...)
test_communicate_epipe (test.test_subprocess.ProcessTestCase) ... ok
test_communicate_epipe_only_stdin (test.test_subprocess.ProcessTestCase) ... ok
[-]test_subprocess: sporadic failure of test_communicate_epipe()[/-][+]test_subprocess: sporadic failure of test_communicate_epipe() on Windows 8[/+]gvanrossum commentedon Nov 24, 2013
I don't know much about subprocess.py and I don't have access to Windows 8. But it looks like the kind of thing that might happen if the other end of the "pipe" is closed, which might happen if the subprocess exits early, either because it's just fast or because it's encountered some other bug.
vstinner commentedon Feb 18, 2014
If I add a sleep of 1 second before stdin.write(), the test always fail with OSError(22, "Invalid parameter"). So it becomes obvious that the write fails if the process already exited.
Attached patch should fix the issue. Can someone review it?
The test fails also on Python 3.3.
gvanrossum commentedon Feb 18, 2014
LGTM. Please commit in both repos and add to the list of cherrypicks for
Larry.
On Tue, Feb 18, 2014 at 1:40 AM, STINNER Victor <report@bugs.python.org>wrote:
python-dev commentedon Feb 18, 2014
New changeset 83013a7be836 by Victor Stinner in branch '3.3':
Issue bpo-19612: On Windows, subprocess.Popen.communicate() now ignores
http://hg.python.org/cpython/rev/83013a7be836
New changeset 423cb79640eb by Victor Stinner in branch 'default':
(Merge 3.3) Issue bpo-19612: On Windows, subprocess.Popen.communicate() now
http://hg.python.org/cpython/rev/423cb79640eb
vstinner commentedon Feb 18, 2014
Thanks for the review.
Both repos? You mean Tulip? This issue is specific to subprocess not asyncio (asyncio.subprocess).
This sporadic bug is not new. IMO it exists since Python 3.3.
I'm not sure that it's need to hurry to fix it in Python 3.4.0.
gvanrossum commentedon Feb 18, 2014
Sorry, forget everything I said. (That includes the LGTM, sadly -- as I wrote earlier I don't know this code very well.)
vstinner commentedon Feb 18, 2014
Don't worry, I'm confident in my change :)
vstinner commentedon Mar 4, 2014
Oh, it looks like my patch is not enough: the test still fails sometimes :-/ It looks like the process was still running (poll() didn't return None) whereas stdin.write() got an OSError(errno.EINVAL).
http://buildbot.python.org/all/builders/x86%20Windows%20Server%202008%20%5BSB%5D%203.x/builds/2408/steps/test/logs/stdio
======================================================================
ERROR: test_communicate_epipe (test.test_subprocess.ProcessTestCase)
----------------------------------------------------------------------
python-dev commentedon Jul 28, 2014
New changeset 039ac3f01c4e by Victor Stinner in branch '2.7':
Issue bpo-19612: subprocess.communicate() now also ignores EINVAL when using at
http://hg.python.org/cpython/rev/039ac3f01c4e
vstinner commentedon Jul 28, 2014
I didnd't see the failure recently on Windows, so I close the issue.
I backported the fix on Python 2.7 for the issue bpo-21946.