-
- Notifications
You must be signed in to change notification settings - Fork 33k
Closed
Closed
Copy link
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixestopic-asynciotype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
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 probability asyncio.subprocess.Process.communicate()
would now return an empty stdout. Here's a repro:
import asyncio async def main(): attempt = 1 while True: proc = await asyncio.create_subprocess_exec('/bin/echo', 'test', stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE) stdout, stderr = await proc.communicate() text = stdout.decode('utf-8').strip() if text != 'test': raise RuntimeError(f'FAIL on attempt {attempt}: output="{text}"') attempt += 1 asyncio.run(main())
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:
RuntimeError: FAIL on attempt 3823: output=""
Your environment
- CPython versions tested on: 3.11.1
- Operating system and architecture: FreeBSD 13.1 amd64
Linked PRs
mportesdev, asavah and cottsay
Metadata
Metadata
Assignees
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixestopic-asynciotype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
Done