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-104372: Drop the GIL around the vfork() call.#104782

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

Merged

Conversation

gpshead
Copy link
Member

@gpsheadgpshead commentedMay 23, 2023
edited by bedevere-bot
Loading

On Linux where thesubprocess module can use thevfork syscall for faster spawning, prevent the parent process from blocking other threads by dropping the GIL while it waits for the vfork'ed child processexec outcome. This prevents spawning a binary from a slow filesystem from blocking the rest of the application.

Fixes#104372.

On Linux where the `subprocess` module can use the `vfork` syscall forfaster spawning, prevent the parent process from blocking other threadsby dropping the GIL while it waits for the vfork'ed child process `exec`outcome.  This prevents spawning a binary from a slow filesystem fromblocking the rest of the application.Fixespython#104372.
@gpshead
Copy link
MemberAuthor

gpshead commentedMay 23, 2023
edited
Loading

This PR is preferred over#104515 as it does not rely on undefined behavior magic cross-process address space sharing shenanigans.

Pre-requisites:#104518 +#104697 to make the post vfork code safe for use without the GIL.

@gpsheadgpshead added needs backport to 3.11only security fixes needs backport to 3.12only security fixes labelsMay 23, 2023
@ghost
Copy link

ghost commentedMay 24, 2023
edited by ghost
Loading

All commit authors signed the Contributor License Agreement.
CLA signed

@gpsheadgpshead requested review fromYhg1s andvstinnerMay 24, 2023 08:13
@gpsheadgpshead marked this pull request as ready for reviewMay 24, 2023 08:14
@gpsheadgpsheadenabled auto-merge (squash)May 25, 2023 19:53
@gpsheadgpshead merged commitd086792 intopython:mainMay 25, 2023
@miss-islington
Copy link
Contributor

Thanks@gpshead for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry,@gpshead, I could not cleanly backport this to3.11 due to a conflict.
Please backport usingcherry_picker on command line.
cherry_picker d08679212d9af52dd074cd4a6abb440edb944c9c 3.11

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMay 25, 2023
On Linux where the `subprocess` module can use the `vfork` syscall forfaster spawning, prevent the parent process from blocking other threadsby dropping the GIL while it waits for the vfork'ed child process `exec`outcome.  This prevents spawning a binary from a slow filesystem fromblocking the rest of the application.FixespythonGH-104372.(cherry picked from commitd086792)Co-authored-by: Gregory P. Smith <gps@python.org>
@bedevere-bot
Copy link

GH-104942 is a backport of this pull request to the3.12 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.12only security fixes labelMay 25, 2023
@gpsheadgpshead deleted the subprocess-drop-gil-before-vfork branchMay 25, 2023 20:15
gpshead added a commit that referenced this pull requestMay 25, 2023
…104942)gh-104372: Drop the GIL around the vfork() call. (GH-104782)On Linux where the `subprocess` module can use the `vfork` syscall forfaster spawning, prevent the parent process from blocking other threadsby dropping the GIL while it waits for the vfork'ed child process `exec`outcome.  This prevents spawning a binary from a slow filesystem fromblocking the rest of the application.FixesGH-104372.(cherry picked from commitd086792)Co-authored-by: Gregory P. Smith <gps@python.org>
gpshead added a commit to gpshead/cpython that referenced this pull requestMay 26, 2023
On Linux where the `subprocess` module can use the `vfork` syscall forfaster spawning, prevent the parent process from blocking other threadsby dropping the GIL while it waits for the vfork'ed child process `exec`outcome.  This prevents spawning a binary from a slow filesystem fromblocking the rest of the application.Fixespython#104372.(cherry picked from commitd086792)
@bedevere-bot
Copy link

GH-104958 is a backport of this pull request to the3.11 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.11only security fixes labelMay 26, 2023
gpshead added a commit that referenced this pull requestSep 1, 2023
…04958)gh-104372: Drop the GIL around the vfork() call. (#104782)On Linux where the `subprocess` module can use the `vfork` syscall forfaster spawning, prevent the parent process from blocking other threadsby dropping the GIL while it waits for the vfork'ed child process `exec`outcome.  This prevents spawning a binary from a slow filesystem fromblocking the rest of the application.Fixes#104372.(cherry picked from commitd086792)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@Yhg1sYhg1sYhg1s approved these changes

@vstinnervstinnerAwaiting requested review from vstinner

Assignees

@gpsheadgpshead

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

subprocess can block all Python threads when usingvfork() until the child processexec() succeeds or fails.
4 participants
@gpshead@miss-islington@bedevere-bot@Yhg1s

[8]ページ先頭

©2009-2025 Movatter.jp