Issue 46648: `test.test_urllib2.MiscTests.test_issue16464` flaky due to external connection
Created on 2022-02-05 11:45 by sobolevn, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 31146 | closed | vstinner, 2022-02-05 18:01 | |
| PR 31161 | merged | vstinner, 2022-02-06 13:26 | |
| PR 31162 | merged | miss-islington, 2022-02-06 14:09 | |
| PR 31163 | merged | miss-islington, 2022-02-06 14:09 | |
| PR 31173 | merged | miss-islington, 2022-02-06 20:54 | |
| PR 31186 | merged | sobolevn, 2022-02-07 08:38 | |
| PR 31189 | merged | miss-islington, 2022-02-07 12:48 | |
| PR 31190 | merged | miss-islington, 2022-02-07 12:49 | |
| Messages (11) | |||
|---|---|---|---|
| msg412567 - (view) | Author: Nikita Sobolev (sobolevn) * ![]() |
Date: 2022-02-05 11:45 | |
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 ``` Related https://bugs.python.org/issue36019 |
|||
| msg412588 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2022-02-05 18:00 | |
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) ---------------------------------------------------------------------- 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_internet yield ^^^^^ 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 error return self._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_default raise HTTPError(req.full_url, code, msg, hdrs, fp) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ urllib.error.HTTPError: HTTP Error 404: Not Found |
|||
| msg412635 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2022-02-06 14:09 | |
New changeset 1578de2fcd685c71f9c84e09bac32901dea192c1 by Victor Stinner in branch 'main': bpo-46648: Skip test_urllib2.test_issue16464() (GH-31161) https://github.com/python/cpython/commit/1578de2fcd685c71f9c84e09bac32901dea192c1 |
|||
| msg412637 - (view) | Author: miss-islington (miss-islington) | Date: 2022-02-06 14:30 | |
New changeset 1b8a34ae65688cfadc81e0174b5aea979b264b3e by Miss Islington (bot) in branch '3.9': bpo-46648: Skip test_urllib2.test_issue16464() (GH-31161) https://github.com/python/cpython/commit/1b8a34ae65688cfadc81e0174b5aea979b264b3e |
|||
| msg412638 - (view) | Author: miss-islington (miss-islington) | Date: 2022-02-06 14:33 | |
New changeset c88407ccf5e72d00e909c2399ff7163501aa7089 by Miss Islington (bot) in branch '3.10': bpo-46648: Skip test_urllib2.test_issue16464() (GH-31161) https://github.com/python/cpython/commit/c88407ccf5e72d00e909c2399ff7163501aa7089 |
|||
| msg412674 - (view) | Author: Gregory P. Smith (gregory.p.smith) * ![]() |
Date: 2022-02-06 22:05 | |
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. |
|||
| msg412737 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2022-02-07 12:48 | |
New changeset 8e98175a03fe03d62822d96007a74e5273013764 by Nikita Sobolev in branch 'main': bpo-46648: Rewrite test_urllib2.test_issue16464() with a local HTTP server (GH-31186) https://github.com/python/cpython/commit/8e98175a03fe03d62822d96007a74e5273013764 |
|||
| msg412740 - (view) | Author: miss-islington (miss-islington) | Date: 2022-02-07 13:14 | |
New changeset 0d74efc54fa811def386d2cde00986204ba18569 by Miss Islington (bot) in branch '3.9': bpo-46648: Rewrite test_urllib2.test_issue16464() with a local HTTP server (GH-31186) https://github.com/python/cpython/commit/0d74efc54fa811def386d2cde00986204ba18569 |
|||
| msg412790 - (view) | Author: miss-islington (miss-islington) | Date: 2022-02-07 20:15 | |
New changeset 9539400390494f4930c245b3f98453592f4a1a8c 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) https://github.com/python/cpython/commit/9539400390494f4930c245b3f98453592f4a1a8c |
|||
| msg412795 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2022-02-07 22:08 | |
I close again the issue. The 3.8 backport is waiting for the Python 3.8 Release Manager approval. |
|||
| msg412824 - (view) | Author: Łukasz Langa (lukasz.langa) * ![]() |
Date: 2022-02-08 09:52 | |
New changeset f87e616af038ee8963185e11b96841c81e8ef15a by Miss Islington (bot) in branch '3.8': bpo-46648: Skip test_urllib2.test_issue16464() (GH-31161) (GH-31173) https://github.com/python/cpython/commit/f87e616af038ee8963185e11b96841c81e8ef15a |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:55 | admin | set | github: 90806 |
| 2022-02-08 09:52:52 | lukasz.langa | set | nosy:
+ lukasz.langa messages: + msg412824 |
| 2022-02-07 22:08:55 | vstinner | set | status: open -> closed resolution: fixed messages: + msg412795 stage: patch review -> resolved |
| 2022-02-07 20:15:45 | miss-islington | set | messages: + msg412790 |
| 2022-02-07 13:14:18 | miss-islington | set | messages: + msg412740 |
| 2022-02-07 12:49:04 | miss-islington | set | pull_requests: + pull_request29361 |
| 2022-02-07 12:48:58 | miss-islington | set | pull_requests: + pull_request29360 |
| 2022-02-07 12:48:52 | vstinner | set | nosy:
+ vstinner messages: + msg412737 |
| 2022-02-07 08:42:37 | gregory.p.smith | set | assignee: sobolevn |
| 2022-02-07 08:38:11 | sobolevn | set | stage: needs patch -> patch review pull_requests: + pull_request29357 |
| 2022-02-06 23:19:56 | vstinner | set | nosy:
- vstinner |
| 2022-02-06 22:05:44 | gregory.p.smith | set | status: closed -> open title: `test.test_urllib2.MiscTests.test_issue16464` started to fail -> `test.test_urllib2.MiscTests.test_issue16464` flaky due to external connection |
| 2022-02-06 20:54:32 | miss-islington | set | pull_requests: + pull_request29344 |
| 2022-02-06 15:42:54 | vstinner | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2022-02-06 14:33:11 | miss-islington | set | messages: + msg412638 |
| 2022-02-06 14:30:32 | miss-islington | set | messages: + msg412637 |
| 2022-02-06 14:09:19 | miss-islington | set | pull_requests: + pull_request29336 |
| 2022-02-06 14:09:15 | miss-islington | set | nosy:
+ miss-islington pull_requests: + pull_request29335 |
| 2022-02-06 14:09:09 | vstinner | set | messages: + msg412635 |
| 2022-02-06 13:26:32 | vstinner | set | pull_requests: + pull_request29334 |
| 2022-02-06 05:05:39 | corona10 | set | pull_requests: - pull_request29325 |
| 2022-02-06 05:05:16 | corona10 | set | nosy:
+ corona10 |
| 2022-02-05 19:07:06 | GBeauregard | set | nosy:
+ GBeauregard pull_requests: + pull_request29325 |
| 2022-02-05 18:01:30 | vstinner | set | keywords:
+ patch stage: patch review pull_requests: + pull_request29323 |
| 2022-02-05 18:00:22 | vstinner | set | nosy:
+ vstinner messages: + msg412588 |
| 2022-02-05 17:59:58 | vstinner | link | issue46651 superseder |
| 2022-02-05 11:45:33 | sobolevn | create | |

