resty-dns: unexpected response for xxx.com; wrong ident 21550 response for xxx.com, expect 56365

130 views
Skip to first unread message

Yurnero Zhang

unread,
Jan 21, 2019, 10:35:51 PM1/21/19
to openresty
Hi,
       我在使用 lua-resty-dns 的时候,nginx error 日志偶尔会报如上错误:
       2019/01/17 08:10:12 [error] 17129#0: wrong ident 21550 response for xxx.xxx.com, expect 56365
       2019/01/17 13:47:12 [error] 17133#0: unexpected response for xxx.xxx.com
       请问这一般是什么原因呢?
      
       我是使用resty-dns解析域名,然后把解析到的 ip 地址放在缓存中,设置ttl(dns返回的ttl),过期就重新解析;
       除了这个错误,还经常会报解析失败,但是我用原生nginx配置的时候就不会出错,是我的使用姿势错了吗?
       我的 openresty 版本是 openresty/1.13.6.1;
       谢谢。

Yurnero Zhang

unread,
Jan 21, 2019, 10:46:51 PM1/21/19
to openresty
lua-resty-dns 最终调用的是 nginx 自己的 dns 解析模块吗?

在 2019年1月22日星期二 UTC+8上午11:35:51,Yurnero Zhang写道:

tokers

unread,
Jan 21, 2019, 10:51:28 PM1/21/19
to openresty
Hello!

这个一般是因为你的 DNS server 发送了重复的 udp 包(或者哪一层链路导致包重复),
nginx 检测到之后会打印一条日志,然后丢弃这个包,目前来看是无害的。

tokers

unread,
Jan 22, 2019, 3:24:18 AM1/22/19
to openresty
Hello!

> lua-resty-dns 最终调用的是 nginx 自己的 dns 解析模块吗?

不是的,lua-resty-dns 是基于 Cosocket 去实现的。

Yurnero Zhang

unread,
Jan 22, 2019, 9:22:01 PM1/22/19
to openresty
多谢回复。

那 Cosocket 是不是调用了 nginx 自己的 dns 解析模块呢?
我用openresty写的代码,只有我自己的代码解析了域名,但是日志里却偶尔打印了上面的nginx错误日志。。。


在 2019年1月22日星期二 UTC+8下午4:24:18,tokers写道:

tokers

unread,
Jan 22, 2019, 9:23:51 PM1/22/19
to openresty
Hello!

> 那 Cosocket 是不是调用了 nginx 自己的 dns 解析模块呢?

你是在 tcpsock:connect 里传入过域名吗?如果是这种用法,
那么 cosocket 是调用 Nginx 自己的运行时 DNS name resolution 机制的。

Yurnero Zhang

unread,
Jan 23, 2019, 4:52:07 AM1/23/19
to openresty
没有的,我直接调用的 resolver:query((host)
我看了代码,默认情况下是调用调用的udp:send;返回  "truncated"  的时候会调用 _tcp_query
我再看看我项目的其它模块,看看有没有你说的这种情况。。。

我还有个问题想问一下,调用 resolver:query((host) 的时候,和设置第二个参数 r:query(hostname, {qtype = r.TYPE_A}) 有什么区别吗,我抓包看了下返回结果,都一样啊;

问题貌似有点初级,接触openresty开发时间有点短~~~


在 2019年1月23日星期三 UTC+8上午10:23:51,tokers写道:
Reply all
Reply to author
Forward
0 new messages