Uh oh!
There was an error while loading. Please reload this page.
gh-109981: Fix support.fd_count() on macOS 14 - #112797
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.
vstinner
left a comment
There was a problem hiding this comment.
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".
Uh oh!
There was an error while loading. Please reload this page.
vstinner
commented
Dec 6, 2023
On FreeBSD, maybe we should try |
Co-authored-by: Victor Stinner <vstinner@python.org>
ronaldoussoren
commented
Dec 7, 2023
Good suggestions. Thanks for the review! |
ronaldoussoren
commented
Dec 7, 2023
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 <ronaldoussoren@mac.com> Co-authored-by: Victor Stinner <vstinner@python.org>
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 <ronaldoussoren@mac.com> Co-authored-by: Victor Stinner <vstinner@python.org>
…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 <ronaldoussoren@mac.com> Co-authored-by: Victor Stinner <vstinner@python.org>
…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 <ronaldoussoren@mac.com> Co-authored-by: Victor Stinner <vstinner@python.org>
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 <vstinner@python.org>
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 <vstinner@python.org>
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.