Skip to content
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

Failure to Establish Session to Remote w/ Multiple Endpoints #550

Open
NeonixRIT opened this issue Dec 5, 2024 · 0 comments
Open

Failure to Establish Session to Remote w/ Multiple Endpoints #550

NeonixRIT opened this issue Dec 5, 2024 · 0 comments

Comments

@NeonixRIT
Copy link

NeonixRIT commented Dec 5, 2024

I came across an edge case testing the example http clients with https://cloudflare-quic.com.

Environment

  • Network
    • Carrier Grade NAT
    • IPv6 enabled network
  • Device
    • MacOS 15.2
    • Python 3.13
      • httpcore==1.0.7
      • httpx==0.27.2
      • aioquic==1.2.0
      • anyio==4.6.2.post1

https://cloudflare-quic.com has an IPv6 resolvable address which gets returned by getaddrinfo, however, it does not respond to QUIC or TCP packets sent to this address (sometimes). This causes the connection to fail despite getaddrinfo resolving an IPv4 address for the endpoint that does accept QUIC and TCP packets.

This is handled quite gracefully in httpx thanks to httpcores use of anyios connect_tcp function which implements the stateless version of the Happy Eyeballs algorithm outlined in RFC 6555 (aka 'Fast Fallback'). Essentially, if both IPv6 and IPv4 addresses are resolved, it attempts to connect to the IPv6 address first, if it gets a response before some delay (~0.25s) it continues with that connection, otherwise it attempts to create a session with the IPv4 address in parallel, and continues with whichever gets a response first.

Edit: Formatting, clarify Happy Eyeballs description to be more accurate, remove irrelevant sentence.

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

No branches or pull requests

1 participant