Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

DNS query does not do any retries when dns server returned error #66

Closed
olderwei opened this issue Apr 29, 2019 · 10 comments
Closed

DNS query does not do any retries when dns server returned error #66

olderwei opened this issue Apr 29, 2019 · 10 comments

Comments

@olderwei
Copy link

I configured three nameserver in /etc/resolv.conf file. When DNS Server is requested, an error is returned similar to ServFail, lua-resty-dns-client and lua-resty-dns will not retry other DNS Server,Is there a specific reason behind this?

@olderwei
Copy link
Author

@Tieske

@Tieske
Copy link
Member

Tieske commented Apr 29, 2019

what's your resolv.conf, and what is your code?

The resolver should drop the configuration in the logs when initialized, can you show those logs?

@Tieske
Copy link
Member

Tieske commented Apr 29, 2019

Log level must be debug, retries for example: https://github.com/Kong/lua-resty-dns-client/blob/master/src/resty/dns/client.lua#L583

@olderwei
Copy link
Author

The log is as follows:
2019/04/30 10:08:05 [debug] 19566#0: [lua] client.lua:571: init(): [dns-client] nameserver 180.76.76.76
2019/04/30 10:08:05 [debug] 19566#0: [lua] client.lua:571: init(): [dns-client] nameserver 219.141.136.10
2019/04/30 10:08:05 [debug] 19566#0: [lua] client.lua:571: init(): [dns-client] nameserver 223.5.5.5
2019/04/30 10:08:05 [debug] 19566#0: [lua] client.lua:576: init(): [dns-client] attempts = 5

The kong's error log is as follows:
2019/04/26 21:16:10 [error] 141470#0: 373038045 [lua] balancer.lua:808: execute(): [dns] dns server error: 2 server failure. Tried: (short)..com:(na) - cache-miss
..com:1 - cache-hit/dns server error: 2 server failure
..com:33 - cache-hit/dns server error: 2 server failure
..com:5 - cache-hit/dns server error: 2 server failure
, client: 172.
.., server: kong, request: "GET /** HTTP/1.1", host: "..com"

I just saw this pr, which is similar to what I want to express.
openresty/lua-resty-dns#9

I wonder if the following code can be modified.
https://github.com/openresty/lua-resty-dns/blob/bb21982a51cfdab22a8c3bd4a37f92b1c56aa43d/lib/resty/dns/resolver.lua#L885
`
if err and err ~= "id mismatch" then
break
end

if answers.errcode then
break
end

if answers then
return answers, nil, tries
end
`

@olderwei
Copy link
Author

olderwei commented May 4, 2019

@Tieske

@Tieske
Copy link
Member

Tieske commented May 6, 2019

That is a weird log, did you redact the logs to remove the hostname? the name tried is "..com" which doesn't resolve.

Additionally the log snippet you posted above contains - cache-hit/dns server error: 2 server failure which means that you're hitting the cached error. This is not the initial error. Note that errors are also cached, see https://docs.konghq.com/1.1.x/configuration/#dns_error_ttl

What upstream hostname are you trying to resolve? And what is the initial DNS error?

@Tieske
Copy link
Member

Tieske commented May 6, 2019

btw: in the error message 2 server failure actually means that the resolver reached out to the DNS server, and the DNS server responded with an error code 2, which indicates a server failure.

Essentially this means that on Kong side everything works as designed. So my guess is that you mis configured your upstream hostname since it has ..com, which is not a valid hostname.

@Tieske
Copy link
Member

Tieske commented May 8, 2019

@olderwei were you able to resolve this?

Another thing that comes to mind: when the UDP reply gets truncated (answer too big), the resolver will fall back on a TCP query. Now this TCP query does not handle retries. See also openresty/lua-resty-dns#40

@Tieske
Copy link
Member

Tieske commented Jun 25, 2019

@olderwei any update?

@Tieske
Copy link
Member

Tieske commented May 14, 2020

closing due to no response

@Tieske Tieske closed this as completed May 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants