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 cr1901
Recipients asvetlov, cr1901, paul.moore, steve.dower, tim.golden, yselivanov, zach.ware
Date 2019-06-23.22:35:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1561329346.62.0.272283503836.issue37381@roundup.psfhosted.org>
In-reply-to
Content
On Windows 7, when using ProactorEventLoop, when asyncio.subprocess.terminate is called on the last subprocess when multiple subprocesses are spawned*, the last subprocess will never exit, and the Python interpreter will never exit. 

Spawning an instance of "TASKKILL /F" to kill the subprocess, and then awaiting asyncio.subprocess.wait is a workaround. Since both "TASKKILL /F" and asyncio.subprocess.terminate ultimately call TerminateProcess, I would expect the same behavior using both (without the need to wait for the subprocess to actually die).

I have confirmed this behavior on Python 3.5, 3.6, and 3.7 on both MSVC and MinGW Python (although I most frequently use the latter).

Zip file is too large, so I have a GH repo (ready to run) demonstrating this issue: https://github.com/cr1901/proactor

An example run looks like the following:$ python3 proactor.py
Infinite Loop, Iteration 0
Finite Loop, Iteration 0
Infinite Loop, Iteration 1
Finite Loop, Iteration 1
Infinite Loop, Iteration 2
Finite Loop, Iteration 2
Finite Loop, Iteration 3
Infinite Loop, Iteration 3
Infinite Loop, Iteration 4
Task poller finished.

The interpreter hangs after the "Task poller finished." line, which makes me believe that the Python interpreter is trying and failing to cleanup resources for some reason (IOCP never completes?).

*Each subprocess is associated with its own coroutine to handle standard output.
History
Date User Action Args
2019-06-23 22:35:46cr1901setrecipients: + cr1901, paul.moore, tim.golden, asvetlov, zach.ware, yselivanov, steve.dower
2019-06-23 22:35:46cr1901setmessageid: <1561329346.62.0.272283503836.issue37381@roundup.psfhosted.org>
2019-06-23 22:35:46cr1901linkissue37381 messages
2019-06-23 22:35:46cr1901create