Skip to content

gh-105912: document gotcha with using os.fork on macOS #112871

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 14, 2023

Conversation

ronaldoussoren
Copy link
Contributor

@ronaldoussoren ronaldoussoren commented Dec 8, 2023

Using fork(2) on macOS when also using higher-level system APIs in the parent proces can crash on macOS because those system APIs are not written to handle this usage pattern.

There's nothing we can do about this other than documenting the problem.


📚 Documentation preview 📚: https://cpython-previews--112871.org.readthedocs.build/

Using ``fork(2)`` on macOS when also using higher-level
system APIs in the parent proces can crash on macOS because
those system APIs are not written to handle this usage
pattern.

There's nothing we can do about this other than documenting
the problem.
@ronaldoussoren
Copy link
Contributor Author

ronaldoussoren commented Dec 8, 2023

I'm not entirely happy about using "unsafe" as the description, but I'm not sure about a better alternative that doesn't use a lot more text.

This also replicates part of the text in the versionchanged:: 3.12 block for os.fork, which is also pretty vague about the issues on macOS.

Copy link
Contributor

@willingc willingc left a comment

Choose a reason for hiding this comment

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

I agree with you @ronaldoussoren about not being completely happy with "unsafe". I can't think of a way of succinctly stating this without talking about parent and child processes on macOS.

Going to merge since this at least flags the gotcha.

@ronaldoussoren ronaldoussoren added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Dec 14, 2023
@ronaldoussoren ronaldoussoren merged commit 22511f7 into python:main Dec 14, 2023
@miss-islington-app
Copy link

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

@ronaldoussoren ronaldoussoren deleted the gh-105912 branch December 14, 2023 19:14
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 14, 2023
…H-112871)

* pythongh-105912: document gotcha with using os.fork on macOS

Using ``fork(2)`` on macOS when also using higher-level
system APIs in the parent proces can crash on macOS because
those system APIs are not written to handle this usage
pattern.

There's nothing we can do about this other than documenting
the problem.

(cherry picked from commit 22511f7)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
@bedevere-app
Copy link

bedevere-app bot commented Dec 14, 2023

GH-113133 is a backport of this pull request to the 3.12 branch.

@miss-islington-app
Copy link

Sorry, @ronaldoussoren, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 22511f77c2818a138a252e6ddae89725d082f8b0 3.11

@bedevere-app
Copy link

bedevere-app bot commented Dec 14, 2023

GH-113135 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Dec 14, 2023
corona10 pushed a commit to corona10/cpython that referenced this pull request Dec 15, 2023
…112871)

* pythongh-105912: document gotcha with using os.fork on macOS

Using ``fork(2)`` on macOS when also using higher-level
system APIs in the parent proces can crash on macOS because
those system APIs are not written to handle this usage
pattern.

There's nothing we can do about this other than documenting
the problem.

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
ronaldoussoren added a commit that referenced this pull request Dec 16, 2023
) (#113133)

gh-105912: document gotcha with using os.fork on macOS (GH-112871)

* gh-105912: document gotcha with using os.fork on macOS

Using ``fork(2)`` on macOS when also using higher-level
system APIs in the parent proces can crash on macOS because
those system APIs are not written to handle this usage
pattern.

There's nothing we can do about this other than documenting
the problem.

(cherry picked from commit 22511f7)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
ronaldoussoren added a commit that referenced this pull request Dec 16, 2023
) (#113135)

* gh-105912: document gotcha with using os.fork on macOS

Using ``fork(2)`` on macOS when also using higher-level
system APIs in the parent proces can crash on macOS because
those system APIs are not written to handle this usage
pattern.

There's nothing we can do about this other than documenting
the problem.

(cherry picked from commit 22511f7)

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
…112871)

* pythongh-105912: document gotcha with using os.fork on macOS

Using ``fork(2)`` on macOS when also using higher-level
system APIs in the parent proces can crash on macOS because
those system APIs are not written to handle this usage
pattern.

There's nothing we can do about this other than documenting
the problem.

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
…112871)

* pythongh-105912: document gotcha with using os.fork on macOS

Using ``fork(2)`` on macOS when also using higher-level
system APIs in the parent proces can crash on macOS because
those system APIs are not written to handle this usage
pattern.

There's nothing we can do about this other than documenting
the problem.

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir OS-mac skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants