Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-94182: run the PidfdChildWatcher on the running loop#94184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@graingert
Copy link
Contributor

@graingertgraingert commentedJun 23, 2022
edited by bedevere-bot
Loading



classGenericWatcherTests:
classGenericWatcherTests(test_utils.TestCase):
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

this test wasn't enabled?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I split this fix out, so this PR is easier to review:#95009


asyncdefexecute():
watcher=mock.create_authspec(asyncio.AbstractChildWatcher)
watcher.is_active.return_value=False
Copy link
ContributorAuthor

@graingertgraingertJun 24, 2022
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

this was patching the wrong attribute - asyncio callsasyncio.get_child_watcher().__enter__().is_active()

graingertand others added2 commitsJune 24, 2022 09:10
otherwise it invalidates test_create_subprocess_with_pidfd
@graingertgraingert marked this pull request as ready for reviewJune 24, 2022 08:50
@graingert
Copy link
ContributorAuthor

@asvetlov can I get a review on this please?

@gvanrossumgvanrossum self-requested a review as acode ownerOctober 7, 2022 18:55
Copy link
Member

@gvanrossumgvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM. We'll probably merge this ASAP.



@functools.cache
def_has_pidfd_support():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This same function is also introduced by@kumaraditya303's PRGH-98024 (which uses PidfdChildWatcher when supported). I propose to refactor things so that everything uses Kumar's version. We can do that in Kumar's PR once this PR is merged.

def_do_wait(self,pid):
pidfd,callback,args=self._callbacks.pop(pid)
self._loop._remove_reader(pidfd)
def_do_wait(self,pid,pidfd,callback,args):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Curious why we can't pass the loop as an argument as well? (Though maybe that creates an unhealthy self-reference to the loop.)

@gvanrossum
Copy link
Member

(Waiting for@1st1 review and passing tests.)

@gvanrossum
Copy link
Member

Not sure what's wrong with the docs build.

@1st1
Copy link
Member

1st1 commentedOct 7, 2022

Not sure what's wrong with the docs build.

I've fixed it.

@1st1
Copy link
Member

1st1 commentedOct 7, 2022

I've fixed it.

Reverted the "fix" because apparently it was caused by an unrelated commit in main.

@JelleZijlstraJelleZijlstra self-assigned thisOct 7, 2022
@JelleZijlstra
Copy link
Member

I can take care of getting CI green and hitting the merge button here.

@1st1
Copy link
Member

1st1 commentedOct 7, 2022

I can take care of getting CI green and hitting the merge button here.

Please do. You might need to rebase this PR to the latest main.

JelleZijlstra reacted with thumbs up emoji

@gvanrossum
Copy link
Member

The macOS build hit some GitHub Actions limit. I'm going to merge without waiting for it.

@gvanrossumgvanrossum merged commit3d8b224 intopython:mainOct 8, 2022
carljm added a commit to carljm/cpython that referenced this pull requestOct 8, 2022
* main:pythongh-68686: Retire eptag ptag scripts (python#98064)pythongh-97922: Run the GC only on eval breaker (python#97920)  GitHub Workflows security hardening (python#96492)  Add `@ezio-melotti` as codeowner for `.github/`. (python#98079)pythongh-97913 Docs: Add walrus operator to the index (python#97921)  [doc] Fix broken links to C extensions accelerating stdlib modules (python#96914)pythongh-97822: Fix http.server documentation reference to test() function (python#98027)pythongh-91052: Add PyDict_Unwatch for unwatching a dictionary (python#98055)pythonGH-98023: Change default child watcher to PidfdChildWatcher on supported systems (python#98024)pythonGH-94182: Run the PidfdChildWatcher on the running loop (python#94184)
carljm added a commit to carljm/cpython that referenced this pull requestOct 9, 2022
* main: (5519 commits)  Minor edits to the Descriptor HowTo Guide (pythonGH-24901)  Fix link to Lifecycle of a Pull Request in CONTRIBUTING (python#98102)pythonGH-94597: deprecate `SafeChildWatcher`, `FastChildWatcher` and `MultiLoopChildWatcher` child watchers  (python#98089)  Auto-cancel old builds when new commit pushed to branch (python#98009)pythongh-95011: Migrate syslog module to Argument Clinic (pythonGH-95012)pythongh-68686: Retire eptag ptag scripts (python#98064)pythongh-97922: Run the GC only on eval breaker (python#97920)  GitHub Workflows security hardening (python#96492)  Add `@ezio-melotti` as codeowner for `.github/`. (python#98079)pythongh-97913 Docs: Add walrus operator to the index (python#97921)  [doc] Fix broken links to C extensions accelerating stdlib modules (python#96914)pythongh-97822: Fix http.server documentation reference to test() function (python#98027)pythongh-91052: Add PyDict_Unwatch for unwatching a dictionary (python#98055)pythonGH-98023: Change default child watcher to PidfdChildWatcher on supported systems (python#98024)pythonGH-94182: Run the PidfdChildWatcher on the running loop (python#94184)pythongh-92886: make test_ast pass with -O (assertions off) (pythonGH-98058)pythongh-92886: make test_coroutines pass with -O (assertions off) (pythonGH-98060)pythongh-57179: Add note on symlinks for os.walk (python#94799)pythongh-94808: Fix regex on exotic platforms (python#98036)pythongh-90085: Remove vestigial -t and -c timeit options (python#94941)  ...
mpage pushed a commit to mpage/cpython that referenced this pull requestOct 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 requestFeb 12, 2023
This is a backport from cpython 3.12https://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#98024There are some additional fixes in cpython 3.12inpython/cpython#94184when there is no event loop running in the main threadbut this is not a problem we have
balloob pushed a commit to home-assistant/core that referenced this pull requestFeb 12, 2023
This is a backport from cpython 3.12https://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#98024There are some additional fixes in cpython 3.12inpython/cpython#94184when there is no event loop running in the main threadbut this is not a problem we have
AlePerla pushed a commit to AlePerla/homeassistant_core that referenced this pull requestFeb 17, 2023
This is a backport from cpython 3.12https://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#98024There are some additional fixes in cpython 3.12inpython/cpython#94184when there is no event loop running in the main threadbut this is not a problem we have
@graingertgraingert deleted the run-pidfdchildwatcher-on-the-running-loop branchOctober 11, 2023 15:17
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@1st11st11st1 approved these changes

@gvanrossumgvanrossumgvanrossum approved these changes

@asvetlovasvetlovAwaiting requested review from asvetlovasvetlov is a code owner

+1 more reviewer

@agronholmagronholmagronholm requested changes

Reviewers whose approvals may not affect merge requirements

Assignees

@JelleZijlstraJelleZijlstra

Labels

3.10only security fixes3.11only security fixes3.12only security fixes

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@graingert@gvanrossum@1st1@JelleZijlstra@agronholm@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp