Netty 无法解析 DNS 名称
Netty is unable to resolve a DNS name
我使用 Marketo 从我的 Java 应用程序发送电子邮件,我使用 WebClient 向 Marketo API 提交 REST 请求。最近发邮件开始抛异常,发现Netty抛出如下错误:
Received a mismatching DNS response: DatagramDnsResponse(from: /100.96.1.1:53, to: /0:0:0:0:0:0:0:0:50578, 19016, QUERY(0), NoError(0), RD RA)
DefaultDnsQuestion(145-jnh-675.mktorest.com. IN A)
DefaultDnsRawRecord(145-jnh-675.mktorest.com. 91 IN A 4B)
Received a mismatching DNS response: DatagramDnsResponse(from: /100.96.1.1:53, to: /0:0:0:0:0:0:0:0:50578, 24563, QUERY(0), NoError(0), RD RA)
DefaultDnsQuestion(145-jnh-675.mktorest.com. IN AAAA)
DefaultDnsRawRecord(mktorest.com. 122 IN SOA 52B)
如果我使用 dig
查询该 DNS 名称,我会得到一个 NOERROR 状态,那么为什么 Netty 会抛出这个错误?以下是 dig.
的输出
$ dig 145-JNH-675.mktorest.com
; <<>> DiG 9.10.6 <<>> 145-JNH-675.mktorest.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44141
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;145-jnh-675.mktorest.com. IN A
;; ANSWER SECTION:
145-jnh-675.mktorest.com. 300 IN A 199.15.214.159
;; Query time: 96 msec
;; SERVER: 100.96.1.1#53(100.96.1.1)
;; WHEN: Tue Apr 19 17:55:05 EDT 2022
;; MSG SIZE rcvd: 58
我能够根据此处的 Reactor Netty 问题更改默认 DNS 解析器来解决此问题 (https://github.com/reactor/reactor-netty/issues/1431)。
final var httpClient = HttpClient.create().resolver(DefaultAddressResolverGroup.INSTANCE)
final var webClient = WebClient.builder().clientConnector(ReactorClientHttpConnector(httpClient)).build()
我使用 Marketo 从我的 Java 应用程序发送电子邮件,我使用 WebClient 向 Marketo API 提交 REST 请求。最近发邮件开始抛异常,发现Netty抛出如下错误:
Received a mismatching DNS response: DatagramDnsResponse(from: /100.96.1.1:53, to: /0:0:0:0:0:0:0:0:50578, 19016, QUERY(0), NoError(0), RD RA)
DefaultDnsQuestion(145-jnh-675.mktorest.com. IN A)
DefaultDnsRawRecord(145-jnh-675.mktorest.com. 91 IN A 4B)
Received a mismatching DNS response: DatagramDnsResponse(from: /100.96.1.1:53, to: /0:0:0:0:0:0:0:0:50578, 24563, QUERY(0), NoError(0), RD RA)
DefaultDnsQuestion(145-jnh-675.mktorest.com. IN AAAA)
DefaultDnsRawRecord(mktorest.com. 122 IN SOA 52B)
如果我使用 dig
查询该 DNS 名称,我会得到一个 NOERROR 状态,那么为什么 Netty 会抛出这个错误?以下是 dig.
$ dig 145-JNH-675.mktorest.com
; <<>> DiG 9.10.6 <<>> 145-JNH-675.mktorest.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44141
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;145-jnh-675.mktorest.com. IN A
;; ANSWER SECTION:
145-jnh-675.mktorest.com. 300 IN A 199.15.214.159
;; Query time: 96 msec
;; SERVER: 100.96.1.1#53(100.96.1.1)
;; WHEN: Tue Apr 19 17:55:05 EDT 2022
;; MSG SIZE rcvd: 58
我能够根据此处的 Reactor Netty 问题更改默认 DNS 解析器来解决此问题 (https://github.com/reactor/reactor-netty/issues/1431)。
final var httpClient = HttpClient.create().resolver(DefaultAddressResolverGroup.INSTANCE)
final var webClient = WebClient.builder().clientConnector(ReactorClientHttpConnector(httpClient)).build()