-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-109981: Fix support.fd_count() on macOS 14 #112797
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
Conversation
This fixes a crash on macOS 14 when running ``./python.exe -m test test_sax test_socket test_support``. The root cause of this is a macOS feature where file descriptors used by system libraries are guarded an will cause a hard crash when used in "user" code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but:
- I made a minor coding style suggestion.
- The PR title is misleading. What does "test crash" means? I suggest to refer to support.fd_count() instead. For example, "Fix support.fd_count() on macOS".
On FreeBSD, maybe we should try |
Co-authored-by: Victor Stinner <[email protected]>
Good suggestions. Thanks for the review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
That should be a separate issue. I cannot easily test on FreeBSD and am not a fan of debugging through CI. |
Thanks @ronaldoussoren for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
Use scanning "/dev/fd/" on macOS in support.fd_count(). That's both more efficient than scanning all possible file descriptors, and avoids crashing the interpreter when there are open "guarded" file descriptors. "Guarded" file descriptors are a macOS feature where file descriptors used by system libraries are marked and cause hard crashes when used by "user" code. (cherry picked from commit 953ee62) Co-authored-by: Ronald Oussoren <[email protected]> Co-authored-by: Victor Stinner <[email protected]>
GH-112824 is a backport of this pull request to the 3.12 branch. |
GH-112825 is a backport of this pull request to the 3.11 branch. |
Use scanning "/dev/fd/" on macOS in support.fd_count(). That's both more efficient than scanning all possible file descriptors, and avoids crashing the interpreter when there are open "guarded" file descriptors. "Guarded" file descriptors are a macOS feature where file descriptors used by system libraries are marked and cause hard crashes when used by "user" code. (cherry picked from commit 953ee62) Co-authored-by: Ronald Oussoren <[email protected]> Co-authored-by: Victor Stinner <[email protected]>
…2824) gh-109981: Fix support.fd_count() on macOS 14 (GH-112797) Use scanning "/dev/fd/" on macOS in support.fd_count(). That's both more efficient than scanning all possible file descriptors, and avoids crashing the interpreter when there are open "guarded" file descriptors. "Guarded" file descriptors are a macOS feature where file descriptors used by system libraries are marked and cause hard crashes when used by "user" code. (cherry picked from commit 953ee62) Co-authored-by: Ronald Oussoren <[email protected]> Co-authored-by: Victor Stinner <[email protected]>
…2825) gh-109981: Fix support.fd_count() on macOS 14 (GH-112797) Use scanning "/dev/fd/" on macOS in support.fd_count(). That's both more efficient than scanning all possible file descriptors, and avoids crashing the interpreter when there are open "guarded" file descriptors. "Guarded" file descriptors are a macOS feature where file descriptors used by system libraries are marked and cause hard crashes when used by "user" code. (cherry picked from commit 953ee62) Co-authored-by: Ronald Oussoren <[email protected]> Co-authored-by: Victor Stinner <[email protected]>
Use scanning "/dev/fd/" on macOS in support.fd_count(). That's both more efficient than scanning all possible file descriptors, and avoids crashing the interpreter when there are open "guarded" file descriptors. "Guarded" file descriptors are a macOS feature where file descriptors used by system libraries are marked and cause hard crashes when used by "user" code. Co-authored-by: Victor Stinner <[email protected]>
Use scanning "/dev/fd/" on macOS in support.fd_count(). That's both more efficient than scanning all possible file descriptors, and avoids crashing the interpreter when there are open "guarded" file descriptors. "Guarded" file descriptors are a macOS feature where file descriptors used by system libraries are marked and cause hard crashes when used by "user" code. Co-authored-by: Victor Stinner <[email protected]>
This fixes a crash on macOS 14 when
running
./python.exe -m test test_sax test_socket test_support
.The root cause of this is a macOS feature where file descriptors used by system libraries are guarded an will cause a hard crash when used in "user" code.