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 asvetlov
Recipients aeros, asvetlov, vstinner, yselivanov
Date 2019-10-25.22:05:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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.
Date User Action Args
2019-10-25 22:05:39asvetlovsetrecipients: + asvetlov, vstinner, yselivanov, aeros
2019-10-25 22:05:39asvetlovsetmessageid: <>
2019-10-25 22:05:39asvetlovlinkissue38591 messages
2019-10-25 22:05:39asvetlovcreate