New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_subprocess: sporadic failure of test_communicate_epipe() on Windows 8 #63811
Comments
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. test_communicate_epipe (test.test_subprocess.ProcessTestCase) ... ERROR ====================================================================== 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 _communicate
self.stdin.write(input)
OSError: [Errno 22] Invalid argument (...) |
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? The test fails also on Python 3.3. |
LGTM. Please commit in both repos and add to the list of cherrypicks for On Tue, Feb 18, 2014 at 1:40 AM, STINNER Victor <report@bugs.python.org>wrote:
|
New changeset 83013a7be836 by Victor Stinner in branch '3.3': New changeset 423cb79640eb by Victor Stinner in branch 'default': |
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. |
Sorry, forget everything I said. (That includes the LGTM, sadly -- as I wrote earlier I don't know this code very well.) |
Don't worry, I'm confident in my change :) |
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). ====================================================================== 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 951, 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 1187, in _communicate
self.stdin.write(input)
OSError: [Errno 22] Invalid argument |
New changeset 039ac3f01c4e by Victor Stinner in branch '2.7': |
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. |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: