mirage / ocaml-dns

OCaml implementation of the DNS protocol
BSD 2-Clause "Simplified" License
106 stars 43 forks source link

github.com is unavailable the second time #259

Closed dinosaure closed 3 years ago

dinosaure commented 3 years ago

I relaunched a DNS resolver on my side and it seems that if we want to resolve github.com a second time, the resolver do a loop which never resolves the IP address. This is the full log of what happen when I do dig github.com @my_dns_resolver:

console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: INF [application] reacting to (from 10.0.0.1:44010) header EF6F (query) operation Query rcode 
console data 2021-07-20T11:17:43-00:00: no error flags: authentic data, recursion desired question github.com A?
console data 2021-07-20T11:17:43-00:00: data query additional 
console data 2021-07-20T11:17:43-00:00: EDNS EDNS rcode 0 version 0 dnssec_ok false payload_size 4096 extensions cookie 
console data 2021-07-20T11:17:43-00:00: 0a 43 9f 12 02 a0 2b 3b TSIG no
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: INF [application] resolving header EF6F (query) operation Query rcode 
console data 2021-07-20T11:17:43-00:00: no error flags: authentic data, recursion desired question github.com A?
console data 2021-07-20T11:17:43-00:00: data query additional 
console data 2021-07-20T11:17:43-00:00: EDNS EDNS rcode 0 version 0 dnssec_ok false payload_size 4096 extensions cookie 
console data 2021-07-20T11:17:43-00:00: 0a 43 9f 12 02 a0 2b 3b TSIG no
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: WRN [application] error cache drop while looking up github.com (A), query
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: DBG [application] go github.com
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: DBG [application] resolve returned zone com query github.com (A), ip 192.12.94.30
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: DBG [application] have to query (zone com) github.com (A) using ip 192.12.94.30
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: DBG [application] maybe_query: query 192.12.94.30 github.com (A)
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: DBG [dns_mirage] udp: sending 39 bytes from 35283 to 192.12.94.30:53
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: DBG [ipv4] ip write: mtu is 1500, hdr_len is 20, size 8 payload len 39, needed_bytes 67
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: INF [application] reacting to (from 192.12.94.30:53) header AC35 (response) operation Query rcode 
console data 2021-07-20T11:17:43-00:00: no error flags:  question github.com A? data answer 
console data 2021-07-20T11:17:43-00:00: authority github.com.   172800  NS  ns-1707.awsdns-21.co.uk.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  dns4.p08.nsone.net.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  dns3.p08.nsone.net.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  dns2.p08.nsone.net.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  dns1.p08.nsone.net.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  ns-1283.awsdns-32.org.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  ns-520.awsdns-01.net.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  ns-421.awsdns-52.com.
console data 2021-07-20T11:17:43-00:00: additional ns-421.awsdns-52.com.    172800  A   205.251.193.165
console data 2021-07-20T11:17:43-00:00: EDNS EDNS rcode 0 version 0 dnssec_ok false payload_size 4096 extensions  TSIG no
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: INF [application] handling reply header AC35 (response) operation Query rcode 
console data 2021-07-20T11:17:43-00:00: no error flags:  question github.com A? data answer 
console data 2021-07-20T11:17:43-00:00: authority github.com.   172800  NS  ns-1707.awsdns-21.co.uk.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  dns4.p08.nsone.net.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  dns3.p08.nsone.net.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  dns2.p08.nsone.net.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  dns1.p08.nsone.net.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  ns-1283.awsdns-32.org.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  ns-520.awsdns-01.net.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  ns-421.awsdns-52.com.
console data 2021-07-20T11:17:43-00:00: additional ns-421.awsdns-52.com.    172800  A   205.251.193.165
console data 2021-07-20T11:17:43-00:00: EDNS EDNS rcode 0 version 0 dnssec_ok false payload_size 4096 extensions  TSIG no
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: DBG [application] scrubbing (bailiwick com) data header AC35 (response) operation Query rcode 
console data 2021-07-20T11:17:43-00:00: no error flags:  question github.com A? data answer 
console data 2021-07-20T11:17:43-00:00: authority github.com.   172800  NS  ns-1707.awsdns-21.co.uk.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  dns4.p08.nsone.net.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  dns3.p08.nsone.net.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  dns2.p08.nsone.net.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  dns1.p08.nsone.net.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  ns-1283.awsdns-32.org.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  ns-520.awsdns-01.net.
console data 2021-07-20T11:17:43-00:00: github.com. 172800  NS  ns-421.awsdns-52.com.
console data 2021-07-20T11:17:43-00:00: additional ns-421.awsdns-52.com.    172800  A   205.251.193.165
console data 2021-07-20T11:17:43-00:00: EDNS EDNS rcode 0 version 0 dnssec_ok false payload_size 4096 extensions  TSIG no
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: DBG [application] Dns_cache.set NS github.com entry NS
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: DBG [application] set: github.com (NS) found rank authoritative authority data insert rank additional data: 1
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: DBG [application] Dns_cache.set A ns-421.awsdns-52.com entry A
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: DBG [application] set: ns-421.awsdns-52.com (A) found rank additional data insert rank additional data: 0
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: DBG [application] now querying github.com (A)
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: WRN [application] error cache drop while looking up github.com (A), query
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: DBG [application] go github.com
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: DBG [application] resolve returned zone com query github.com (A), ip 192.43.172.30
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: DBG [application] have to query (zone com) github.com (A) using ip 192.43.172.30
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: DBG [application] maybe_query: query 192.43.172.30 github.com (A)
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: DBG [dns_mirage] udp: sending 39 bytes from 25198 to 192.43.172.30:53
console data 2021-07-20T11:17:43-00:00: 2021-07-20 11:17:43 -00:00: DBG [ipv4] ip write: mtu is 1500, hdr_len is 20, size 8 payload len 39, needed_bytes 67

And it repeats the same log multiple times.

dinosaure commented 3 years ago

It's not strictly the second time when the DNS resolver fails but (at least) ~1 hour after the first request.

hannesm commented 3 years ago

thanks. we were able to reproduce and fix in https://github.com/mirage/ocaml-dns/commit/ca0e1cfed25976191c02f8e1474a759b5c38b619

dinosaure commented 3 years ago

Thanks, I updated my unikernel with this version, we will see next time if our IRC bot still can push on GitHub :+1:.

dinosaure commented 3 years ago

I can confirm that the bug was fixed - my unikernel still is alive and can get the github.com API the second time.