You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importasyncioimportsysimportunittestimportasyncioasyncio.set_child_watcher(asyncio.PidfdChildWatcher())
defcreate_free_port():
return4# chosen by a fair dice rollclassTestProc(unittest.IsolatedAsyncioTestCase):
asyncdefasyncSetUp(self):
self.port=create_free_port()
self.proc=awaitasyncio.create_subprocess_exec(
sys.executable,
"-c", # more realistically this might be an http server or databasef"import time; print('listening on {self.port}'); import time; time.sleep(2); print('goodbye')",
)
asyncdeftestProc(self):
print(f"connecting to {self.port}")
asyncdefasyncTearDown(self):
awaitself.proc.communicate() # hangs forever on 3.11if__name__=="__main__":
unittest.main()
on python3.10 this produces:
connecting to 4
listening on 4
goodbye
.
----------------------------------------------------------------------
Ran 1 test in 2.022s
OK
on python3.11 it hangs forever in await self.proc.communicate()
changed the title [-]asyncio.Runner+PidFdChildWatcher leaves zombie processes[/-][+]asyncio.Runner+PidfdChildWatcher leaves zombie processes[/+]on Aug 12, 2022
Why the nonsense with self.port? It does not contribute to understanding the repro but adds useless detail that the reader has to understand before being able to ignore.
Activity
graingert commentedon Aug 11, 2022
#94184 would fix this specific combination. I suspect any ChildWatcher that implements
attach_loopwould be broken[-]asyncio.Runner+PidFdChildWatcher leaves zombie processes[/-][+]asyncio.Runner+PidfdChildWatcher leaves zombie processes[/+]gvanrossum commentedon Aug 12, 2022
Why the nonsense with
self.port? It does not contribute to understanding the repro but adds useless detail that the reader has to understand before being able to ignore.pythonGH-95899: fix asyncio.Runner to call set_event_loop only once (p…
GH-95899: fix asyncio.Runner to call set_event_loop only once (#95900)
GH-95899: fix asyncio.Runner to call set_event_loop only once (GH-95900…