◐ Shell
clean mode source ↗

gh-94182: run the PidfdChildWatcher on the running loop by graingert · Pull Request #94184 · python/cpython

@graingert

@graingert

graingert

@graingert

graingert

@graingert

graingert

@graingert

graingert

@graingert

graingert

test_create_subprocess_fails_with_inactive_watcher was only setting
the is_active() method on the context manager not the context
manager result

graingert

otherwise it invalidates test_create_subprocess_with_pidfd

@graingert graingert marked this pull request as ready for review

June 24, 2022 08:50
…atcher-on-the-running-loop

gvanrossum

@gvanrossum

1st1

1st1 approved these changes Oct 7, 2022

1st1

1st1

@JelleZijlstra

carljm added a commit to carljm/cpython that referenced this pull request

Oct 8, 2022

carljm added a commit to carljm/cpython that referenced this pull request

Oct 9, 2022

mpage pushed a commit to mpage/cpython that referenced this pull request

Oct 11, 2022
…#94184)

There is no reason for this watcher to be attached to any particular loop.
This should make it safe to use regardless of the lifetime of the event loop running in the main thread
(relative to other loops).

Co-authored-by: Yury Selivanov <yury@edgedb.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

bdraco added a commit to bdraco/home-assistant that referenced this pull request

Feb 12, 2023
This is a backport from cpython 3.12

https://docs.python.org/3/library/asyncio-policy.html
> PidfdChildWatcher is a “Goldilocks” child watcher implementation. It doesn’t require signals or threads, doesn’t interfere with any processes launched outside the event loop, and scales linearly with the number of subprocesses launched by the event loop. The main disadvantage is that pidfds are specific to Linux, and only work on recent (5.3+) kernels.

python/cpython#98024
There are some additional fixes in cpython 3.12
in python/cpython#94184
when there is no event loop running in the main thread
but this is not a problem we have

balloob pushed a commit to home-assistant/core that referenced this pull request

Feb 12, 2023
This is a backport from cpython 3.12

https://docs.python.org/3/library/asyncio-policy.html
> PidfdChildWatcher is a “Goldilocks” child watcher implementation. It doesn’t require signals or threads, doesn’t interfere with any processes launched outside the event loop, and scales linearly with the number of subprocesses launched by the event loop. The main disadvantage is that pidfds are specific to Linux, and only work on recent (5.3+) kernels.

python/cpython#98024
There are some additional fixes in cpython 3.12
in python/cpython#94184
when there is no event loop running in the main thread
but this is not a problem we have

AlePerla pushed a commit to AlePerla/homeassistant_core that referenced this pull request

Feb 17, 2023
This is a backport from cpython 3.12

https://docs.python.org/3/library/asyncio-policy.html
> PidfdChildWatcher is a “Goldilocks” child watcher implementation. It doesn’t require signals or threads, doesn’t interfere with any processes launched outside the event loop, and scales linearly with the number of subprocesses launched by the event loop. The main disadvantage is that pidfds are specific to Linux, and only work on recent (5.3+) kernels.

python/cpython#98024
There are some additional fixes in cpython 3.12
in python/cpython#94184
when there is no event loop running in the main thread
but this is not a problem we have

@graingert graingert deleted the run-pidfdchildwatcher-on-the-running-loop branch

October 11, 2023 15:17