Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GH-98388: Add tests for happy eyeballs and its internal workings#98389

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
twisteroidambassador wants to merge11 commits intopython:main
base:main
Choose a base branch
Loading
fromtwisteroidambassador:happy_eyeballs_checkup

Conversation

twisteroidambassador
Copy link
Contributor

@twisteroidambassadortwisteroidambassador commentedOct 18, 2022
edited by gvanrossum
Loading

One of the new tests may fail intermittently due topython#86296.
@bedevere-botbedevere-bot added awaiting review testsTests in the Lib/test dir labelsOct 18, 2022
@gvanrossumgvanrossum changed the titleAdd tests for happy eyeballs and its internal workings.GH-98388: Add tests for happy eyeballs and its internal workingsOct 18, 2022
Copy link
Member

@gvanrossumgvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I've added the "skip news" label because this is a test-only PR.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phraseI have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@twisteroidambassador
Copy link
ContributorAuthor

I have made the test that exposes#86296 fail more consistently on my computer. Let's see whether these CI tests fail.

I guess the next thing to consider is: What to do with this failing test? On 3.11 and above I can replacewait_for withtimeout, and I can confirm that fixes the issue, and the test passes. On older releases we don't havetimeout.

@gvanrossum
Copy link
Member

On my Intel Mac I don't see these tests fail yet.

But it seems they are failing in CI, so I believe you.

I'd say let's first prepare a fix that uses timeout and see if that passes everything.

For the 3.10 backport we have to do something completely different. I wonder if the key problem here isn't the one that caused so much trouble for the Semaphore class as well -- you can await a future, and catch CancelledError, but that doesn't mean the future was cancelled, it could mean the current task was cancelledafter the future already completed. Maybe there's still a path through the code that doesn't account for that, somehow?

This solution is compatible with all Python versions, and should pass all tests.
@twisteroidambassador
Copy link
ContributorAuthor

I got some inspiration from my past comments, and implemented a fix that's available on older Python versions as well.

The general approach is probably applicable to more situations: by waiting on the inner task withasyncio.wait, its exceptions and cancellation won't be raised automatically, and any exception caught in the outer task are definitely from the outer task itself. Oncewait returns, the inner task can be inspected.

Copy link
Contributor

@kumaraditya303kumaraditya303 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Once#98518 lands, please remove the implementation changes and only add tests.

@willingc
Copy link
Contributor

Hi@twisteroidambassador,

Once#98518 lands, please remove the implementation changes and only add tests.

As mentioned by@kumaraditya303: Now that#98518 has landed, would you like to modify this PR to only include the tests? Thanks.

@arhadthedev
Copy link
Member

The OP has no activity since January.

@arhadthedev
Copy link
Member

Well, working with diff using the mobile version of GitHub is extremely hard. I'll restore the deleted file in an hour after getting to a proper computer with a proper mouse.

@gvanrossumgvanrossum added the needs backport to 3.12only security fixes labelMay 23, 2023
Copy link
Member

@gvanrossumgvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This basically LGTM, I only have very minor nits.

@arhadthedev, would you take over this PR, since@twisteroidambassador seems to have disappeared? I think it would be good to land this and backport it to 3.12. At the very least you could review my suggestions, if you agree with everything I can merge.

@willingc Did you want to add anything?

FOUR_C = (socket.AF_INET, 0, 0, '', ('192.0.2.3', 7))
FOUR_D = (socket.AF_INET, 0, 0, '', ('192.0.2.4', 8))

addrinfos = [SIX_A, SIX_B, SIX_C, SIX_D, FOUR_A, FOUR_B, FOUR_C, FOUR_D]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Would it be a more thorough test if we mixed up the order a bit, e.g. like this?

Suggested change
addrinfos= [SIX_A,SIX_B,SIX_C,SIX_D,FOUR_A,FOUR_B,FOUR_C,FOUR_D]
addrinfos= [SIX_A,SIX_B,SIX_C,FOUR_A,FOUR_B,FOUR_C,FOUR_D,SIX_D]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Comment on lines +100 to +103
# There's a potential race condition here:
# https://github.com/python/cpython/issues/86296
# As with any race condition, it can be difficult to reproduce.
# This test may not fail every time.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Please add a note to this comment that the race condition has been fixed in 3.12, e.g.

Suggested change
# There's a potential race condition here:
# https://github.com/python/cpython/issues/86296
# As with any race condition, it can be difficult to reproduce.
# This test may not fail every time.
# There's a potential race condition here (fixed in Python 3.12):
# https://github.com/python/cpython/issues/86296
# As with any race condition, it can be difficult to reproduce.
# This test may not fail every time.

@twisteroidambassador
Copy link
ContributorAuthor

It would be great if@arhadthedev can take over this PR, since I don't think I'll have time to work on this in the foreseeable future. Thanks in advance to everyone!

@kumaraditya303kumaraditya303 removed their request for reviewJuly 8, 2023 08:55
@serhiy-storchakaserhiy-storchaka added the needs backport to 3.13bugs and security fixes labelMay 9, 2024
@Yhg1sYhg1s removed the needs backport to 3.12only security fixes labelApr 8, 2025
@python-cla-bot
Copy link

The following commit authors need to sign the Contributor License Agreement:

CLA signed

@serhiy-storchakaserhiy-storchaka added the needs backport to 3.14bugs and security fixes labelMay 8, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@gvanrossumgvanrossumgvanrossum requested changes

@kumaraditya303kumaraditya303kumaraditya303 requested changes

@1st11st1Awaiting requested review from 1st11st1 is a code owner

@asvetlovasvetlovAwaiting requested review from asvetlovasvetlov is a code owner

@willingcwillingcAwaiting requested review from willingcwillingc is a code owner

Assignees
No one assigned
Labels
awaiting changesneeds backport to 3.13bugs and security fixesneeds backport to 3.14bugs and security fixesskip newstestsTests in the Lib/test dir
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

8 participants
@twisteroidambassador@bedevere-bot@gvanrossum@willingc@arhadthedev@kumaraditya303@serhiy-storchaka@Yhg1s

[8]ページ先頭

©2009-2025 Movatter.jp