Skip to content

Conversation

@encukou
Copy link
Member

@encukou encukou commented Oct 31, 2025

Comment on lines -242 to -247
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
Copy link
Member Author

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)

@encukou encukou requested a review from cmaloney October 31, 2025 14:30
@encukou encukou added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 31, 2025
@bedevere-bot
Copy link

🤖 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.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 31, 2025
Copy link
Contributor

@cmaloney cmaloney left a 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

@cmaloney
Copy link
Contributor

cmaloney commented Nov 1, 2025

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)>
ok

build:https://buildbot.python.org/#/builders/353/builds/2319

@encukou
Copy link
Member Author

encukou commented Nov 3, 2025

Thank you for the review!

Hmm, how did you get the traceback? The logs show check_no_warnings comparing two lists of warnings.

@encukou
Copy link
Member Author

encukou commented Nov 3, 2025

!buildbot PPC64LE.Fedora.Stable

@bedevere-bot
Copy link

🤖 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: PPC64LE.Fedora.Stable

The builders matched are:

  • PPC64LE Fedora Stable LTO PR
  • PPC64LE Fedora Stable Clang Installed PR
  • PPC64LE Fedora Stable LTO + PGO PR
  • PPC64LE Fedora Stable Clang PR
  • PPC64LE Fedora Stable PR
  • PPC64LE Fedora Stable Refleaks PR

@encukou
Copy link
Member Author

encukou commented Nov 3, 2025

!buildbot PPC64LE.Fedora.Stable.Refleaks

@bedevere-bot
Copy link

🤖 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: PPC64LE.Fedora.Stable.Refleaks

The builders matched are:

  • PPC64LE Fedora Stable Refleaks PR

@cmaloney
Copy link
Contributor

cmaloney commented Nov 3, 2025

Hmm, how did you get the traceback? The logs show check_no_warnings comparing two lists of warnings.

In the linked buildbot log expanded the test step, then used the "Raw" button next to stdio, is in the full log.

@encukou
Copy link
Member Author

encukou commented Nov 4, 2025

Ah, I missed that it only appeared on that specific run; the other runs are failing in a different way.

@encukou
Copy link
Member Author

encukou commented Nov 4, 2025

!buildbot PPC64LE.Fedora.Stable.Refleaks

@bedevere-bot
Copy link

🤖 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: PPC64LE.Fedora.Stable.Refleaks

The builders matched are:

  • PPC64LE Fedora Stable Refleaks PR

@encukou
Copy link
Member Author

encukou commented Nov 4, 2025

@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.

@encukou encukou added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 4, 2025
@bedevere-bot
Copy link

🤖 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.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 4, 2025
@encukou
Copy link
Member Author

encukou commented Nov 5, 2025

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.

@encukou encukou merged commit f2bce51 into python:main Nov 5, 2025
115 of 116 checks passed
@encukou encukou deleted the ftp-warnings branch November 5, 2025 10:52
@encukou encukou added the needs backport to 3.14 bugs and security fixes label Nov 14, 2025
@miss-islington-app
Copy link

Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 14, 2025
…ket can't connect (pythonGH-140835)

(cherry picked from commit f2bce51)

Co-authored-by: Petr Viktorin <[email protected]>
Co-authored-by: codenamenam <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Nov 14, 2025

GH-141555 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Nov 14, 2025
encukou added a commit that referenced this pull request Nov 14, 2025
…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]>
@encukou encukou added the needs backport to 3.13 bugs and security fixes label Nov 17, 2025
@miss-islington-app
Copy link

Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @encukou, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker f2bce51b984f52db14d90f7bbd0b7df00b7c5637 3.13

encukou added a commit to encukou/cpython that referenced this pull request Nov 17, 2025
…ket can't connect (pythonGH-140835)

Co-authored-by: codenamenam <[email protected]>
(cherry picked from commit f2bce51)
@bedevere-app
Copy link

bedevere-app bot commented Nov 17, 2025

GH-141657 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Nov 17, 2025
encukou added a commit that referenced this pull request Nov 18, 2025
…cket can't connect (GH-140835) (GH-141657)

(cherry picked from commit f2bce51)

Co-authored-by: codenamenam <[email protected]>
StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants