This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients gvanrossum, vstinner, yselivanov
Date 2015-01-29.11:56:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1422532609.81.0.0177270416952.issue23347@psf.upfronthosting.co.za>
In-reply-to
Content
Attached patch fix and refactors the creation of asyncio subprocess transports. It fixes the code handling errors.

Changes:

* Add a wait() method to wait until the child process exit

* The constructor now accepts an optional waiter parameter. The _post_init() coroutine must not be called explicitly anymore. It makes subprocess transports closer to other transports, and it gives more freedom if we want later to change completly how subprocess transports are created.

* close() now kills the process instead of kindly terminate it: the child process may ignore SIGTERM and continue to run. Call explicitly terminate() and wait() if you want to kindly terminate the child process.

* close() now logs a warning in debug mode if the process is still running and needs to be killed

* _make_subprocess_transport() is now fully asynchronous again: if the creation of the transport failed, wait asynchronously for the process eixt. Before the wait was synchronous. This change requires close() to *kill*, and not terminate, the child process.

* Remove the _kill_wait() method, replaced with a more agressive close() method. It fixes _make_subprocess_transport() on error. BaseSubprocessTransport.close() calls the close() method of pipe transports, whereas _kill_wait() closed directly pipes of the subprocess.Popen object without unregistering file descriptors from the selector (which caused severe bugs).

* These changes make subprocess.py much simpler!

wait() is a coroutine, which is something uncommon. Is it ok to start using coroutines in transports, at least for subprocess transports?
History
Date User Action Args
2015-01-29 11:56:50vstinnersetrecipients: + vstinner, gvanrossum, yselivanov
2015-01-29 11:56:49vstinnersetmessageid: <1422532609.81.0.0177270416952.issue23347@psf.upfronthosting.co.za>
2015-01-29 11:56:49vstinnerlinkissue23347 messages
2015-01-29 11:56:49vstinnercreate