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
asyncio subprocess stdout occasionally lost (3.11.0 → 3.11.1 regression) #100133
Comments
@kumaraditya303 FYI, there were some commits to asyncio subprocess from you recently. |
I experienced this too, reported it here with some additional info: |
For me, the following script always results with an unexpected import asyncio
async def get_command_stdout(cmd, *args):
proc = await asyncio.create_subprocess_exec(
cmd, *args, stdout=asyncio.subprocess.PIPE,
)
stdout, _ = await proc.communicate()
return stdout
async def main():
return await asyncio.gather(
get_command_stdout('echo', 'foo'),
get_command_stdout('echo', 'bar'),
get_command_stdout('echo', 'baz'),
)
if __name__ == '__main__':
print(asyncio.run(main())) |
Let’s bisect that repro to a specific commit. |
The bisection points to
We will get it fixed in 3.11.2. |
The fix works for me, thank you! |
…` output (pythonGH-100154) (cherry picked from commit a7715cc) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Fix losing stdout of asyncio.subprocess spawned processes. PR: 268502 Approved by: wen (python@) Upstream issue: python/cpython#100133
AMDmi3 commentedDec 9, 2022
•
edited by bedevere-bot
Bug report
So, I've updated python from 3.11.0 to 3.11.1 and one of my utilities which runs a lot of external processes with
asyncio.create_subprocess_exec
started failing in different places in weird ways. It turned out that with some probabilityasyncio.subprocess.Process.communicate()
would now return an empty stdout. Here's a repro:You may have to wait somewhat for the problem to reproduce, but for me it fails in under 15 seconds more or less reliably. Possible output:
Your environment
Linked PRs
asyncio
subprocess losingstderr
andstdout
output #100154asyncio
subprocess losingstderr
andstdout
output (GH-100154) #100398The text was updated successfully, but these errors were encountered: