[issue43884] Cannot cleanly kill a subprocess using high-level asyncio APIs
New submission from Ronal Abraham : There doesn't appear to be a way to prematurely kill a subprocess using the high-level asyncio subprocess APIs (https://docs.python.org/3.9/library/asyncio-subprocess.html) without getting a traceback on exit. On exit, the attached program writes the following to stderr: $ python3.9 kill_subprocess.py Exception ignored in: Traceback (most recent call last): ... raise RuntimeError('Event loop is closed') RuntimeError: Event loop is closed If I uncomment `# process._transport.close()` or comment `asyncio.sleep(1)`, the walkback disappears. (I get the same behavior in python 3.8. I haven't tried other python versions.) -- components: asyncio files: kill_subprocess.py messages: 391349 nosy: asvetlov, rabraham, yselivanov priority: normal severity: normal status: open title: Cannot cleanly kill a subprocess using high-level asyncio APIs type: behavior versions: Python 3.8, Python 3.9 Added file: https://bugs.python.org/file49965/kill_subprocess.py ___ Python tracker <https://bugs.python.org/issue43884> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43884] Cannot cleanly kill a subprocess using high-level asyncio APIs
Ronal Abraham added the comment: Reproducing the program here: import asyncio async def test(): process = await asyncio.create_subprocess_shell( "sleep 2 && echo done", stdout=asyncio.subprocess.PIPE, ) await asyncio.sleep(1) process.kill() await process.wait() # process._transport.close() asyncio.run(test()) Can I use the high-level API to kill a subprocess cleanly without having to access the protected member process._transport? Seems like an oversight perhaps? -- ___ Python tracker <https://bugs.python.org/issue43884> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43884] Cannot cleanly kill a subprocess using high-level asyncio APIs
Ronal Abraham added the comment: I see this on MacOS and Linux, but I suspect any Unix-like system would have the same behavior. -- ___ Python tracker <https://bugs.python.org/issue43884> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35332] shutil.rmtree(..., ignore_errors=True) doesn't ignore errors from os.close()
New submission from Ronal Abraham : These lines throw intermittently for me on AIX when removing a directory on NFS (python version 3.6.6-1), even when "ignore_errors=True": https://github.com/python/cpython/blob/v3.6.6rc1/Lib/shutil.py#L433 https://github.com/python/cpython/blob/v3.6.6rc1/Lib/shutil.py#L492 Should there be try-except blocks around these lines and calls to onerror(...)? -- components: Library (Lib) messages: 330553 nosy: rabraham priority: normal severity: normal status: open title: shutil.rmtree(..., ignore_errors=True) doesn't ignore errors from os.close() type: behavior versions: Python 3.6, Python 3.7, Python 3.8 ___ Python tracker <https://bugs.python.org/issue35332> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35332] shutil.rmtree(..., ignore_errors=True) doesn't ignore errors from os.close()
Ronal Abraham added the comment: I forgot to mention: the exception raised is an OSError and the errno is 52 (ESTALE on AIX). -- ___ Python tracker <https://bugs.python.org/issue35332> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com