`asyncio.create_subprocess_exec`: cannot read `/dev/stdin`
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 45/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- À l'abandon
- Stack technique
- python
- Domaine
- backend, operating-systems
Piste de recherche
Commencez par le reproducer dans test.py et comparez son comportement avec vanilla asyncio sous Linux dans Docker. Suivez la gestion de stdin de subprocess à travers uvloop/loop.pyx, uvloop/handles/stream.pyx et uvloop/handles/handle.pyx. Le travail est terminé lorsque le sous-processus /dev/stdin affiche b'test' sous uvloop sans le closed-transport error.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
- uvloop version:
uvloop==0.17.0 - Python version:
Python 3.10.10 - Platform:
Linux 0af9a1603f81 5.10.76-linuxkit #1 SMP Mon Nov 8 10:21:19 UTC 2021 x86_64 GNU/Linux(in a Docker container) - Can you reproduce the bug with
PYTHONASYNCIODEBUGin env?: yes - Does uvloop behave differently from vanilla asyncio? How?: yes. Vanilla
asynciohad a similar issue patched: https://github.com/python/cpython/issues/90522
Processes run with asyncio.create_subprocess_exec fail to read from /dev/stdin with uvloop but not with asyncio
asyncio had a similar issue fixed recently (in January 2022): https://github.com/python/cpython/issues/90522
This was backported to 3.10 and 3.11
I can reproduce this on Linux in a Docker container, with either Mac OS or Linux as hosts
I cannot reproduce this on Mac OS (seems to work fine)
Logs:
# PYTHONASYNCIODEBUG=1 python test.py
cat: /dev/stdin: No such device or address
Traceback (most recent call last):
File "//test.py", line 16, in <module>
asyncio.run(f())
File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
File "//test.py", line 13, in f
stdout, _ = await proc.communicate("test".encode("utf-8"))
File "/usr/local/lib/python3.10/asyncio/subprocess.py", line 195, in communicate
stdin, stdout, stderr = await tasks.gather(stdin, stdout, stderr)
File "/usr/local/lib/python3.10/asyncio/subprocess.py", line 147, in _feed_stdin
self.stdin.write(input)
File "/usr/local/lib/python3.10/asyncio/streams.py", line 325, in write
self._transport.write(data)
File "uvloop/handles/stream.pyx", line 674, in uvloop.loop.UVStream.write
File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
RuntimeError: unable to perform operation on <WriteUnixTransport closed=True reading=False 0x7f64e3186dc0>; the handler is closed
Expected (using asyncio):
# PYTHONASYNCIODEBUG=1 python test.py
b'test'
Code to reproduce:
import asyncio
# Commenting out `uvloop` below fixes the issue
import uvloop
uvloop.install()
async def f():
proc = await asyncio.create_subprocess_exec(
"cat",
"/dev/stdin",
stdin=asyncio.subprocess.PIPE,
stdout=asyncio.subprocess.PIPE,
)
stdout, _ = await proc.communicate("test".encode("utf-8"))
print(stdout)
asyncio.run(f())
- Langage dominant
- Cython
- Étoiles
- 11.9k
- Forks
- 615
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de MagicStack/uvloop
-
License not clear Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
MagicStack/uvloop#759 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
MagicStack/uvloop#741 · 2 réactions ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
MagicStack/uvloop#702 · 8 commentaires · 9 réactions ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
MagicStack/uvloop#766 ·
-
Directly constructed subprocess pipe protocols segfault when callbacks use a non-process owner Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 52/100
MagicStack/uvloop#765 ·
Toutes les issues de MagicStack/uvloop
Issues similaires
-
Bug
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Automattic/safe-publish#593 ·
-
executions.Query — startDate and timeRange filters are sent with inverted comparison operators Ouvertearea/plugin
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
kestra-io/plugin-kestra#190 ·
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
xinnan-tech/xiaozhi-fde-talk#263 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
-
pending-maintainer-response pending-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100