Opened 15 years ago

Closed 14 years ago

Last modified 4 years ago

#18376 closed defect (fixed)

Remedy socket 35 errors on all Python builds

Reported by: ben@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 1.7.0
Keywords: python, socket Cc: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), skymoo (Adam Mercer), blb@…, mww@…, nicdumz@…, cooljeanius (Eric Gallager), grimreaper (Eitan Adler)
Port: python24 python25 python26 python30

Description

OSX's poll is broken. Apple knows this, and removes the HAVE_POLL option as can be seen in the first line of the pyconfig patch here:

http://www.opensource.apple.com/darwinsource/10.5.6/python-30.1.2/fix/pyconfig.ed

This patch should be applied to all Python builds that MacPorts supports, as it fixes a nasty bug that is being mis-reported all over the place on OSX. Here's one such example of a traceback caused by it:

File "../uploader.py", line 94, in <module>
   resp, data = http.request(post_uri, 'POST', body=content, headers=headers)
 File "build/bdist.macosx-10.5-i386/egg/httplib2/__init__.py", line 1050, in request
 File "build/bdist.macosx-10.5-i386/egg/httplib2/__init__.py", line 854, in _request
 File "build/bdist.macosx-10.5-i386/egg/httplib2/__init__.py", line 823, in _conn_request
 File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 874, in request
   self._send_request(method, url, body, headers)
 File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 914, in _send_request
   self.send(body)
 File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 719, in send
   self.sock.sendall(str)
 File "<string>", line 1, in sendall
socket.error: [Errno 35] Resource temporarily unavailable

And another report caused by the same problem: http://www.cherrypy.org/ticket/598

Applying the same regexp that Apple does, fixes the problem in my tests.

Credit for finding this bug and its solution should be attributed to Phil Jenvey, I merely bugged him until he found the problem for me. :)

Change History (14)

comment:1 Changed 15 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Cc: mcalhoun@… added

Cc Me!

comment:2 Changed 15 years ago by ben@…

This should be clarified, its not 'broken' per se, but merely returns an EAGAIN error rather frequently causing the socket issue, which very very rarely occurs on other platforms. This causes a decent amount of Python code, including httplib2, to throw up the socket 35 error.

comment:3 Changed 15 years ago by skymoo (Adam Mercer)

Cc: ram@… added

Cc Me!

comment:4 Changed 15 years ago by jmroot (Joshua Root)

Cc: blb@… mww@… added

comment:5 Changed 15 years ago by blb@…

Port: python24 python25 python26 python30 added

python26 fixed in r48182.

comment:6 Changed 15 years ago by blb@…

python24 fixed in r48185.

comment:7 Changed 15 years ago by blb@…

python30 fixed in r48187.

comment:8 Changed 15 years ago by nicdumz@…

Cc: nicdumz@… added

Cc Me!

comment:9 Changed 15 years ago by (none)

Milestone: Port Bugs

Milestone Port Bugs deleted

comment:10 Changed 15 years ago by tobypeterson

Priority: HighNormal

comment:11 Changed 14 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: newclosed

Applied to python25 in r60380.

comment:12 Changed 11 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:13 Changed 11 years ago by cooljeanius (Eric Gallager)

Out of curiosity, could depending on the port poll-emulator and using its poll implementation instead be another way of getting around this issue?

comment:14 Changed 4 years ago by grimreaper (Eitan Adler)

Cc: grimreaper added
Note: See TracTickets for help on using tickets.