-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
gh-140691: urllib.request: Close FTP control socket if data socket can't connect #140835
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
Conversation
| if expected_err: | ||
| msg = ("Didn't get expected error(s) %s for %s %s, got %s: %s" % | ||
| (expected_err, url, req, type(err), err)) | ||
| self.assertIsInstance(err, expected_err, msg) | ||
| else: | ||
| raise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(The new context (assertRaises) handles the expected error; printing information is nowadays covered by subTest)
|
🤖 New build scheduled with the buildbot fleet by @encukou for commit 3cbf28b 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F140835%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
cmaloney
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation looks correct and test covers the case well
|
The PPPC64LE RHEL8 Refleaks PR build seems to have found a distinct but similar unclosed socket in exception case: test_ftp (test.test_urllib2net.OtherNetworkTests.test_ftp) ... Warning -- Unraisable exception
Exception ignored while finalizing socket <socket.socket fd=3, family=2, type=1, proto=6, laddr=('147.229.8.193', 48118), raddr=('68.183.26.59', 21)>:
Traceback (most recent call last):
File "/home/buildbot/buildarea/pull_request.cstratak-RHEL8-ppc64le.refleak/build/Lib/urllib/request.py", line 1822, in retrfile
self.ftp.cwd(file)
~~~~~~~~~~~~^^^^^^
File "/home/buildbot/buildarea/pull_request.cstratak-RHEL8-ppc64le.refleak/build/Lib/ftplib.py", line 619, in cwd
return self.voidcmd(cmd)
~~~~~~~~~~~~^^^^^
File "/home/buildbot/buildarea/pull_request.cstratak-RHEL8-ppc64le.refleak/build/Lib/ftplib.py", line 286, in voidcmd
return self.voidresp()
~~~~~~~~~~~~~^^
File "/home/buildbot/buildarea/pull_request.cstratak-RHEL8-ppc64le.refleak/build/Lib/ftplib.py", line 259, in voidresp
resp = self.getresp()
File "/home/buildbot/buildarea/pull_request.cstratak-RHEL8-ppc64le.refleak/build/Lib/ftplib.py", line 254, in getresp
raise error_perm(resp)
ftplib.error_perm: 550 Failed to change directory.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/buildbot/buildarea/pull_request.cstratak-RHEL8-ppc64le.refleak/build/Lib/urllib/request.py", line 1547, in ftp_open
fp, retrlen = fw.retrfile(file, type)
~~~~~~~~~~~^^^^^^^^^^^^
File "/home/buildbot/buildarea/pull_request.cstratak-RHEL8-ppc64le.refleak/build/Lib/urllib/request.py", line 1824, in retrfile
raise URLError('ftp error: %r' % reason) from reason
urllib.error.URLError: <urlopen error ftp error: error_perm('550 Failed to change directory.')>
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/buildbot/buildarea/pull_request.cstratak-RHEL8-ppc64le.refleak/build/Lib/test/test_urllib2net.py", line 23, in _retry_thrice
return func(*args, **kwargs)
File "/home/buildbot/buildarea/pull_request.cstratak-RHEL8-ppc64le.refleak/build/Lib/urllib/request.py", line 487, in open
response = self._open(req, data)
File "/home/buildbot/buildarea/pull_request.cstratak-RHEL8-ppc64le.refleak/build/Lib/urllib/request.py", line 504, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
'_open', req)
File "/home/buildbot/buildarea/pull_request.cstratak-RHEL8-ppc64le.refleak/build/Lib/urllib/request.py", line 464, in _call_chain
result = func(*args)
File "/home/buildbot/buildarea/pull_request.cstratak-RHEL8-ppc64le.refleak/build/Lib/urllib/request.py", line 1560, in ftp_open
raise URLError(f"ftp error: {exp}") from exp
urllib.error.URLError: <urlopen error ftp error: <urlopen error ftp error: error_perm('550 Failed to change directory.')>>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/buildbot/buildarea/pull_request.cstratak-RHEL8-ppc64le.refleak/build/Lib/test/test_urllib2net.py", line 25, in _retry_thrice
last_exc = e
^^^^^^^^
ResourceWarning: unclosed <socket.socket fd=3, family=2, type=1, proto=6, laddr=('147.229.8.193', 48118), raddr=('68.183.26.59', 21)>
okbuild:https://buildbot.python.org/#/builders/353/builds/2319 |
|
Thank you for the review! Hmm, how did you get the traceback? The logs show |
|
!buildbot PPC64LE.Fedora.Stable |
|
🤖 New build scheduled with the buildbot fleet by @encukou for commit 57634d3 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F140835%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
|
!buildbot PPC64LE.Fedora.Stable.Refleaks |
|
🤖 New build scheduled with the buildbot fleet by @encukou for commit d329345 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F140835%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
In the linked buildbot log expanded the |
|
Ah, I missed that it only appeared on that specific run; the other runs are failing in a different way. |
|
!buildbot PPC64LE.Fedora.Stable.Refleaks |
|
🤖 New build scheduled with the buildbot fleet by @encukou for commit cd9d5f8 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F140835%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
|
@vstinner, if you have a good way to reproduce this PR failing refleak tests on a PPC64LE machine, it would be appreciated. I couldn't reproduce it in QEMU/podman. |
|
🤖 New build scheduled with the buildbot fleet by @encukou for commit d20a451 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F140835%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
|
To unblock failing buildbots, I'll merge with a skip on PPC64LE. I'm pretty sure this doesn't break PPC64LE -- it only fails in the new test, and that can be solved in a new PR. |
|
Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…ket can't connect (pythonGH-140835) (cherry picked from commit f2bce51) Co-authored-by: Petr Viktorin <[email protected]> Co-authored-by: codenamenam <[email protected]>
|
GH-141555 is a backport of this pull request to the 3.14 branch. |
…cket can't connect (GH-140835) (GH-141555) (cherry picked from commit f2bce51) Co-authored-by: Petr Viktorin <[email protected]> Co-authored-by: codenamenam <[email protected]>
|
Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
|
Sorry, @encukou, I could not cleanly backport this to |
…ket can't connect (pythonGH-140835) Co-authored-by: codenamenam <[email protected]> (cherry picked from commit f2bce51)
|
GH-141657 is a backport of this pull request to the 3.13 branch. |
…cket can't connect (GH-140835) (GH-141657) (cherry picked from commit f2bce51) Co-authored-by: codenamenam <[email protected]>
…ket can't connect (pythonGH-140835) Co-authored-by: codenamenam <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.