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_ssl failure when svn.python.org fails to resolve
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: pitrou, python-dev, r.david.murray
Priority: normal Keywords: buildbot, patch

Created on 2011-05-12 19:33 by r.david.murray, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ssl_connect_ex.patch pitrou, 2011-05-18 16:27 review
Messages (6)
msg135853 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-05-12 19:33
See

http://www.python.org/dev/buildbot/all/builders/x86%20Gentoo%203.2/builds/34/steps/test/logs/stdio

Antoine says that connect_ex should be returning an error, not None, in that situation.
msg135855 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-05-12 19:37
Judging by ssl.connect_ex's source code, this can only mean that socket.connect raised a socket error with a "None" errno...
msg135856 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-05-12 19:41
Which probably means it was a socket.timeout. When called on a non-SSL socket, connect_ex() returns 11 (EAGAIN) for timeout errors:

>>> s = socket.socket()
>>> s.settimeout(0.00001)
>>> s.connect_ex(("svn.python.org", 443))
11

But on SSL sockets, connect_ex() loses the errno (because it calls connect() on the underlying socket, not connect_ex(), and socket.timeout isn't raised with an errno):

>>> s = ssl.wrap_socket(socket.socket())
>>> s.settimeout(0.00001)
>>> print(s.connect_ex(("svn.python.org", 443)))
None
msg136251 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-05-18 16:27
Here is a patch.
msg136254 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-05-18 16:52
New changeset 019d8ccdf03b by Antoine Pitrou in branch '3.2':
Issue #12065: connect_ex() on an SSL socket now returns the original errno
http://hg.python.org/cpython/rev/019d8ccdf03b

New changeset 162ed9841f14 by Antoine Pitrou in branch 'default':
Issue #12065: connect_ex() on an SSL socket now returns the original errno
http://hg.python.org/cpython/rev/162ed9841f14
msg178408 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-12-28 18:05
New changeset 3436769a7964 by Antoine Pitrou in branch '2.7':
Backport Python 3.2 fix for issue #12065, and add another test for SSLSocket.connect_ex().
http://hg.python.org/cpython/rev/3436769a7964
History
Date User Action Args
2022-04-11 14:57:17adminsetgithub: 56274
2012-12-28 18:05:44python-devsetmessages: + msg178408
2011-05-18 16:53:36pitrousetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2011-05-18 16:52:35python-devsetnosy: + python-dev
messages: + msg136254
2011-05-18 16:27:18pitrousetfiles: + ssl_connect_ex.patch
keywords: + patch
messages: + msg136251

stage: needs patch -> patch review
2011-05-12 19:41:13pitrousetmessages: + msg135856
2011-05-12 19:37:10pitrousetmessages: + msg135855
2011-05-12 19:33:39pitrousetnosy: + pitrou

versions: + Python 3.3
2011-05-12 19:33:12r.david.murraycreate