[New-bugs-announce] [issue35539] Cannot properly close terminated process
Hrvoje Nikšić
report at bugs.python.org
Wed Dec 19 15:35:52 EST 2018
New submission from Hrvoje Nikšić <hniksic at gmail.com>:
It seems impossible to correctly close() an asyncio Process on which terminate has been invoked. Take the following coroutine:
async def test():
proc = await asyncio.create_subprocess_shell(
"sleep 1", stdout=asyncio.subprocess.PIPE)
proc.terminate()
await proc.wait()
After running it with asyncio.run(), Python prints a warning about "Event loop is closed" exception ignored in BaseSubprocessTransport.__del__. The code does wait for the process to exit, and neither proc nor proc.stdout have a close() method, so the warning seems spurious.
Commenting out proc.terminate() makes the program finish without an exception (but then it waits for a full second, of course).
Runnable example attached.
----------
components: asyncio
files: terminate.py
messages: 332165
nosy: asvetlov, hniksic, yselivanov
priority: normal
severity: normal
status: open
title: Cannot properly close terminated process
versions: Python 3.7
Added file: https://bugs.python.org/file48008/terminate.py
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35539>
_______________________________________
More information about the New-bugs-announce
mailing list