Nginx resolver NGX_RESOLVE_SERVFAIL

Hi,

I have strange behavior for nginx when I’m getting:
… … … 0010 = Reply code: Server failure (2)

All logs of my production is full of tries to resolve some domains where
timeout happened
and proxying BIND returned (Server failure (2))

below is tcpdump for it.

tcpdump -Nnni lo udp port 53

tcpdump: verbose output suppressed, use -v or -vv for full protocol
decode
listening on lo, link-type EN10MB (Ethernet), capture size 96 bytes
15:29:23.010072 IP 127.0.0.1.39498 > 127.0.0.1.53: 12118+ A?
www.jsoftj.com. (32)
15:29:28.006177 IP 127.0.0.1.39498 > 127.0.0.1.53: 12118+ A?
www.jsoftj.com. (32)
15:29:33.006157 IP 127.0.0.1.39498 > 127.0.0.1.53: 12118+ A?
www.jsoftj.com. (32)
15:29:38.006155 IP 127.0.0.1.39498 > 127.0.0.1.53: 12118+ A?
www.jsoftj.com. (32)
15:29:43.006162 IP 127.0.0.1.39498 > 127.0.0.1.53: 12118+ A?
www.jsoftj.com. (32)
15:29:48.006400 IP 127.0.0.1.39498 > 127.0.0.1.53: 12118+ A?
www.jsoftj.com. (32)
15:29:53.010832 IP 127.0.0.1.53 > 127.0.0.1.39498: 12118 ServFail 0/0/0
(32)
15:29:53.010904 IP 127.0.0.1.53 > 127.0.0.1.39498: 12118 ServFail 0/0/0
(32)
15:29:53.010980 IP 127.0.0.1.53 > 127.0.0.1.39498: 12118 ServFail 0/0/0
(32)
15:29:53.011036 IP 127.0.0.1.53 > 127.0.0.1.39498: 12118 ServFail 0/0/0
(32)
15:29:53.011072 IP 127.0.0.1.53 > 127.0.0.1.39498: 12118 ServFail 0/0/0
(32)
15:29:53.011098 IP 127.0.0.1.53 > 127.0.0.1.39498: 12118 ServFail 0/0/0
(32)

In nginx error.log I’m finding a lot messages as:
2011/03/18 16:20:42 [error] 15214#0: unexpected response for

2011/03/18 16:20:42 [error] 15214#0: unexpected response for

2011/03/18 16:20:42 [error] 15214#0: unexpected response for

2011/03/18 16:20:42 [error] 15214#0: unexpected response for

2011/03/18 16:20:42 [error] 15214#0: unexpected response for

2011/03/18 16:20:42 [error] 15214#0: unexpected response for

changing
if (code > NGX_RESOLVE_REFUSED) {
to
if (code > NGX_RESOLVE_REFUSED || NGX_RESOLVE_SERVFAIL ) {
in ngx_resolver_process_response
is solving problem.
Is it bug or feature :slight_smile: ?
or what the best way to solve this issue?

Posted at Nginx Forum: