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

support.transient_internet() doesn't catch connection refused errors #66786

Closed
berkerpeksag opened this issue Oct 10, 2014 · 4 comments
Closed
Assignees
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@berkerpeksag
Copy link
Member

BPO 22596
Nosy @orsenthil, @vstinner, @ned-deily, @berkerpeksag
Files
  • connection-refused.diff
  • issue22596_v2.diff
  • 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/berkerpeksag'
    closed_at = <Date 2014-10-25.02:48:20.917>
    created_at = <Date 2014-10-10.10:02:10.907>
    labels = ['type-bug', 'tests']
    title = "support.transient_internet() doesn't catch connection refused errors"
    updated_at = <Date 2014-10-25.02:48:20.915>
    user = 'https://github.com/berkerpeksag'

    bugs.python.org fields:

    activity = <Date 2014-10-25.02:48:20.915>
    actor = 'berker.peksag'
    assignee = 'berker.peksag'
    closed = True
    closed_date = <Date 2014-10-25.02:48:20.917>
    closer = 'berker.peksag'
    components = ['Tests']
    creation = <Date 2014-10-10.10:02:10.907>
    creator = 'berker.peksag'
    dependencies = []
    files = ['36862', '36951']
    hgrepos = []
    issue_num = 22596
    keywords = ['patch']
    message_count = 4.0
    messages = ['228977', '229966', '229976', '229977']
    nosy_count = 5.0
    nosy_names = ['orsenthil', 'vstinner', 'ned.deily', 'python-dev', 'berker.peksag']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue22596'
    versions = ['Python 3.4', 'Python 3.5']

    @berkerpeksag
    Copy link
    Member Author

    This issue is similar to bpo-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

    @berkerpeksag berkerpeksag added tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Oct 10, 2014
    @ned-deily
    Copy link
    Member

    LGTM. Perhaps it can be committed with a revised version of the patch for bpo-22289?

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 25, 2014

    New changeset 76ef82ec80a7 by Berker Peksag in branch '3.4':
    Issue bpo-22596: support.transient_internet() now also catches
    https://hg.python.org/cpython/rev/76ef82ec80a7

    New changeset 9c35973829e6 by Berker Peksag in branch 'default':
    Issue bpo-22596: support.transient_internet() now also catches
    https://hg.python.org/cpython/rev/9c35973829e6

    @berkerpeksag
    Copy link
    Member Author

    Thanks for the review, Ned. I didn't combine the patch with bpo-22289, because I couldn't reproduce that failure easily.

    @berkerpeksag berkerpeksag self-assigned this Oct 25, 2014
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants