Slow HttpClient operation caused by DNS resolution failure on iOS

The issue has been discussed in flutter, move it here since it’s more relevant.

Our environment is iOS version: 13.3.1. iPhone 6S. (And some customers reported same problems on different devices, iPhone 7, iPhone X, latest iOS system as of now).

As a reference, I created a flutter sample project, with

flutter create –androidx -t app sample

Then, add some code in main.dart to perform a simple http get request, whenever user clicks the + button and display the time spent. (
This simplest example, exhibit the same behavior.

Took about 5 second on wifi (On the same device, using safari can open the same page instantaneously under the same wifi connection)
Took about 500 ms on 4G

I run sample on flutter v1.12.13+hotfix.8, v1.9.1 in debug and release mode. All got the similar results.

Further testing showed that it may be related to dns. I tried change the url to its ip address instead of domain name, the speed isn’t slow at all.
And if I set the iPhone’s dns to manual mode, and remove the ipv6 dns server (which is configured automatically), the problem is gone too.

So, here is the question, how come the ipv6 dns server will affect the flutter app’s dns resolution? While other apps are not affected. It’s not a feasible solution if we have to ask our app user to configure the dns manually when they encounter this problem. There still should be something different in dart code base that handle the dns in a different way.

Author: Fantashit

2 thoughts on “Slow HttpClient operation caused by DNS resolution failure on iOS

Comments are closed.