GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-82082: Make our test suite pass on an IPv6-only Linux host by gpshead · Pull Request #26225 · python/cpython

Conversation

@gpshead

@gpshead gpshead commented May 19, 2021 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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

  • Issue: 21 tests fail when run on an IPv6-only host #82082

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gpshead added 19 commits May 16, 2021 22:39
@gpshead
Support helpers for running on non-IPv4 IPv6-only hosts.
39708de
@gpshead
Fixes eight testsuites to work on IPv6-only hosts.
aa9e7c5
@gpshead
Make test_support pass on IPv6 only.
ee00e8b
@gpshead
Make test_os work on IPv6-only.
29efd49
@gpshead
fix test_telnetlib IPv6-only, introduce get_family helper.
d51dc79
@gpshead
Fix test_urllib2_localnet for IPv6-only.
0c95594
@gpshead
tcp_socket() to replace socket.socket() in tests.
7938fdc
@gpshead
make test_ssl pass on IPv6-only.
6436757
@gpshead
cleanup a bit.
d752f1a
@gpshead
Make test_httplib pass IPv6-only.
b726756
@gpshead
Make test_wsgiref pass on IPv6-only.
66054f4
@gpshead
fix test_smtplib for IPv6-only.
f20c40a
@gpshead
Fix test_poplib for IPv6-only.
8859b2a
@gpshead
Make test_asyncore IPv6-only friendly.
d485dc3
@gpshead
make test_asynchat IPv6-only friendly.
77ed056
@gpshead
Add udp_socket(), use SkipTest.
99e0665
@gpshead
Allow test_socket to work on IPv6-only hosts.
03aac81
Tests that are agnostic about the IP protocol used will use whichever
the socket_helper module deems appropriate for the host.
@gpshead
cleanup test names to clarify IPv4 status.
56d179e
there's a _lot_ more cleanup that could be done in here.
the capability skip decorators are applied in an inconsistent
manner.  some on the base class, others way down on the leaf
Test classes.  yuck.
@gpshead
Add AF_INET6 support to multiprocessing IPC.
7d55a83
Also makes the test_multiprocessing suites work on IPv6-only hosts.
@gpshead gpshead added type-bug An unexpected behavior, bug, or error tests Tests in the Lib/test dir sprint DO-NOT-MERGE labels May 19, 2021
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label May 19, 2021
@bedevere-bot bedevere-bot added the awaiting core review label May 19, 2021
@gpshead gpshead self-assigned this May 19, 2021
gpshead added 4 commits May 18, 2021 18:43
@gpshead
Fix test_httpservers for IPv6-only hosts.
1a72129
@gpshead
If starting a logging config server on AF_INET fails, try AF_INET6.
bc6d51a
@gpshead
Fix test_logging for use on IPv6-only hosts.
1317e7a
@gpshead
Make test_xmlrpc work on IPv6-only hosts rather than hang.
6d50fa5
gpshead added 3 commits May 18, 2021 19:12
@gpshead
Prevent test_asyncio from hanging on an IPv6-only host.
be88847
@gpshead
Fix test_asyncio.test_streams to work on IPv6-only.
5d0f8d7
@gpshead
Fix socket_helper sock vs tempsock paste error..
0b556da
vstinner
vstinner reviewed May 19, 2021
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

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.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
vstinner
vstinner reviewed May 19, 2021
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

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.

"TODO(gpshead): We should support a https://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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gpshead

gpshead commented May 19, 2021

Copy link
Copy Markdown
Member Author

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 a https://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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gpshead added 2 commits May 19, 2021 09:10
@gpshead
socket_helper typo (yes, find_unused_port is too ugly...)
b7688e4
@gpshead
Undo find_unused_port complexity, use get_family()
2965d32
@github-actions

github-actions Bot commented Jun 20, 2021

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Jun 20, 2021
@ezio-melotti ezio-melotti removed the CLA signed label Jul 13, 2022
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Aug 8, 2022
@arhadthedev arhadthedev changed the title bpo-37901: Make our test suite pass on an IPv6-only Linux host gh-82082: Make our test suite pass on an IPv6-only Linux host Apr 29, 2023
@arhadthedev arhadthedev removed the sprint label Apr 29, 2023
@arhadthedev

arhadthedev commented Apr 29, 2023

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@arhadthedev

arhadthedev commented May 25, 2023

Copy link
Copy Markdown
Member

test_nntplib was removed in gh-104894, asyncore/asynchat in gh-96580.

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gpshead

gpshead commented May 7, 2024

Copy link
Copy Markdown
Member Author

i'm not intending to continue with this work.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gpshead gpshead closed this May 7, 2024
@gpshead gpshead mentioned this pull request May 7, 2024
21 tests fail when run on an IPv6-only host #82082
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vstinner vstinner vstinner left review comments
@orsenthil orsenthil Awaiting requested review from orsenthil orsenthil will be requested when the pull request is marked ready for review orsenthil is a code owner
@vsajip vsajip Awaiting requested review from vsajip vsajip will be requested when the pull request is marked ready for review vsajip is a code owner
@giampaolo giampaolo Awaiting requested review from giampaolo giampaolo will be requested when the pull request is marked ready for review giampaolo is a code owner
@picnixz picnixz Awaiting requested review from picnixz picnixz will be requested when the pull request is marked ready for review picnixz is a code owner
@1st1 1st1 Awaiting requested review from 1st1 1st1 will be requested when the pull request is marked ready for review 1st1 is a code owner
@asvetlov asvetlov Awaiting requested review from asvetlov asvetlov will be requested when the pull request is marked ready for review asvetlov is a code owner
@kumaraditya303 kumaraditya303 Awaiting requested review from kumaraditya303 kumaraditya303 will be requested when the pull request is marked ready for review kumaraditya303 is a code owner
@willingc willingc Awaiting requested review from willingc willingc will be requested when the pull request is marked ready for review willingc is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@gpshead gpshead

Labels

awaiting core review DO-NOT-MERGE tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@gpshead @arhadthedev @vstinner @the-knights-who-say-ni @ezio-melotti @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.