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_urllib fail in s390x buildbots: http://www.example.com/
Type: Stage: resolved
Components: Tests Versions: Python 3.8, Python 3.7, Python 3.6, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: David.Edelsohn, matrixise, miss-islington, pablogsal, sobolevn, vstinner
Priority: normal Keywords: patch

Created on 2019-02-18 00:41 by pablogsal, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 11941 merged matrixise, 2019-02-19 16:29
PR 11989 merged miss-islington, 2019-02-22 13:45
PR 12177 merged matrixise, 2019-03-05 12:26
Messages (22)
msg335793 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2019-02-18 00:41
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
msg335812 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-02-18 11:09
These random network failure occur with http://www.example.com/:
https://github.com/python/cpython/pull/10608#issuecomment-464085852

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.
msg335815 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-02-18 11:17
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.
msg335816 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-02-18 11:18
sorry, error with my copy/paste/fixing_words: but my sentence was "could we mock the http requests?"
msg335828 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-02-18 12:44
> 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
msg335958 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-02-19 15:50
ok for me if you prefer to use a function test with pythontest.net
msg335963 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-02-19 16:12
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
msg335969 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-02-19 16:30
@vstinner and @pablogsal

I started to work on this issue, the PR is in WIP mode.
msg335991 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-02-19 18:23
@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"
msg336249 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2019-02-21 18:38
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.
msg336308 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-02-22 13:45
New changeset a40681dd5db8deaf05a635eecb91498dac882aa4 by Victor Stinner (Stéphane Wirtel) in branch 'master':
bpo-36019: Use pythontest.net instead of example.com in network tests (GH-11941)
https://github.com/python/cpython/commit/a40681dd5db8deaf05a635eecb91498dac882aa4
msg336309 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-02-22 13:46
> New changeset a40681dd5db8deaf05a635eecb91498dac882aa4 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.
msg336313 - (view) Author: miss-islington (miss-islington) Date: 2019-02-22 14:03
New changeset 6163210089148ad31c270695f7273fc3561a211a by Miss Islington (bot) in branch '3.7':
bpo-36019: Use pythontest.net instead of example.com in network tests (GH-11941)
https://github.com/python/cpython/commit/6163210089148ad31c270695f7273fc3561a211a
msg337153 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-03-04 22:13
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)
msg337158 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-03-04 23:45
sure, I will do the backport tomorrow. thanks for the notif
msg337168 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-03-05 07:06
Hi Victor,

For the backport, should I add support.TEST_HTTP_URL?
msg337176 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-03-05 09:12
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

?
msg337177 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-03-05 11:12
> 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/
msg337187 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-03-05 14:19
New changeset 84772e0ab49ee09acb44e30551aa5cfc1eafe5dc 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)
https://github.com/python/cpython/commit/84772e0ab49ee09acb44e30551aa5cfc1eafe5dc
msg337188 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-03-05 14:20
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!
msg412566 - (view) Author: Nikita Sobolev (sobolevn) * (Python triager) Date: 2022-02-05 11:39
`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.
msg412568 - (view) Author: Nikita Sobolev (sobolevn) * (Python triager) Date: 2022-02-05 11:45
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
History
Date User Action Args
2022-04-11 14:59:11adminsetgithub: 80200
2022-02-05 11:45:50sobolevnsetmessages: + msg412568
2022-02-05 11:39:30sobolevnsetnosy: + sobolevn
messages: + msg412566
2019-03-05 14:20:57vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg337188

stage: patch review -> resolved
2019-03-05 14:19:03vstinnersetmessages: + msg337187
2019-03-05 12:26:04matrixisesetpull_requests: + pull_request12172
2019-03-05 11:12:00vstinnersetmessages: + msg337177
2019-03-05 09:12:49matrixisesetmessages: + msg337176
2019-03-05 07:06:54matrixisesetmessages: + msg337168
2019-03-04 23:45:36matrixisesetmessages: + msg337158
2019-03-04 22:13:25vstinnersetmessages: + msg337153
versions: + Python 2.7
2019-02-22 14:03:34miss-islingtonsetnosy: + miss-islington
messages: + msg336313
2019-02-22 13:46:52vstinnersetmessages: + msg336309
2019-02-22 13:45:49miss-islingtonsetpull_requests: + pull_request12012
2019-02-22 13:45:47vstinnersetmessages: + msg336308
2019-02-21 18:38:41pablogsalsetmessages: + msg336249
2019-02-19 18:23:50matrixisesetmessages: + msg335991
2019-02-19 16:30:19matrixisesetmessages: + msg335969
2019-02-19 16:29:31matrixisesetkeywords: + patch
stage: patch review
pull_requests: + pull_request11965
2019-02-19 16:12:30matrixisesetmessages: + msg335963
2019-02-19 15:50:45matrixisesetmessages: + msg335958
2019-02-18 12:44:18vstinnersetmessages: + msg335828
2019-02-18 11:18:41matrixisesetmessages: + msg335816
2019-02-18 11:17:46matrixisesetnosy: + matrixise
messages: + msg335815
2019-02-18 11:09:36vstinnersettitle: test_urllib fail in s390x buildbots -> test_urllib fail in s390x buildbots: http://www.example.com/
2019-02-18 11:09:25vstinnersetnosy: + vstinner
messages: + msg335812
2019-02-18 00:41:35pablogsalcreate