classification
Title: support.transient_internet() doesn't catch connection refused errors
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: berker.peksag Nosy List: berker.peksag, ned.deily, orsenthil, python-dev, vstinner
Priority: normal Keywords: patch

Created on 2014-10-10 10:02 by berker.peksag, last changed 2014-10-25 02:48 by berker.peksag. This issue is now closed.

Files
File name Uploaded Description Edit
connection-refused.diff berker.peksag, 2014-10-10 10:02 review
issue22596_v2.diff berker.peksag, 2014-10-16 21:18 review
Messages (4)
msg228977 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2014-10-10 10:02
This issue is similar to issue 22289.

======================================================================
ERROR: test_ftp (test.test_urllib2net.OtherNetworkTests) (url='ftp://ftp.debian.org/debian/README')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 1399, in ftp_open
    fw = self.connect_ftp(user, passwd, host, port, dirs, req.timeout)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 1445, in connect_ftp
    dirs, timeout)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 2243, in __init__
    self.init()
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 2249, in init
    self.ftp.connect(self.host, self.port, self.timeout)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/ftplib.py", line 153, in connect
    source_address=self.source_address)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/socket.py", line 655, in create_connection
    raise err
  File "/opt/python/3.x.langa-ubuntu/build/Lib/socket.py", line 646, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/python/3.x.langa-ubuntu/build/Lib/test/test_urllib2net.py", line 226, in _test_urls
    f = urlopen(url, req, TIMEOUT)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/test/test_urllib2net.py", line 33, in wrapped
    return _retry_thrice(func, exc, *args, **kwargs)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/test/test_urllib2net.py", line 29, in _retry_thrice
    raise last_exc
  File "/opt/python/3.x.langa-ubuntu/build/Lib/test/test_urllib2net.py", line 23, in _retry_thrice
    return func(*args, **kwargs)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 463, in open
    response = self._open(req, data)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 481, in _open
    '_open', req)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 441, in _call_chain
    result = func(*args)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 1417, in ftp_open
    raise exc.with_traceback(sys.exc_info()[2])
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 1399, in ftp_open
    fw = self.connect_ftp(user, passwd, host, port, dirs, req.timeout)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 1445, in connect_ftp
    dirs, timeout)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 2243, in __init__
    self.init()
  File "/opt/python/3.x.langa-ubuntu/build/Lib/urllib/request.py", line 2249, in init
    self.ftp.connect(self.host, self.port, self.timeout)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/ftplib.py", line 153, in connect
    source_address=self.source_address)
  File "/opt/python/3.x.langa-ubuntu/build/Lib/socket.py", line 655, in create_connection
    raise err
  File "/opt/python/3.x.langa-ubuntu/build/Lib/socket.py", line 646, in create_connection
    sock.connect(sa)
urllib.error.URLError: <urlopen error ftp error: ConnectionRefusedError(111, 'Connection refused')>

http://buildbot.python.org/all/builders/AMD64%20Ubuntu%20LTS%203.x/builds/5026/steps/test/logs/stdio
msg229966 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-10-24 22:46
LGTM.  Perhaps it can be committed with a revised version of the patch for Issue22289?
msg229976 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-10-25 02:41
New changeset 76ef82ec80a7 by Berker Peksag in branch '3.4':
Issue #22596: support.transient_internet() now also catches
https://hg.python.org/cpython/rev/76ef82ec80a7

New changeset 9c35973829e6 by Berker Peksag in branch 'default':
Issue #22596: support.transient_internet() now also catches
https://hg.python.org/cpython/rev/9c35973829e6
msg229977 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2014-10-25 02:48
Thanks for the review, Ned. I didn't combine the patch with issue 22289, because I couldn't reproduce that failure easily.
History
Date User Action Args
2014-10-25 02:48:20berker.peksagsetstatus: open -> closed
messages: + msg229977

assignee: berker.peksag
resolution: fixed
stage: patch review -> resolved
2014-10-25 02:41:58python-devsetnosy: + python-dev
messages: + msg229976
2014-10-24 22:46:27ned.deilysetnosy: + ned.deily, vstinner
messages: + msg229966
2014-10-16 21:18:56berker.peksagsetfiles: + issue22596_v2.diff
2014-10-10 10:02:10berker.peksagcreate