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-82082: Make our test suite pass on an IPv6-only Linux host#26225

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

Closed
gpshead wants to merge28 commits intopython:mainfromgpshead:ipv6_only_fixes

Conversation

gpshead
Copy link
Member

@gpsheadgpshead commentedMay 19, 2021
edited by bedevere-bot
Loading

Background: A true IPv6-only host has no IPv4 localhost 127.0.0.1 or IPv4 AF_INET stack enabled at all. I realize these are rare to most people. They're not to me & I have buildbot ready and waiting to go once I get things in our tree into decent shape. I'll post how that was setup in a gist later.

This is a collection of changes, not intended for submission via this branch. Likely to be split up across a variety of PRs addressing each individual test and a pre-PR for the test.support.socket_helper changes. But it makes for good initial viewing and study of patterns by showing this branch as a draft PR.

Status

Where I started

24 tests failed:    test_asynchat test_asyncore test_docxmlrpc test_eintr test_epoll    test_ftplib test_httplib test_imaplib test_multiprocessing_fork    test_multiprocessing_forkserver test_multiprocessing_spawn    test_nntplib test_os test_poplib test_robotparser test_smtplib    test_socket test_ssl test_support test_sys test_telnetlib    test_urllib2_localnet test_venv test_wsgiref

Where I'm at

At the time of writing this message, I have fixed all of the above to work in this branch!

At least four tests were hanging and still hang. Separate BPO issues are open for them: test_asyncio test_httpservers test_logging test_xmlrpc

I haven't yet run regrtest with all of the -u network flags enabled so I'm no doubt missing some more failures or hangs.

https://bugs.python.org/issue37901

Tests that are agnostic about the IP protocol used will use whicheverthe socket_helper module deems appropriate for the host.
there's a _lot_ more cleanup that could be done in here.the capability skip decorators are applied in an inconsistentmanner.  some on the base class, others way down on the leafTest classes.  yuck.
Also makes the test_multiprocessing suites work on IPv6-only hosts.
@gpsheadgpshead added type-bugAn unexpected behavior, bug, or error testsTests in the Lib/test dir sprint DO-NOT-MERGE labelsMay 19, 2021
@gpsheadgpshead self-assigned thisMay 19, 2021
Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

I suggest to start with a PR only to add get_family() and get_bound_ip_socket_and_port() (and IPV4_ENABLED, needed by get_family) to socket_helper. You can pick a few modified tests which only use these functions, like test_asynchat. It's easier to review a smaller PR.

Then you can write a PR for multiprocessing which adds tcp_socket().

When you add a function in test.support, it's good to document it at:
https://docs.python.org/dev/library/test.html#module-test.support.socket_helper

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

"TODO(gpshead): We should support ahttps://pypi.org/project/portpicker/ portserver or equivalent process running on our buildbot hosts and use that portpicker library"

What is the advantage compared to find_unused_port()?

One find_unused_port() flaw is that there is a race condition if two processes call it at the same time:https://bugs.python.org/issue38697

But I'm not convinced by the find_unused_port() design. It sounds better to simply... not use it at all. Like create a socket with port=0 and then get the port number from the socket object.

@gpshead
Copy link
MemberAuthor

I suggest to start with a PR only to add get_family() and get_bound_ip_socket_and_port() (and IPV4_ENABLED, needed by get_family) to socket_helper. You can pick a few modified tests which only use these functions, like test_asynchat. It's easier to review a smaller PR.

This is a draft PR that isn't intended for direct submission. It'll be broken up into sub-PRs exactly like that once I'm happy with how it looks. :)

For starters, this is a way to test my branch in CI and on buildbots as I evolve the changes.

"TODO(gpshead): We should support ahttps://pypi.org/project/portpicker/ portserver or equivalent process running on our buildbot hosts and use that portpicker library"

What is the advantage compared to find_unused_port()?

Thats a long term idea that I don't intend to solve as it'd require infrastructure changes on every buildbot worker's part. I'll probably just drop the todo. It has advantages in that it is centralized port management so that multiple tests running in parallel don't hit a race condition when binding to port 0 to obtain a "unique" port to reuse. It'd solve issue38697 in the face of tests that still want to use the unfortunate "give me a port number" approach.

find_unused_port is always the worst API option. I'm not happy with the changes to it in socket_helper either. I'll step back and see which existing messy tests can easily be refactored to not use it after I get more things working.

Some things tests by their nature and code API structure need to start with a port number rather than a bound socket. I'm attempting to avoid introducing non-test API changes and features when possible for now.

@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actionsgithub-actionsbot added the staleStale PR or inactive for long period of time. labelJun 20, 2021
@github-actionsgithub-actionsbot removed the staleStale PR or inactive for long period of time. labelAug 8, 2022
@arhadthedevarhadthedev changed the titlebpo-37901: Make our test suite pass on an IPv6-only Linux hostgh-82082: Make our test suite pass on an IPv6-only Linux hostApr 29, 2023
@arhadthedev
Copy link
Member

Removing sprint because the PR missed the ones in 2021, 2022, and 2023.

@arhadthedev
Copy link
Member

test_nntplib was removed ingh-104894,asyncore/asynchat ingh-96580.

Could you resolve merge conflicts to rerun the tests, please?

@gpshead
Copy link
MemberAuthor

i'm not intending to continue with this work.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@vstinnervstinnervstinner left review comments

@berkerpeksagberkerpeksagAwaiting requested review from berkerpeksagberkerpeksag will be requested when the pull request is marked ready for reviewberkerpeksag is a code owner

@vsajipvsajipAwaiting requested review from vsajipvsajip will be requested when the pull request is marked ready for reviewvsajip is a code owner

@picnixzpicnixzAwaiting requested review from picnixzpicnixz will be requested when the pull request is marked ready for reviewpicnixz is a code owner

@1st11st1Awaiting requested review from 1st11st1 will be requested when the pull request is marked ready for review1st1 is a code owner

@asvetlovasvetlovAwaiting requested review from asvetlovasvetlov will be requested when the pull request is marked ready for reviewasvetlov is a code owner

@kumaraditya303kumaraditya303Awaiting requested review from kumaraditya303kumaraditya303 will be requested when the pull request is marked ready for reviewkumaraditya303 is a code owner

@willingcwillingcAwaiting requested review from willingcwillingc will be requested when the pull request is marked ready for reviewwillingc is a code owner

Assignees

@gpsheadgpshead

Labels
awaiting core reviewDO-NOT-MERGEtestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

6 participants
@gpshead@arhadthedev@vstinner@the-knights-who-say-ni@ezio-melotti@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp