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-06.00:00:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1420502445.76.0.9797827832.issue23173@psf.upfronthosting.co.za>
In-reply-to
Content
The creation of a subprocess in asyncio is complex, it is composed of multiple steps (callbacks scheduled by call_soon, coroutines, etc.). The creation can fail because of different reasons. I guess that the most common reason is a cancellation of a task, explicitly or because of a timeout (asyncio.wait_for).

I propose to ensure that everything is cleaned up on failure, especially to kill the subprocess. This choice comes from the subprocess module, it kills the subprocess on error.

Attached patch implements this change. It also fixes a bug noticed in the issue #23140: a call to waiter.set_result() in SubprocessStreamProtocol.connection_made() is not protected by a test on the future state.

When I wrote the unit tests, I tried to mock subprocess.Popen to ensure that the Popen.kill() method is called, but mocking a subprocess for asyncio is complex. I chose to keep the test simple.
History
Date User Action Args
2015-01-06 00:00:45vstinnersetrecipients: + vstinner, gvanrossum, yselivanov
2015-01-06 00:00:45vstinnersetmessageid: <1420502445.76.0.9797827832.issue23173@psf.upfronthosting.co.za>
2015-01-06 00:00:45vstinnerlinkissue23173 messages
2015-01-06 00:00:45vstinnercreate