redisson: Regression: DNS resolver failing to find valid DNS record
Expected behavior
The DNS resolver should find valid DNS records. The hostname I’m having trouble with worked in 3.5.0, it is failing in newer versions.
I opened a ticket with Netty first thinking it was a problem with the resolver itself, but after trying different Netty versions, it appears to be a configuration issue with how Reddison is calling the resolver.
See https://github.com/netty/netty/issues/8261
Actual behavior
Exception thrown:
Caused by: io.netty.resolver.dns.DnsNameResolverContext$SearchDomainUnknownHostException: Search domain query failed. Original hostname: 'host.toplevel' failed to resolve 'host.toplevel.search.domain' after 7 queries
at io.netty.resolver.dns.DnsNameResolverContext.finishResolve(DnsNameResolverContext.java:721)
at io.netty.resolver.dns.DnsNameResolverContext.tryToFinishResolve(DnsNameResolverContext.java:663)
at io.netty.resolver.dns.DnsNameResolverContext.query(DnsNameResolverContext.java:306)
at io.netty.resolver.dns.DnsNameResolverContext.query(DnsNameResolverContext.java:295)
at io.netty.resolver.dns.DnsNameResolverContext.tryToFinishResolve(DnsNameResolverContext.java:636)
at io.netty.resolver.dns.DnsNameResolverContext$3.operationComplete(DnsNameResolverContext.java:342)
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:507)
at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:481)
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:420)
at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:104)
at io.netty.resolver.dns.DnsQueryContext.setSuccess(DnsQueryContext.java:197)
at io.netty.resolver.dns.DnsQueryContext.finish(DnsQueryContext.java:180)
at io.netty.resolver.dns.DnsNameResolver$DnsResponseHandler.channelRead(DnsNameResolver.java:969)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1412)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:943)
at io.netty.channel.nio.AbstractNioMessageChannel$NioMessageUnsafe.read(AbstractNioMessageChannel.java:93)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
Steps to reproduce
- Configure a top level domain
someDomain
on a DNS server you own - Configure a host under the new top level domain
someHost.someDomain
- Configure multiple resolvers on the DNS client machine that will run the Netty code. i.e. 8.8.8.8, 192.168.1.1, and 10.0.0.1 (I have 3 resolvers configured, each pointing to different DNS masters - global DNS, local personal private network, company private network over a VPN)
- Configure the search domain to not match the top level domain, i.e.
search.otherDomain
on the DNS client machine that will run the Netty code - Configure redisson to connect to
someHost.someDomain
- failure during configuration.
Redis version
Redisson version
Trying to migrate from 3.5.0 to the latest version
Redisson configuration
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 50 (20 by maintainers)
Commits related to this issue
- Fixed - DNSNameResolver bug (workaround). #1646 #1625 #1486 — committed to redisson/redisson by deleted user 6 years ago
- Fixed - DNSNameResolver bug (workaround). #1646 #1625 #1486 #1693 — committed to redisson/redisson by deleted user 5 years ago
I’m experiencing the same issue with Redisson 3.13.4 which brings in Netty 4.1.51 Final. I’m not using Kubernetes. I’m using docker-compose + docker on a Google Compute Engine VM. It’s failing to resolve an unqualified DNS name on my VPC which is resolved correctly by dig/nslookup/ping/etc.
The container is built from jetty:9-jdk14-slim, which I think (?) means it’s based on debian.
I’m using dirt-simple Redisson configuration:
private val config = Config().apply { useSingleServer().address = "redis://my-host:6379" }
My container’s /etc/resolv.conf looks like this:
`search c.some-domain.internal. google.internal.
nameserver 127.0.0.11
options ndots:0 `
The host VM image is from Debian 10. The host VM’s /etc/resolv.conf looks like this:
`domain c.some-domain.internal
search c.some-domain.internal. google.internal.
nameserver 169.254.169.254`
I worked around it for now by passing a fully-qualified name for my-host. Would love to know why it doesn’t work though.
Setting
-Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true
did not help. My solution was to use tcp mode for DNS request as reported here.similar issue happened again @mrniko
I have ready test on alpine 3.18.3 , it can not fix the problem , because redisson dns not implement by musl , it depends on netty dns resovler.
This issue’s fix seems already be included in the 3.18.0 release. redisson-3.18.0