Alan Jenkins <alan.christopher.jenk...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42110>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to