This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_socket testFDPassEmpty fails on OS X 10.11+ with "Cannot allocate memory"
Type: Stage: needs patch
Components: macOS Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: ned.deily Nosy List: baikie, jramnani, ned.deily, python-dev, ronaldoussoren, vstinner
Priority: normal Keywords: patch

Created on 2015-07-26 07:35 by ned.deily, last changed 2022-04-11 14:58 by admin.

Files
File name Uploaded Description Edit
issue-24725.patch jramnani, 2015-11-18 16:44 review
repro.c ronaldoussoren, 2020-10-19 20:27
Pull Requests
URL Status Linked Edit
PR 1427 merged vstinner, 2017-05-03 10:16
Messages (10)
msg247414 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-07-26 07:35
======================================================================
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 Issue12958).  Probably need to open a RADAR.
msg247416 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2015-07-26 08:52
I agree this needs a radar when it works on older releases of the OS and not on the 10.11 beta's.
msg254848 - (view) Author: Jeff Ramnani (jramnani) * Date: 2015-11-18 16:44
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 #12958.
msg257153 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-12-29 01:18
New changeset b4c6631737b3 by Brett Cannon in branch 'default':
Issue #24725: Skip the test_socket.testFDPassEmpty on OS X.
https://hg.python.org/cpython/rev/b4c6631737b3
msg257154 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2015-12-29 01:18
Thanks for  the patch, Jeff!
msg284474 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2017-01-02 08:09
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.
msg292893 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-05-03 12:11
New changeset 5e9c1101924bacf3ead03124b5c1e48551638360 by Victor Stinner in branch '3.5':
bpo-24725: Skip the test_socket.testFDPassEmpty on OS X (#1427)
https://github.com/python/cpython/commit/5e9c1101924bacf3ead03124b5c1e48551638360
msg301916 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-09-11 22:12
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?
msg379009 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-10-19 20:27
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 :-)
msg407385 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2021-11-30 16:44
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.
History
Date User Action Args
2022-04-11 14:58:19adminsetgithub: 68913
2021-11-30 16:44:35ronaldoussorensetmessages: + msg407385
2020-10-19 20:27:56ronaldoussorensetfiles: + repro.c

messages: + msg379009
versions: + Python 3.8, Python 3.9, Python 3.10, - Python 3.5
2020-06-05 19:26:42brett.cannonsetnosy: - brett.cannon
2017-09-11 22:12:19vstinnersetmessages: + msg301916
2017-05-03 12:11:37vstinnersetnosy: + vstinner
messages: + msg292893
2017-05-03 10:17:00vstinnerlinkissue30201 superseder
2017-05-03 10:16:42vstinnersetpull_requests: + pull_request1532
2017-01-02 08:09:54ned.deilysetstatus: closed -> open

assignee: ned.deily
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"
resolution: fixed ->
versions: - Python 3.4
messages: + msg284474
stage: resolved -> needs patch
2015-12-29 01:18:49brett.cannonsetstatus: open -> closed
resolution: fixed
messages: + msg257154

stage: resolved
2015-12-29 01:18:31python-devsetnosy: + python-dev
messages: + msg257153
2015-12-27 21:07:58brett.cannonsetnosy: + brett.cannon
2015-11-18 16:44:18jramnanisetfiles: + issue-24725.patch

nosy: + jramnani
messages: + msg254848

keywords: + patch
2015-08-02 20:43:32baikiesetnosy: + baikie
2015-07-26 08:52:38ronaldoussorensetmessages: + msg247416
2015-07-26 07:35:31ned.deilycreate