[Android] Added Happy Eyeballs for address selection#32889
Closed
marcesengel wants to merge 1 commit into
Closed
Conversation
0c23f04 to
cb650f0
Compare
|
Note for reviewers: Reddit deleted their IPv6 AAAA DNS records at one point probably to work around issues with their Android app not implementing Happy Eyeballs: Ref: This issue can be quite important. |
This was referenced Feb 4, 2022
Contributor
|
See my comment on #33045 (comment) for next steps on how to proceed here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
On android IPv6 issues can lead to very long loading times, as first all returned IPv6 addresses for a domain are tried until they timeout and after that IPv4 is used. This PR makes use of the Happy Eyeballs as suggested in #32730.
Changelog
fetchhangs indefinitely with IPv6 hosts on some devices (Happy Eyeballs) #32730[Android] [Feature] - Added Happy Eyeballs for network request target address selection
Test Plan
In my local wifi www.google.com was not reachable by IPv6, causing a timeout and failover on the first request. With the proposed PR the IPv4 request was started after the set timeout (t = a + (a * 1.5 ^ 1) + ... + (a * 1.5 ^ (n - 1)) for the nth request, where a = 400 ms) and was elected the winner, cancelling the IPv6 request.
The debug tools only showed one network request.
Edit: Also tried throwing an
UnknownHostExceptionin thelookupfunction, simulated every possible address failing by only callingcall.cancel()inonConnectionAcquiredand tried the selected address failing by callingcall.cancel()at the end ofonConnectionAcquired.