Skip to content
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

test_socket testFDPassEmpty fails on OS X 10.11+ with "Cannot allocate memory" #68913

Open
ned-deily opened this issue Jul 26, 2015 · 12 comments
Assignees
Labels
3.8 only security fixes 3.9 only security fixes 3.10 only security fixes OS-mac

Comments

@ned-deily
Copy link
Member

BPO 24725
Nosy @ronaldoussoren, @vstinner, @ned-deily
PRs
  • bpo-24725: Skip the test_socket.testFDPassEmpty on OS X. #1427
  • Files
  • issue-24725.patch
  • repro.c
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ned-deily'
    closed_at = None
    created_at = <Date 2015-07-26.07:35:31.721>
    labels = ['OS-mac', '3.8', '3.9', '3.10']
    title = 'test_socket testFDPassEmpty fails on OS X 10.11+ with "Cannot allocate memory"'
    updated_at = <Date 2021-11-30.16:44:35.098>
    user = 'https://github.com/ned-deily'

    bugs.python.org fields:

    activity = <Date 2021-11-30.16:44:35.098>
    actor = 'ronaldoussoren'
    assignee = 'ned.deily'
    closed = False
    closed_date = None
    closer = None
    components = ['macOS']
    creation = <Date 2015-07-26.07:35:31.721>
    creator = 'ned.deily'
    dependencies = []
    files = ['41069', '49528']
    hgrepos = []
    issue_num = 24725
    keywords = ['patch']
    message_count = 10.0
    messages = ['247414', '247416', '254848', '257153', '257154', '284474', '292893', '301916', '379009', '407385']
    nosy_count = 6.0
    nosy_names = ['ronaldoussoren', 'vstinner', 'baikie', 'ned.deily', 'python-dev', 'jramnani']
    pr_nums = ['1427']
    priority = 'normal'
    resolution = None
    stage = 'needs patch'
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue24725'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    @ned-deily
    Copy link
    Member Author

    ======================================================================
    ERROR: testFDPassEmpty (test.test_socket.RecvmsgSCMRightsStreamTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/test/test_socket.py", line 2799, in testFDPassEmpty
        len(MSG), 10240),
      File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/test/test_socket.py", line 1907, in doRecvmsg
        result = sock.recvmsg(bufsize, *args)
    OSError: [Errno 12] Cannot allocate memory

    ======================================================================
    ERROR: testFDPassEmpty (test.test_socket.RecvmsgIntoSCMRightsStreamTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/test/test_socket.py", line 2799, in testFDPassEmpty
        len(MSG), 10240),
      File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/test/test_socket.py", line 1998, in doRecvmsg
        result = sock.recvmsg_into([buf], *args)
    OSError: [Errno 12] Cannot allocate memory

    Ran 507 tests in 28.819s

    FAILED (errors=2, skipped=122)
    test test_socket failed

    Same failures seen with 3.4.3 and 3.5.0b4 installers on 10.11 (El Capitan) Developer Previews 2 and 4. Passes on 10.10.x and earlier recent OS X systems. There have been other problems in this area on OS X in the past (see bpo-12958). Probably need to open a RADAR.

    @ronaldoussoren
    Copy link
    Contributor

    I agree this needs a radar when it works on older releases of the OS and not on the 10.11 beta's.

    @jramnani
    Copy link
    Mannequin

    jramnani mannequin commented Nov 18, 2015

    I'm still getting these test failures on OS X 10.11.1. Has a radar been filed with Apple? I'd submit one, but I don't know enough about the issue to create a good bug report.

    In the meantime, I'm attaching a patch to skip these tests as was done in issue bpo-12958.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Dec 29, 2015

    New changeset b4c6631737b3 by Brett Cannon in branch 'default':
    Issue bpo-24725: Skip the test_socket.testFDPassEmpty on OS X.
    https://hg.python.org/cpython/rev/b4c6631737b3

    @brettcannon
    Copy link
    Member

    Thanks for the patch, Jeff!

    @ned-deily
    Copy link
    Member Author

    This issue slipped off the radar (so to speak) after being closed. For one, the tests also fail on 3.5.x (and probably earlier systems) and fail on macOS 10.12, not just 10.11. And, two, I'm not sure if anyone opened an issue with Apple about it. I'm re-opening it and assigning it to me to address those things.

    @ned-deily ned-deily reopened this Jan 2, 2017
    @ned-deily ned-deily changed the title test_socket testFDPassEmpty fails on OS X 10.11 DP with "Cannot allocate memory" test_socket testFDPassEmpty fails on OS X 10.11+ with "Cannot allocate memory" Jan 2, 2017
    @ned-deily ned-deily self-assigned this Jan 2, 2017
    @vstinner
    Copy link
    Member

    vstinner commented May 3, 2017

    New changeset 5e9c110 by Victor Stinner in branch '3.5':
    bpo-24725: Skip the test_socket.testFDPassEmpty on OS X (bpo-1427)
    5e9c110

    @vstinner
    Copy link
    Member

    Ned Deily:

    This issue slipped off the radar (so to speak) after being closed. For one, the tests also fail on 3.5.x (and probably earlier systems) and fail on macOS 10.12, not just 10.11. And, two, I'm not sure if anyone opened an issue with Apple about it. I'm re-opening it and assigning it to me to address those things.

    Did you report the bug to Apple? Any update? Should we just close the issue?

    @ronaldoussoren
    Copy link
    Contributor

    The issue is still present with python 3.9 and macOS 10.15 as well as current macOS 11 betas.

    The following python scriptlet reproduces the issue:

    # ---

    import socket
      
    sd1, sd2 = socket.socketpair()

    sd1.sendmsg([b"hello"], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, b"")])
    sd2.recvmsg(1)
    # ---

    I think the attached file "repro.c" does the same in C, it also fails with "recvmsg: Cannot allocate memory".

    I've filed an issue for this with Apple: FB8813140. I filed it from an Arm Mac system, with some luck this will help to get attention :-)

    @ronaldoussoren ronaldoussoren added 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes labels Oct 19, 2020
    @ronaldoussoren
    Copy link
    Contributor

    The reproducer script and .c file I added earlier do not fail with "Cannot allocate memory" on macOS 12.0.1.

    I haven't checked yet if this is enough to avoid test failures in the (now skipped) testFDPassEmpty.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @ronaldoussoren
    Copy link
    Contributor

    This issue appears to be fixed in macOS 14 (haven't check macOS 13), tests pass without problems if I revert #1427 locally.

    My current plan is to test on macOS 13 as well and then create a PR that replaces the skip on macOS by requires_mac_ver(14) or requires_mac_ver(13) depending on the result.

    @vstinner
    Copy link
    Member

    vstinner commented Dec 7, 2023

    This issue appears to be fixed in macOS 14 (haven't check macOS 13), tests pass without problems if I revert #1427 locally.

    You can use @support.requires_mac_ver() decorator.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 only security fixes 3.9 only security fixes 3.10 only security fixes OS-mac
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants