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

test_urllib fail in s390x buildbots: http://www.example.com/ #80200

Closed
pablogsal opened this issue Feb 18, 2019 · 22 comments
Closed

test_urllib fail in s390x buildbots: http://www.example.com/ #80200

pablogsal opened this issue Feb 18, 2019 · 22 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes tests Tests in the Lib/test dir

Comments

@pablogsal
Copy link
Member

BPO 36019
Nosy @vstinner, @matrixise, @pablogsal, @miss-islington, @sobolevn
PRs
  • bpo-36019: Use pythontest.net instead of example.com #11941
  • [3.7] bpo-36019: Use pythontest.net instead of example.com in network tests (GH-11941) #11989
  • [2.7] bpo-36019: Use pythontest.net instead of example.com in network tests (GH-11941) #12177
  • 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 = None
    closed_at = <Date 2019-03-05.14:20:57.161>
    created_at = <Date 2019-02-18.00:41:35.062>
    labels = ['3.8', '3.7', 'tests']
    title = 'test_urllib fail in s390x buildbots: http://www.example.com/'
    updated_at = <Date 2022-02-05.11:45:50.977>
    user = 'https://github.com/pablogsal'

    bugs.python.org fields:

    activity = <Date 2022-02-05.11:45:50.977>
    actor = 'sobolevn'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-03-05.14:20:57.161>
    closer = 'vstinner'
    components = ['Tests']
    creation = <Date 2019-02-18.00:41:35.062>
    creator = 'pablogsal'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 36019
    keywords = ['patch']
    message_count = 22.0
    messages = ['335793', '335812', '335815', '335816', '335828', '335958', '335963', '335969', '335991', '336249', '336308', '336309', '336313', '337153', '337158', '337168', '337176', '337177', '337187', '337188', '412566', '412568']
    nosy_count = 6.0
    nosy_names = ['vstinner', 'matrixise', 'David.Edelsohn', 'pablogsal', 'miss-islington', 'sobolevn']
    pr_nums = ['11941', '11989', '12177']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue36019'
    versions = ['Python 2.7', 'Python 3.6', 'Python 3.7', 'Python 3.8']

    @pablogsal
    Copy link
    Member Author

    test_urllib fail in s390x buildbots. It does not seem like a temporary failure as they keep failing consistently. Some failed builds:

    https://buildbot.python.org/all/#builders/126/builds/1010
    https://buildbot.python.org/all/#builders/122/builds/1026
    https://buildbot.python.org/all/#builders/119/builds/1060
    https://buildbot.python.org/all/#builders/21/builds/2332

    ======================================================================
    ERROR: test_close (test.test_urllib2net.CloseSocketTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 89, in test_close
        response = _urlopen_with_retry(url)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 27, in wrapped
        return _retry_thrice(func, exc, *args, **kwargs)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 23, in _retry_thrice
        raise last_exc
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 19, in _retry_thrice
        return func(*args, **kwargs)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 222, in urlopen
        return opener.open(url, data, timeout)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 531, in open
        response = meth(req, response)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 641, in http_response
        'http', request, response, code, msg, hdrs)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 569, in error
        return self._call_chain(*args)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 503, in _call_chain
        result = func(*args)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 649, in http_error_default
        raise HTTPError(req.full_url, code, msg, hdrs, fp)
    urllib.error.HTTPError: HTTP Error 403: Forbidden

    ======================================================================
    ERROR: test_custom_headers (test.test_urllib2net.OtherNetworkTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 181, in test_custom_headers
        opener.open(request)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 531, in open
        response = meth(req, response)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 641, in http_response
        'http', request, response, code, msg, hdrs)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 569, in error
        return self._call_chain(*args)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 503, in _call_chain
        result = func(*args)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 649, in http_error_default
        raise HTTPError(req.full_url, code, msg, hdrs, fp)
    urllib.error.HTTPError: HTTP Error 403: Forbidden

    ======================================================================
    ERROR: test_http_basic (test.test_urllib2net.TimeoutTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 264, in test_http_basic
        u = _urlopen_with_retry(url)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 27, in wrapped
        return _retry_thrice(func, exc, *args, **kwargs)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 23, in _retry_thrice
        raise last_exc
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 19, in _retry_thrice
        return func(*args, **kwargs)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 222, in urlopen
        return opener.open(url, data, timeout)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 531, in open
        response = meth(req, response)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 641, in http_response
        'http', request, response, code, msg, hdrs)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 569, in error
        return self._call_chain(*args)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 503, in _call_chain
        result = func(*args)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 649, in http_error_default
        raise HTTPError(req.full_url, code, msg, hdrs, fp)
    urllib.error.HTTPError: HTTP Error 403: Forbidden

    ======================================================================
    ERROR: test_http_default_timeout (test.test_urllib2net.TimeoutTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 274, in test_http_default_timeout
        u = _urlopen_with_retry(url)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 27, in wrapped
        return _retry_thrice(func, exc, *args, **kwargs)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 23, in _retry_thrice
        raise last_exc
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 19, in _retry_thrice
        return func(*args, **kwargs)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 222, in urlopen
        return opener.open(url, data, timeout)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 531, in open
        response = meth(req, response)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 641, in http_response
        'http', request, response, code, msg, hdrs)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 569, in error
        return self._call_chain(*args)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 503, in _call_chain
        result = func(*args)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 649, in http_error_default
        raise HTTPError(req.full_url, code, msg, hdrs, fp)
    urllib.error.HTTPError: HTTP Error 403: Forbidden

    ======================================================================
    ERROR: test_http_no_timeout (test.test_urllib2net.TimeoutTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 286, in test_http_no_timeout
        u = _urlopen_with_retry(url, timeout=None)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 27, in wrapped
        return _retry_thrice(func, exc, *args, **kwargs)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 23, in _retry_thrice
        raise last_exc
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 19, in _retry_thrice
        return func(*args, **kwargs)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 222, in urlopen
        return opener.open(url, data, timeout)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 531, in open
        response = meth(req, response)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 641, in http_response
        'http', request, response, code, msg, hdrs)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 569, in error
        return self._call_chain(*args)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 503, in _call_chain
        result = func(*args)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 649, in http_error_default
        raise HTTPError(req.full_url, code, msg, hdrs, fp)
    urllib.error.HTTPError: HTTP Error 403: Forbidden
    /home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/support/__init__.py:1539: ResourceWarning: unclosed <socket.socket [closed] fd=3, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>
      gc.collect()
    ResourceWarning: Enable tracemalloc to get the object allocation traceback
    /home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/support/__init__.py:1539: ResourceWarning: unclosed <socket.socket [closed] fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>
      gc.collect()
    ResourceWarning: Enable tracemalloc to get the object allocation traceback
    /home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/support/__init__.py:1539: ResourceWarning: unclosed <socket.socket [closed] fd=5, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>
      gc.collect()
    ResourceWarning: Enable tracemalloc to get the object allocation traceback
    /home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/support/__init__.py:1539: ResourceWarning: unclosed <socket.socket [closed] fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>
      gc.collect()
    ResourceWarning: Enable tracemalloc to get the object allocation traceback
    test test_urllib2net failed

    ======================================================================
    ERROR: test_http_timeout (test.test_urllib2net.TimeoutTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 295, in test_http_timeout
        u = _urlopen_with_retry(url, timeout=120)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 27, in wrapped
        return _retry_thrice(func, exc, *args, **kwargs)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 23, in _retry_thrice
        raise last_exc
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/test/test_urllib2net.py", line 19, in _retry_thrice
        return func(*args, **kwargs)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 222, in urlopen
        return opener.open(url, data, timeout)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 531, in open
        response = meth(req, response)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 641, in http_response
        'http', request, response, code, msg, hdrs)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 569, in error
        return self._call_chain(*args)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 503, in _call_chain
        result = func(*args)
      File "/home/dje/cpython-buildarea/3.7.edelsohn-rhel-z/build/Lib/urllib/request.py", line 649, in http_error_default
        raise HTTPError(req.full_url, code, msg, hdrs, fp)
    urllib.error.HTTPError: HTTP Error 403: Forbidden

    Ran 15 tests in 1.006s
    FAILED (errors=6, skipped=1)
    3 tests failed again:
    test_urllib2 test_urllib2net test_urllibnet

    @pablogsal pablogsal added 3.7 (EOL) end of life 3.8 only security fixes tests Tests in the Lib/test dir labels Feb 18, 2019
    @vstinner
    Copy link
    Member

    These random network failure occur with http://www.example.com/:
    #10608 (comment)

    I don't think that it's a good idea to use a public server for our tests. I would be better to use pythontest.net instead.

    @vstinner vstinner changed the title test_urllib fail in s390x buildbots test_urllib fail in s390x buildbots: http://www.example.com/ Feb 18, 2019
    @matrixise
    Copy link
    Member

    Use a public server or pythontest.net server (it's a public server on the Internet). could we the http requests? I use this practice for the unit test with an external web service, but for the integration tests, I prefer to use the real web service.

    @matrixise
    Copy link
    Member

    sorry, error with my copy/paste/fixing_words: but my sentence was "could we mock the http requests?"

    @vstinner
    Copy link
    Member

    could we mock the http requests?

    No, the tests are functional tests which use deliberate HTTP request to public servers.

    I suggest to use a server that we control rather multiple "third-party" servers. I'm trying to keep a list of external services used by Python test suite:
    https://pythondev.readthedocs.io/infra.html#services-used-by-unit-tests

    @matrixise
    Copy link
    Member

    ok for me if you prefer to use a function test with pythontest.net

    @matrixise
    Copy link
    Member

    Here is the list of the external resources that we use in the tests.

    test_issue16464 (test.test_urllib2.MiscTests) ... skipped "Resource 'http://www.example.com/' is not available"
    test_close (test.test_urllib2net.CloseSocketTest) ... skipped "Resource 'http://www.example.com/' is not available"
    test_custom_headers (test.test_urllib2net.OtherNetworkTests) ... skipped "Resource 'http://www.example.com' is not available"
    test_sites_no_connection_close (test.test_urllib2net.OtherNetworkTests) ... skipped 'XXX: http://www.imdb.com is gone'
    test_http_basic (test.test_urllib2net.TimeoutTest) ... skipped "Resource 'http://www.example.com' is not available"
    test_http_default_timeout (test.test_urllib2net.TimeoutTest) ... skipped "Resource 'http://www.example.com' is not available"
    test_http_no_timeout (test.test_urllib2net.TimeoutTest) ... skipped "Resource 'http://www.example.com' is not available"
    test_http_timeout (test.test_urllib2net.TimeoutTest) ... skipped "Resource 'http://www.example.com' is not available"

    in the failed tests:
    test_urllib2 test_urllib2net test_urllibnet

    @matrixise
    Copy link
    Member

    @vstinner and @pablogsal

    I started to work on this issue, the PR is in WIP mode.

    @matrixise
    Copy link
    Member

    @vstinner I have fixed some URLs but we need to update pythontest.net for some tests.

    For example: test.test_urllib2.MiscTests.test_issue16464 raises a HTTP 405 and pythontest.net does not support the requested method.

    test_networked_trusted_by_default_cert (test.test_httplib.HTTPSTest) ... skipped "Resource 'www.python.org' is not available"
    test_logincapa (test.test_imaplib.RemoteIMAPTest) ... skipped "Resource 'cyrus.andrew.cmu.edu' is not available"
    test_logout (test.test_imaplib.RemoteIMAPTest) ... skipped "Resource 'cyrus.andrew.cmu.edu' is not available"
    test_logincapa (test.test_imaplib.RemoteIMAP_SSLTest) ... skipped "Resource 'cyrus.andrew.cmu.edu' is not available"
    test_logout (test.test_imaplib.RemoteIMAP_SSLTest) ... skipped "Resource 'cyrus.andrew.cmu.edu' is not available"
    test_logincapa (test.test_imaplib.RemoteIMAP_STARTTLSTest) ... skipped "Resource 'cyrus.andrew.cmu.edu' is not available"
    test_logout (test.test_imaplib.RemoteIMAP_STARTTLSTest) ... skipped "Resource 'cyrus.andrew.cmu.edu' is not available"
    skipped "Resource 'news.trigofacile.com' is not available"
    skipped "Resource 'nntp.aioe.org' is not available"
    test_connect (test.test_smtpnet.SmtpSSLTest) ... skipped "Resource 'smtp.gmail.com' is not available"
    test_connect_default_port (test.test_smtpnet.SmtpSSLTest) ... skipped "Resource 'smtp.gmail.com' is not available"
    test_connect_using_sslcontext (test.test_smtpnet.SmtpSSLTest) ... skipped "Resource 'smtp.gmail.com' is not available"
    test_connect_using_sslcontext_verified (test.test_smtpnet.SmtpSSLTest) ... skipped "Resource 'smtp.gmail.com' is not available"
    test_connect_starttls (test.test_smtpnet.SmtpTest) ... skipped "Resource 'smtp.gmail.com' is not available"
    test_get_server_certificate_ipv6 (test.test_ssl.NetworkedTests) ... skipped "Resource 'ipv6.google.com' is not available"
    test_idna (test.test_socket.GeneralModuleTests) ... skipped "Resource 'python.org' is not available"
    testAcceptTimeout (test.test_timeout.TCPTimeoutTestCase) ... skipped "Resource 'www.python.org.' is not available"
    testConnectTimeout (test.test_timeout.TCPTimeoutTestCase) ... skipped "Resource 'www.python.org.' is not available"
    testRecvTimeout (test.test_timeout.TCPTimeoutTestCase) ... skipped "Resource 'www.python.org.' is not available"
    testSend (test.test_timeout.TCPTimeoutTestCase) ... skipped "Resource 'www.python.org.' is not available"
    testSendall (test.test_timeout.TCPTimeoutTestCase) ... skipped "Resource 'www.python.org.' is not available"
    testSendto (test.test_timeout.TCPTimeoutTestCase) ... skipped "Resource 'www.python.org.' is not available"
    test_issue16464 (test.test_urllib2.MiscTests) ... skipped "Resource 'http://www.example.com/' is not available"

    @pablogsal
    Copy link
    Member Author

    Related failure:

    https://buildbot.python.org/all/#/builders/141/builds/1233

    ----------------------------------------------------------------------
    Ran 56 tests in 25.105s
    OK (skipped=1)
    Re-running test 'test_normalization' in verbose mode
    test_bug_834676 (test.test_normalization.NormalizationTest) ... ok
    test test_normalization failed
    test_main (test.test_normalization.NormalizationTest) ... fetching http://www.pythontest.net/unicode/11.0.0/NormalizationTest.txt ...
    FAIL
    ======================================================================
    FAIL: test_main (test.test_normalization.NormalizationTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/urllib/request.py", line 1316, in do_open
        h.request(req.get_method(), req.selector, req.data, headers,
    socket.gaierror: [Errno -3] Temporary failure in name resolution
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
      File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_normalization.py", line 41, in test_main
        testdata = open_urlresource(TESTDATAURL, encoding="utf-8",
    urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
      File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_normalization.py", line 47, in test_main
        self.fail(f"Could not retrieve {TESTDATAURL}")
    AssertionError: Could not retrieve http://www.pythontest.net/unicode/11.0.0/NormalizationTest.txt

    Ran 2 tests in 20.044s
    FAILED (failures=1)
    Re-running test 'test_urllib2net' in verbose mode
    test_close (test.test_urllib2net.CloseSocketTest) ... skipped "Resource 'http://www.example.com/' is not available"
    test_custom_headers (test.test_urllib2net.OtherNetworkTests) ... skipped "Resource 'http://www.example.com' is not available"
    test_file (test.test_urllib2net.OtherNetworkTests) ... ok
    test_ftp (test.test_urllib2net.OtherNetworkTests) ... ok
    test_redirect_url_withfrag (test.test_urllib2net.OtherNetworkTests) ... skipped "Resource 'http://www.pythontest.net/redir/with_frag/' is not available"
    test_sites_no_connection_close (test.test_urllib2net.OtherNetworkTests) ... skipped 'XXX: http://www.imdb.com is gone'
    test_urlwithfrag (test.test_urllib2net.OtherNetworkTests) ... skipped "Resource 'http://www.pythontest.net/index.html#frag' is not available"
    test_ftp_basic (test.test_urllib2net.TimeoutTest) ... ok
    test_ftp_default_timeout (test.test_urllib2net.TimeoutTest) ... ok
    test_ftp_no_timeout (test.test_urllib2net.TimeoutTest) ... ok
    test_ftp_timeout (test.test_urllib2net.TimeoutTest) ... ok
    test_http_basic (test.test_urllib2net.TimeoutTest) ... ok
    test_http_default_timeout (test.test_urllib2net.TimeoutTest) ... ok
    test_http_no_timeout (test.test_urllib2net.TimeoutTest) ... ok
    /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/init.py:1608: ResourceWarning: unclosed <socket.socket fd=3, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('45.56.109.169', 46650), raddr=('104.236.16.9', 21)>
    gc.collect()
    ResourceWarning: Enable tracemalloc to get the object allocation traceback
    /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/support/init.py:1608: ResourceWarning: unclosed <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('45.56.109.169', 46662), raddr=('104.236.16.9', 21)>
    gc.collect()
    ResourceWarning: Enable tracemalloc to get the object allocation traceback
    test_http_timeout (test.test_urllib2net.TimeoutTest) ... ok
    ----------------------------------------------------------------------
    Ran 15 tests in 686.335s
    OK (skipped=5)
    1 test failed again:
    test_normalization

    Also, it seems that there are some socket leaks.

    @vstinner
    Copy link
    Member

    New changeset a40681d by Victor Stinner (Stéphane Wirtel) in branch 'master':
    bpo-36019: Use pythontest.net instead of example.com in network tests (GH-11941)
    a40681d

    @vstinner
    Copy link
    Member

    New changeset a40681d by Victor Stinner (Stéphane Wirtel) in branch 'master':
    bpo-36019: Use pythontest.net instead of example.com in network tests (GH-11941)

    I'm not sure that this change will fix https://bugs.python.org/issue36019 but I prefer that your CI doesn't flood public servers like google.com or example.com. I prefer that we control the external resources used by our tests.

    @miss-islington
    Copy link
    Contributor

    New changeset 6163210 by Miss Islington (bot) in branch '3.7':
    bpo-36019: Use pythontest.net instead of example.com in network tests (GH-11941)
    6163210

    @vstinner
    Copy link
    Member

    vstinner commented Mar 4, 2019

    Stéphane: Python 2.7 is also affected by the issue. Would you be interested in backport the fix to Lib/test/test_urllibnet.py? (in master, it's Lib/test/test_urllib2net.py).

    https://buildbot.python.org/all/#/builders/68/builds/238

    Re-running failed tests in verbose mode
    Re-running test 'test_urllibnet' in verbose mode
    ERROR: testURLread (test.test_urllibnet.URLTimeoutTest)
    ERROR: test_basic (test.test_urllibnet.urlopenNetworkTests)
    ERROR: test_geturl (test.test_urllibnet.urlopenNetworkTests)
    ERROR: test_info (test.test_urllibnet.urlopenNetworkTests)
    ERROR: test_readlines (test.test_urllibnet.urlopenNetworkTests)
    ERROR: test_basic (test.test_urllibnet.urlretrieveNetworkTests)

    @matrixise
    Copy link
    Member

    sure, I will do the backport tomorrow. thanks for the notif

    @matrixise
    Copy link
    Member

    Hi Victor,

    For the backport, should I add support.TEST_HTTP_URL?

    @matrixise
    Copy link
    Member

    Victor,

    Should I also fix these tests:

    test_urllibnet.py::urlretrieveNetworkTests.test_specified_path
    test_urllibnet.py::urlretrieveNetworkTests.test_header
    test_urllibnet.py::urlopenNetworkTests.test_fileno

    ?

    @vstinner
    Copy link
    Member

    vstinner commented Mar 5, 2019

    For the backport, should I add support.TEST_HTTP_URL?

    Yes

    Should I also fix these tests:

    Yes, all urllib and urllib2 tests which use http://www.example.com/

    @vstinner
    Copy link
    Member

    vstinner commented Mar 5, 2019

    New changeset 84772e0 by Victor Stinner (Stéphane Wirtel) in branch '2.7':
    [2.7] bpo-36019: Use pythontest.net in urllib network tests (GH-11941) (GH-12177)
    84772e0

    @vstinner
    Copy link
    Member

    vstinner commented Mar 5, 2019

    Stéphane Wirtel backported his fix to Python 2.7. I didn't see failures related to example.com on 3.7 and master branches, so I think that it's now time to close the issue.

    Thanks Stéphane!

    @vstinner vstinner closed this as completed Mar 5, 2019
    @sobolevn
    Copy link
    Member

    sobolevn commented Feb 5, 2022

    test.test_urllib2.MiscTests.test_issue16464 started to fail again:

     ======================================================================
    ERROR: test_issue16464 (test.test_urllib2.MiscTests)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/Users/runner/work/cpython/cpython/Lib/contextlib.py", line 155, in __exit__
        self.gen.throw(typ, value, traceback)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/runner/work/cpython/cpython/Lib/test/support/socket_helper.py", line 245, in transient_internet
        yield
        ^^^^^
      File "/Users/runner/work/cpython/cpython/Lib/test/test_urllib2.py", line 1799, in test_issue16464
        opener.open(request, "1".encode("us-ascii"))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/runner/work/cpython/cpython/Lib/urllib/request.py", line 525, in open
        response = meth(req, response)
                   ^^^^^^^^^^^^^^^^^^^
      File "/Users/runner/work/cpython/cpython/Lib/urllib/request.py", line 634, in http_response
        response = self.parent.error(
                   ^^^^^^^^^^^^^^^^^^
      File "/Users/runner/work/cpython/cpython/Lib/urllib/request.py", line 563, in error
        return self._call_chain(*args)
               ^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/runner/work/cpython/cpython/Lib/urllib/request.py", line 496, in _call_chain
        result = func(*args)
                 ^^^^^^^^^^^
      File "/Users/runner/work/cpython/cpython/Lib/urllib/request.py", line 643, in http_error_default
        raise HTTPError(req.full_url, code, msg, hdrs, fp)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    urllib.error.HTTPError: HTTP Error 404: Not Found
    
    ----------------------------------------------------------------------
    Ran 1 test in 0.093s
    

    Link: https://github.com/python/cpython/runs/5077404591?check_suite_focus=true#step:7:705

    Today I had like 3 or 4 different CI failures because of it.

    @sobolevn
    Copy link
    Member

    sobolevn commented Feb 5, 2022

    I can also reproduce it locally with: ./python.exe -m test -v test_urllib2 -m test_issue16464 -u network

    I've opened a new issue for it: https://bugs.python.org/issue46648

    @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
    3.7 (EOL) end of life 3.8 only security fixes tests Tests in the Lib/test dir
    Projects
    None yet
    Development

    No branches or pull requests

    5 participants