Когда Netty получила ответы от серверов имен для хоста, имя хоста было успешно разрешено.Через некоторое время (менее одной минуты), когда от одного и того же хоста не было получено ответа для того же хоста, netty выбросило исключение io.netty.resolver.dns.DnsResolveContext $ SearchDomainUnknownHostException.Можем ли мы установить некоторые кэширующие TTL для решения таких проблем?
Нетти, запрашивающий dns для имени хоста: hostname.removed.by.me.com
2019-01-21 21:38:30,204+0000 [toe=00d7vsrry4eguu] [redisson-netty-17-4] DEBUG - [id: 0x00c6985d] WRITE: [17454: /10.12.1.198:53], DefaultDnsQuestion(hostname.removed.by.me.com. IN A)
2019-01-21 21:38:30,205+0000 [toe=00d7vsrry4eguu] [redisson-netty-17-4] DEBUG - [id: 0x00c6985d] WRITE: [22100: /10.12.1.198:53], DefaultDnsQuestion(hostname.removed.by.me.com. IN AAAA)
2019-01-21 21:38:30,205+0000 [toe=00d7vsrry4eguu] [redisson-netty-17-4] DEBUG - [id: 0xf7e571f5] WRITE: [7006: /10.12.1.197:53], DefaultDnsQuestion(hostname.removed.by.me.com. IN A)
2019-01-21 21:38:30,205+0000 [toe=00d7vsrry4eguu] [redisson-netty-17-4] DEBUG - [id: 0xf7e571f5] WRITE: [643: /10.12.1.197:53], DefaultDnsQuestion(hostname.removed.by.me.com. IN AAAA)
Было успешно решено:
2019-01-21 21:38:30,205+0000 [toe=00d7vsrry4eguu] [redisson-netty-17-6] DEBUG - [id: 0xf7e571f5] RECEIVED: [643: /10.12.1.197:53], DatagramDnsResponse(from: /10.12.1.197:53, to: /0:0:0:0:0:0:0:0:51179, 643, QUERY(0), NoError(0), RD RA)
DefaultDnsQuestion(hostname.removed.by.me.com. IN AAAA)
DefaultDnsRawRecord(removed.by.me.com. 28 IN SOA 66B)
DefaultDnsRawRecord(OPT flags:0 udp:4000 0B)
2019-01-21 21:38:30,206+0000 [toe=00d7vsrry4eguu] [redisson-netty-17-6] DEBUG - [id: 0xf7e571f5] RECEIVED: [7006: /10.12.1.197:53], DatagramDnsResponse(from: /10.12.1.197:53, to: /0:0:0:0:0:0:0:0:51179, 7006, QUERY(0), NoError(0), RD RA)
DefaultDnsQuestion(hostname.removed.by.me.com. IN A)
DefaultDnsRawRecord(hostname.removed.by.me.com. 11 IN A 4B)
DefaultDnsRawRecord(OPT flags:0 udp:4000 0B)
2019-01-21 21:38:30,206+0000 [toe=00d7vsrry4eguu] [redisson-netty-17-6] DEBUG - [id: 0x00c6985d] RECEIVED: [22100: /10.12.1.198:53], DatagramDnsResponse(from: /10.12.1.198:53, to: /0:0:0:0:0:0:0:0:51178, 22100, QUERY(0), NoError(0), RD RA)
DefaultDnsQuestion(hostname.removed.by.me.com. IN AAAA)
DefaultDnsRawRecord(removed.by.me.com. 433 IN SOA 66B)
DefaultDnsRawRecord(OPT flags:0 udp:4000 0B)
2019-01-21 21:38:30,207+0000 [toe=00d7vsrry4eguu] [redisson-netty-17-6] DEBUG - [id: 0x00c6985d] RECEIVED: [17454: /10.12.1.198:53], DatagramDnsResponse(from: /10.12.1.198:53, to: /0:0:0:0:0:0:0:0:51178, 17454, QUERY(0), NoError(0), RD RA)
DefaultDnsQuestion(hostname.removed.by.me.com. IN A)
DefaultDnsRawRecord(hostname.removed.by.me.com. 11 IN A 4B)
DefaultDnsRawRecord(OPT flags:0 udp:4000 0B)
Через менее чем одну минуту снова был запрошен DNS для того же имени хоста.
2019-01-21 21:39:19,278+0000 [toe=00d7vsrry4eguu] [redisson-netty-17-1] DEBUG - [id: 0x00c6985d] WRITE: [51012: /10.12.1.198:53], DefaultDnsQuestion(hostname.removed.by.me.com. IN A)
2019-01-21 21:39:19,278+0000 [toe=00d7vsrry4eguu] [redisson-netty-17-1] DEBUG - [id: 0x00c6985d] WRITE: [18882: /10.12.1.198:53], DefaultDnsQuestion(hostname.removed.by.me.com. IN AAAA)
2019-01-21 21:39:19,278+0000 [toe=00d7vsrry4eguu] [redisson-netty-17-1] DEBUG - [id: 0xf7e571f5] WRITE: [51838: /10.12.1.197:53], DefaultDnsQuestion(hostname.removed.by.me.com. IN A)
2019-01-21 21:39:19,279+0000 [toe=00d7vsrry4eguu] [redisson-netty-17-1] DEBUG - [id: 0xf7e571f5] WRITE: [32353: /10.12.1.197:53], DefaultDnsQuestion(hostname.removed.by.me.com. IN AAAA)
От серверов имен не получено ответа, и netty выдало исключение:
2019-01-21 21:39:24,279+0000 [toe=00d7vsrry4eguu] [redisson-netty-17-6] ERROR - Unable to resolve hostname.removed.by.me.com io.netty.resolver.dns.DnsResolveContext$SearchDomainUnknownHostException: Search domain query failed. Original hostname: 'hostname.removed.by.me.com' failed to resolve 'hostname.removed.by.me.com' after 2 queries
at io.netty.resolver.dns.DnsResolveContext.finishResolve(DnsResolveContext.java:845) [netty-resolver-dns-4.1.30.Final.jar:4.1.30.Final]
at io.netty.resolver.dns.DnsResolveContext.tryToFinishResolve(DnsResolveContext.java:806) [netty-resolver-dns-4.1.30.Final.jar:4.1.30.Final]
at io.netty.resolver.dns.DnsResolveContext.query(DnsResolveContext.java:333) [netty-resolver-dns-4.1.30.Final.jar:4.1.30.Final]
at io.netty.resolver.dns.DnsResolveContext.query(DnsResolveContext.java:322) [netty-resolver-dns-4.1.30.Final.jar:4.1.30.Final]
at io.netty.resolver.dns.DnsResolveContext.access$500(DnsResolveContext.java:62) [netty-resolver-dns-4.1.30.Final.jar:4.1.30.Final]
at io.netty.resolver.dns.DnsResolveContext$3.operationComplete(DnsResolveContext.java:379) [netty-resolver-dns-4.1.30.Final.jar:4.1.30.Final]
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:511) [netty-common-4.1.30.Final.jar:4.1.30.Final]
at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:504) [netty-common-4.1.30.Final.jar:4.1.30.Final]
at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:483) [netty-common-4.1.30.Final.jar:4.1.30.Final]
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:424) [netty-common-4.1.30.Final.jar:4.1.30.Final]
at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:121) [netty-common-4.1.30.Final.jar:4.1.30.Final]
at io.netty.resolver.dns.DnsQueryContext.setFailure(DnsQueryContext.java:216) [netty-resolver-dns-4.1.30.Final.jar:4.1.30.Final]
at io.netty.resolver.dns.DnsQueryContext.access$300(DnsQueryContext.java:43) [netty-resolver-dns-4.1.30.Final.jar:4.1.30.Final]
at io.netty.resolver.dns.DnsQueryContext$4.run(DnsQueryContext.java:166) [netty-resolver-dns-4.1.30.Final.jar:4.1.30.Final]
at io.netty.util.concurrent.PromiseTask$RunnableAdapter.call(PromiseTask.java:38) [netty-common-4.1.30.Final.jar:4.1.30.Final]
at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:127) [netty-common-4.1.30.Final.jar:4.1.30.Final]
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) [netty-common-4.1.30.Final.jar:4.1.30.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404) [netty-common-4.1.30.Final.jar:4.1.30.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:462) [netty-transport-4.1.30.Final.jar:4.1.30.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897) [netty-common-4.1.30.Final.jar:4.1.30.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-common-4.1.30.Final.jar:4.1.30.Final]
at java.lang.Thread.run(Thread.java:745) [?:1.7.0_60]
Caused by: io.netty.resolver.dns.DnsNameResolverTimeoutException: [/10.12.1.197:53] query timed out after 5000 milliseconds (no stack trace available)
Есть ли способ увеличить TTL кеша DNS, чтобы такие проблемы не возникали?