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 sourcejedi
Recipients asvetlov, sourcejedi, yselivanov
Date 2020-10-22.14:29:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1603376946.92.0.628134739178.issue42110@roundup.psfhosted.org>
In-reply-to
Content
There's one way to fix this in MultiLoopChildWatcher (but not ThreadedChildWatcher).  Make sure the waitpid() runs on the same thread that created the subprocess.  Prototype: https://github.com/sourcejedi/cpython/commit/92f979bce4582e807facb1c274a962b3caf0d2eb

The other approach would be to copy subprocess.wait(timeout) - keep waking up regularly and polling to see if the process has exited yet.

I'm not convinced ThreadedChildWatcher is fixable.  You can't call waitpid() in one thread, and let someone call kill() in a different thread.

You could try avoiding calling waitpid() until someone does `await asyncio.subprocess.Process.wait()`.  I think I didn't like it because - what happens if you cancel a wait() task?  I think you want to cancel the waitpid() so you could safely kill() again... And we don't have any way to cancel the blocking waitpid() call, at least not from python, definitely not since PEP-475.
History
Date User Action Args
2020-10-22 14:29:06sourcejedisetrecipients: + sourcejedi, asvetlov, yselivanov
2020-10-22 14:29:06sourcejedisetmessageid: <1603376946.92.0.628134739178.issue42110@roundup.psfhosted.org>
2020-10-22 14:29:06sourcejedilinkissue42110 messages
2020-10-22 14:29:06sourcejedicreate