Issue with using 1.1.1.1 as DNS
When I run a simple python program to fetch some data from any url, I get a delay of around 6 seconds.
For example:
This seems to happen because it queries both the A and AAAA record at the same time and I only get a response for the A record (which was queried first). After not getting the AAAA record it asks for both of the records again but in succession. If I use the proxy of my router I don't have said issue. The first screenshot attached to the post is Wireshark with the filter set to
frame contains "example"
.
If I specify for what type of TCPConnector to use e.g. with:
It only asks for the AAAA record and I don't get any delay.
The second Screenshot is when I've used my router as my DNS. Another important thing to add is that I am using archlinux on kernel version 6.6.8.arch1-1. It would be nice to know if this is an issue caused by me which I am able to resolve by myself, if this is expected behaviour or an issue with the cloudflare DNS.
Thank you!2 Replies
I suspect you already tried but does the same thing happen with e.g. 8.8.8.8?
yep
It only happens when the socket family is set to AF_UNSPEC (which is the default)
I wrote basically the same in C++ and I get the same issue as in python if you use AF_UNSPECC as the socket family (which makes sense).