bpo-35621: Support running subprocesses in asyncio when loop is executed in non-main thread #14344
Merged
asvetlov merged 17 commits intopython:masterfrom Jun 30, 2019
Merged
bpo-35621: Support running subprocesses in asyncio when loop is executed in non-main thread #14344asvetlov merged 17 commits intopython:masterfrom
asvetlov merged 17 commits intopython:masterfrom
Conversation
…en loop is executed in non-main thread (python#13630)" (pythonGH-13793)" This reverts commit 9535aff.
Contributor
Author
|
I tested it with manual adding 1-second timeout in spawned waiter threads to emulate slow test machine. |
asvetlov
commented
Jun 24, 2019
| def add_child_handler(self, pid, callback, *args): | ||
| assert self._forks, "Must use the context manager" | ||
|
|
||
| if self._loop is None: |
Contributor
Author
There was a problem hiding this comment.
The check is replaced by watcher.is_active() call in subprocess transport
1st1
approved these changes
Jun 30, 2019
Member
1st1
left a comment
There was a problem hiding this comment.
LGTM overall. Thanks for pushing this through, Andrew.
Co-Authored-By: Yury Selivanov <[email protected]>
Co-Authored-By: Yury Selivanov <[email protected]>
Co-Authored-By: Yury Selivanov <[email protected]>
Co-Authored-By: Yury Selivanov <[email protected]>
Co-Authored-By: Yury Selivanov <[email protected]>
Co-Authored-By: Yury Selivanov <[email protected]>
Contributor
Author
|
Thanks for review! |
Contributor
|
Thanks @asvetlov for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8. |
|
GH-14484 is a backport of this pull request to the 3.8 branch. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jun 30, 2019
…ted in non-main thread (pythonGH-14344) (cherry picked from commit 0d671c0) Co-authored-by: Andrew Svetlov <[email protected]>
miss-islington
added a commit
that referenced
this pull request
Jun 30, 2019
…ted in non-main thread (GH-14344) (cherry picked from commit 0d671c0) Co-authored-by: Andrew Svetlov <[email protected]>
lisroach
pushed a commit
to lisroach/cpython
that referenced
this pull request
Sep 10, 2019
…ted in non-main thread (pythonGH-14344)
DinoV
pushed a commit
to DinoV/cpython
that referenced
this pull request
Jan 14, 2020
…ted in non-main thread (pythonGH-14344)
5 tasks
webknjaz
added a commit
to aio-libs/aiohttp
that referenced
this pull request
Jul 7, 2021
PR #5862 Refs: * pytest-dev/pytest-xdist#620 * https://stackoverflow.com/a/58614689/595220 * https://bugs.python.org/issue35621 * python/cpython#14344 * https://docs.python.org/3/library/asyncio-policy.html#asyncio.MultiLoopChildWatcher Co-authored-by: Sviatoslav Sydorenko <[email protected]>
patchback bot
pushed a commit
to aio-libs/aiohttp
that referenced
this pull request
Jul 7, 2021
PR #5862 Refs: * pytest-dev/pytest-xdist#620 * https://stackoverflow.com/a/58614689/595220 * https://bugs.python.org/issue35621 * python/cpython#14344 * https://docs.python.org/3/library/asyncio-policy.html#asyncio.MultiLoopChildWatcher Co-authored-by: Sviatoslav Sydorenko <[email protected]> (cherry picked from commit 7080a8b)
link2xt
added a commit
to chatmail/core
that referenced
this pull request
May 19, 2023
With Python 3.7 asynchronous tests randomly fail with "RuntimeError: Event loop is closed" during shutdown. Backtrace of the error includes `SafeChildWatcher` calls. Python 3.8 has replaced `SafeChildWatcher` with a new `ThreadedChildWatcher` by default [1] as a bugfix for "asyncio.create_subprocess_exec() only works with main event loop" bug [2]. Python 3.7 scheduled end of life is 2023-06-27 according to <https://devguide.python.org/versions/>. [1] python/cpython#14344 [2] https://bugs.python.org/issue35621
link2xt
added a commit
to chatmail/core
that referenced
this pull request
May 19, 2023
With Python 3.7 asynchronous tests randomly fail with "RuntimeError: Event loop is closed" during shutdown. Backtrace of the error includes `SafeChildWatcher` calls. Python 3.8 has replaced `SafeChildWatcher` with a new `ThreadedChildWatcher` by default [1] as a bugfix for "asyncio.create_subprocess_exec() only works with main event loop" bug [2]. Python 3.7 scheduled end of life is 2023-06-27 according to <https://devguide.python.org/versions/>. [1] python/cpython#14344 [2] https://bugs.python.org/issue35621
link2xt
added a commit
to chatmail/core
that referenced
this pull request
May 20, 2023
With Python 3.7 asynchronous tests randomly fail with "RuntimeError: Event loop is closed" during shutdown. Backtrace of the error includes `SafeChildWatcher` calls. Python 3.8 has replaced `SafeChildWatcher` with a new `ThreadedChildWatcher` by default [1] as a bugfix for "asyncio.create_subprocess_exec() only works with main event loop" bug [2]. Python 3.7 scheduled end of life is 2023-06-27 according to <https://devguide.python.org/versions/>. [1] python/cpython#14344 [2] https://bugs.python.org/issue35621
link2xt
added a commit
to chatmail/core
that referenced
this pull request
May 21, 2023
With Python 3.7 asynchronous tests randomly fail with "RuntimeError: Event loop is closed" during shutdown. Backtrace of the error includes `SafeChildWatcher` calls. Python 3.8 has replaced `SafeChildWatcher` with a new `ThreadedChildWatcher` by default [1] as a bugfix for "asyncio.create_subprocess_exec() only works with main event loop" bug [2]. Python 3.7 scheduled end of life is 2023-06-27 according to <https://devguide.python.org/versions/>. [1] python/cpython#14344 [2] https://bugs.python.org/issue35621
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The resurrection of #13630
Now without dangling threads in tests :)
https://bugs.python.org/issue35621