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
{{ message }}
Repository navigation
asyncio: Process must close the transport when the process exit #67431
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2015-01-15.13:36:57.010>created_at=<Date2015-01-14.23:11:18.655>labels= ['expert-asyncio']
title='asyncio: Process must close the transport when the process exit'updated_at=<Date2017-01-07.19:58:07.672>user='https://github.com/vstinner'
The asyncio.subprocess.Process class never closes the subprocess transport, whereas this transport is private.
I propose to close the transport as soon as possible: when transport.get_returncode() is called and its result is not None.
I'm not sure that it's the most efficient way to close the transport. It may be better to close the transport in the connection_lost() method of the protocol.
The patch also checks in Process.communicate() that the process is alive, and is clears the reference to the transport.
I'm not sure that it's the most efficient way to close the transport. It may be better to close the transport in the connection_lost() method of the protocol.
"process_exited", not "connection_lost".
I implemented this option which is simpler and more efficient (always and immediatly close the transport).
Clearing the reference to the transport in the Process is less important, it can be done later in a different issue/changeset. I close this issue.
Activity
vstinner commentedon Jan 14, 2015
The asyncio.subprocess.Process class never closes the subprocess transport, whereas this transport is private.
I propose to close the transport as soon as possible: when transport.get_returncode() is called and its result is not None.
I'm not sure that it's the most efficient way to close the transport. It may be better to close the transport in the connection_lost() method of the protocol.
The patch also checks in Process.communicate() that the process is alive, and is clears the reference to the transport.
python-dev commentedon Jan 15, 2015
New changeset df493e9c6821 by Victor Stinner in branch '3.4':
Issue bpo-23242: asyncio.SubprocessStreamProtocol now closes the subprocess
https://hg.python.org/cpython/rev/df493e9c6821
vstinner commentedon Jan 15, 2015
"process_exited", not "connection_lost".
I implemented this option which is simpler and more efficient (always and immediatly close the transport).
Clearing the reference to the transport in the Process is less important, it can be done later in a different issue/changeset. I close this issue.
agronholm commentedon Jan 7, 2017
Are you sure this has been fixed? The attached script reproduces the bug 100% reliably on my laptop.