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-91401: Add a failsafe way to disable vfork.#91490

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
gpshead merged 5 commits intopython:mainfromgpshead:vfork-monsters
Apr 25, 2022

Conversation

gpshead
Copy link
Member

Just in case there is ever an issue with_posixsubprocess's use of
vfork() due to the complexity of using it properly and potential
directions that Linux platforms where it defaults to on could take, this
adds a failsafe so that users can disable its use entirely by setting
a global flag.

No known reason to disable it exists. But it'd be a shame to encounter
one and not be able to use CPython without patching and rebuilding it.

See the linked issue for some discussion on reasoning.

Just in case there is ever an issue with _posixsubprocess's use ofvfork() due to the complexity of using it properly and potentialdirections that Linux platforms where it defaults to on could take, thisadds a failsafe so that users can disable its use entirely by settinga global flag.No known reason to disable it exists. But it'd be a shame to encounterone and not be able to use CPython without patching and rebuilding it.See the linked issue for some discussion on reasoning.
@gpsheadgpshead added type-bugAn unexpected behavior, bug, or error type-featureA feature request or enhancement labelsApr 13, 2022
@gpsheadgpshead self-assigned thisApr 13, 2022
@gpsheadgpshead marked this pull request as ready for reviewApril 14, 2022 22:27
@gpsheadgpshead requested a review fromvstinnerApril 14, 2022 22:27
Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

Why not a simple boolean flag?

Can subprocess disable vfork using disable_vfork_reason if vfork is not available? You can expose a simple private flag in _posixsubprocess saying if vfork is available. Something similar to _testcapi.WITH_PYMALLOC or _thread.TIMEOUT_MAX.

gpshead reacted with thumbs up emoji
@vstinner
Copy link
Member

I addedsubprocess._USE_POSIX_SPAWN so people can opt-out if they encounter problems with posix_spawn().

@gpshead
Copy link
MemberAuthor

I addedsubprocess._USE_POSIX_SPAWN so people can opt-out if they encounter problems with posix_spawn().

Being consistent with that seems worthwhile, I'll rework this PR. I expect I'm overthinking it with the whole "make it a string" thing and pleading for people to include an explanation of why.

@vstinner
Copy link
Member

I chose to add a private attribute since the default value must be safe for all users. But for the corner cases, IMO a private attribute is enough.

For vfork, well, it's up to you to add a private or public attribute.

No double negatives. Also documents _USE_POSIX_SPAWN.
Rather than re-encoding our platform selection here (configure.acand runtime logic in _posixsubprocess already does that).
@gpsheadgpshead added 3.10only security fixes needs backport to 3.10only security fixes and removed 3.10only security fixes labelsApr 25, 2022
Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

LGTM. I just have a doubt about the doc format, but you will see when it will be rendered on docs.python.org.

code.

.. versionadded:: 3.8 ``_USE_POSIX_SPAWN``
.. versionadded:: 3.11 ``_USE_VFORK``
Copy link
Member

Choose a reason for hiding this comment

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

I never tried this syntax, I don't know if it's properly rendered. You will see :-)

@gpsheadgpshead removed the needs backport to 3.10only security fixes labelApr 25, 2022
@gpsheadgpshead merged commitcd5726f intopython:mainApr 25, 2022
@gpsheadgpshead deleted the vfork-monsters branchApril 25, 2022 23:19
JelleZijlstra added a commit to python/typeshed that referenced this pull requestApr 26, 2022
Debatable whether to include these, but they are now documented:python/cpython#91490
AlexWaygood pushed a commit to python/typeshed that referenced this pull requestApr 26, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@vstinnervstinnervstinner approved these changes

Assignees

@gpsheadgpshead

Labels
type-bugAn unexpected behavior, bug, or errortype-featureA feature request or enhancement
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@gpshead@vstinner@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp