'Netty is unable to resolve a DNS name
I use Marketo to send emails from my Java application, I submit REST requests to the Marketo API using WebClient. Recently sending emails has started throwing exceptions, and I discovered that Netty is throwing the following error:
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)
If I interrogate that DNS name using dig, I get a NOERROR status, so why is Netty throwing this error? The following is the output from 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
Solution 1:[1]
I was able to resolve this changing the default DNS resolver as per a Reactor Netty issue here (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()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Fam |
