MagicStack / MagicStack/uvloop
pipes from subprocess_exec do not have extra info 'pipe' (incompatible with vanilla asyncio)
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Cython
- Sterne
- 11.9k
- Forks
- 616
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
-
uvloop version:
0.19.0 -
Python version:
3.10.12 -
Platform:
linux -
Can you reproduce the bug with
PYTHONASYNCIODEBUGin env?:
yes -
Does uvloop behave differently from vanilla asyncio? How?:
Yes, this is the point of this issue report. So after you get your process transport from subprocess_exec(...) you then can use get_pipe_transport() to access the transport associated with stdin. With vanilla asyncio you can then call get_extra_info('pipe') on that transport to access the pipe directly. With uvloop get_extra_info('pipe') on the same transport returns None.
I can see in the source that when a pipe transport is created via loop.create_write_pipe(...) we have:
transp = WriteUnixTransport.new(self, proto, None, waiter)
transp._add_extra_info('pipe', pipe)
However no transp._add_extra_info(...) is done on the WriteUnixTransport that is created inside the UVProcessTransport code. There are ways to work around this (don't depend on getting access to that pipe) however this works fine in the asyncio loop implementation. I imagine it can be done without too much pain by wrapping the raw file descriptor created in the process transport code however I'm not super fluent in cython so I didn't attempt a patch.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne im UVProcessTransport-Code an der Stelle, an der der WriteUnixTransport für Subprozess-Pipes erstellt wird, und vergleiche ihn mit loop.create_write_pipe(), das die zusätzlichen Pipe-Informationen hinzufügt. Überprüfe, dass der von get_pipe_transport() zurückgegebene Subprozess-stdin-Transport die zugrunde liegende Pipe über get_extra_info('pipe') bereitstellt und damit dem Verhalten von vanilla asyncio entspricht.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- backend, networking
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100