You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test.test_urllib2.MiscTests.test_issue16464 flaky due to external connection #90806
Today I've noticed that a lot of CI runs fail because of this test.
Output:
======================================================================
ERROR: test_issue16464 (test.test_urllib2.MiscTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/sobolev/Desktop/cpython/Lib/contextlib.py", line 155, in __exit__
self.gen.throw(typ, value, traceback)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sobolev/Desktop/cpython/Lib/test/support/socket_helper.py", line 245, in transient_internet
yield
^^^^^
File "/Users/sobolev/Desktop/cpython/Lib/test/test_urllib2.py", line 1799, in test_issue16464
opener.open(request, "1".encode("us-ascii"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sobolev/Desktop/cpython/Lib/urllib/request.py", line 525, in open
response = meth(req, response)
^^^^^^^^^^^^^^^^^^^
File "/Users/sobolev/Desktop/cpython/Lib/urllib/request.py", line 634, in http_response
response = self.parent.error(
^^^^^^^^^^^^^^^^^^
File "/Users/sobolev/Desktop/cpython/Lib/urllib/request.py", line 563, in error
return self._call_chain(*args)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sobolev/Desktop/cpython/Lib/urllib/request.py", line 496, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "/Users/sobolev/Desktop/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.448s
FAILED (errors=1)
/Users/sobolev/Desktop/cpython/Lib/test/support/__init__.py:705: ResourceWarning: unclosed <socket.socket [closed] fd=7, family=2, type=1, proto=6>
gc.collect()
ResourceWarning: Enable tracemalloc to get the object allocation traceback
test test_urllib2 failed
test_urllib2 failed (1 error)
== Tests result: FAILURE ==
I can also reproduce this failure locally with:
./python.exe -m test -v test_urllib2 -m test_issue16464 -u network
Traceback (most recent call last):
File "/home/vstinner/python/main/Lib/contextlib.py", line 155, in __exit__self.gen.throw(typ, value, traceback)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/python/main/Lib/test/support/socket_helper.py", line 245, in transient_internetyield^^^^^
File "/home/vstinner/python/main/Lib/test/test_urllib2.py", line 1799, in test_issue16464
opener.open(request, "1".encode("us-ascii"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/python/main/Lib/urllib/request.py", line 525, in open
response = meth(req, response)
^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/python/main/Lib/urllib/request.py", line 634, in http_response
response =self.parent.error(
^^^^^^^^^^^^^^^^^^
File "/home/vstinner/python/main/Lib/urllib/request.py", line 563, in errorreturnself._call_chain(*args)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vstinner/python/main/Lib/urllib/request.py", line 496, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "/home/vstinner/python/main/Lib/urllib/request.py", line 643, in http_error_defaultraise HTTPError(req.full_url, code, msg, hdrs, fp)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^urllib.error.HTTPError: HTTP Error 404: Not Found
The merged PRs disable the test without anything tracking fixing or re-re-enabling it. Reopening & retitling this issue.
This specific test does not need to use an external server. That has nothing to do with what the purposes of the test is which is all around a content-length issue per https://bugs.python.org/issue16464
The appropriate fix is to have the test manage it's own http server on localhost in another thread or process.
changed the title [-]`test.test_urllib2.MiscTests.test_issue16464` started to fail[/-][+]`test.test_urllib2.MiscTests.test_issue16464` flaky due to external connection[/+]on Feb 6, 2022
New changeset 8e98175 by Nikita Sobolev in branch 'main': bpo-46648: Rewrite test_urllib2.test_issue16464() with a local HTTP server (GH-31186) 8e98175
New changeset 0d74efc by Miss Islington (bot) in branch '3.9': bpo-46648: Rewrite test_urllib2.test_issue16464() with a local HTTP server (GH-31186) 0d74efc
New changeset 9539400 by Miss Islington (bot) in branch '3.10':
[3.10] bpo-46648: Rewrite test_urllib2.test_issue16464() with a local HTTP server (GH-31186) (GH-31189) 9539400
Activity
sobolevn commentedon Feb 5, 2022
Today I've noticed that a lot of CI runs fail because of this test.
Output:
I can also reproduce this failure locally with:
Related https://bugs.python.org/issue36019
vstinner commentedon Feb 5, 2022
I close my bpo-46651 as a duplicate of this issue. Copy of my message.
test_urllib2.test_issue16464() fails randomly.
It uses http://www.example.com/ server.
Instead, I proposed to use http://httpbin.org/post URL which is written to support HTTP POST.
$ ./python -m test test_urllib2 -u all -v -m test_issue16464======================================================================
ERROR: test_issue16464 (test.test_urllib2.MiscTests)
----------------------------------------------------------------------
vstinner commentedon Feb 6, 2022
New changeset 1578de2 by Victor Stinner in branch 'main':
bpo-46648: Skip test_urllib2.test_issue16464() (GH-31161)
1578de2
miss-islington commentedon Feb 6, 2022
New changeset 1b8a34a by Miss Islington (bot) in branch '3.9':
bpo-46648: Skip test_urllib2.test_issue16464() (GH-31161)
1b8a34a
miss-islington commentedon Feb 6, 2022
New changeset c88407c by Miss Islington (bot) in branch '3.10':
bpo-46648: Skip test_urllib2.test_issue16464() (GH-31161)
c88407c
gpshead commentedon Feb 6, 2022
The merged PRs disable the test without anything tracking fixing or re-re-enabling it. Reopening & retitling this issue.
This specific test does not need to use an external server. That has nothing to do with what the purposes of the test is which is all around a content-length issue per https://bugs.python.org/issue16464
The appropriate fix is to have the test manage it's own http server on localhost in another thread or process.
We do not need to test it with https.
4 remaining items
[-]`test.test_urllib2.MiscTests.test_issue16464` started to fail[/-][+]`test.test_urllib2.MiscTests.test_issue16464` flaky due to external connection[/+]vstinner commentedon Feb 7, 2022
New changeset 8e98175 by Nikita Sobolev in branch 'main':
bpo-46648: Rewrite test_urllib2.test_issue16464() with a local HTTP server (GH-31186)
8e98175
miss-islington commentedon Feb 7, 2022
New changeset 0d74efc by Miss Islington (bot) in branch '3.9':
bpo-46648: Rewrite test_urllib2.test_issue16464() with a local HTTP server (GH-31186)
0d74efc
miss-islington commentedon Feb 7, 2022
New changeset 9539400 by Miss Islington (bot) in branch '3.10':
[3.10] bpo-46648: Rewrite test_urllib2.test_issue16464() with a local HTTP server (GH-31186) (GH-31189)
9539400
vstinner commentedon Feb 7, 2022
I close again the issue. The 3.8 backport is waiting for the Python 3.8 Release Manager approval.
ambv commentedon Feb 8, 2022
New changeset f87e616 by Miss Islington (bot) in branch '3.8':
bpo-46648: Skip test_urllib2.test_issue16464() (GH-31161) (GH-31173)
f87e616