Andrew Svetlov <andrew.svet...@gmail.com> added the comment:

ThreadedChildWatcher starts a thread per process but has O(1) complexity.

MultiLoopChildWatcher doesn't spawn threads, it can be used safely with asyncio 
loops spawn in multiple threads. The complexity is O(N) plus no other code 
should contest for SIG_CHLD subscription.

FastChildWatcher has O(1), this is the good news. All others are bad: the 
watcher conflicts even with blocking `subprocess.wait()` call, even if the call 
is performed from another thread.

SafeChildWatcher is safer than FastChildWatcher but working with asyncio 
subprocess API is still super complicated if asyncio code is running from 
multiple threads. SafeChildWatcher works well only if asyncio is run from the 
main thread only. Complexity is O(N).

I think FastChildWatcher and SafeChildWatcher should go, ThreadedChildWatcher 
should be kept default and MultiLoopChildWatcher is an option where 
ThreadedChildWatcher is not satisfactory.

MultiLoopChildWatcher problems can and should be fixed; there is nothing bad in 
the idea but slightly imperfect implementation.

Regarding pidfd and kqueue -- I love to see pull requests with proposals. Now 
nothing exists.
The pidfd is available starting from the latest released Linux 5.3;  we need to 
wait for a decade before all Linux distros adopt it and we can drop all other 
implementations.

----------

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

Reply via email to