question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Regression: DNS resolver failing to find valid DNS record

See original GitHub issue

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

  1. Configure a top level domain someDomain on a DNS server you own
  2. Configure a host under the new top level domain someHost.someDomain
  3. 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)
  4. 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
  5. Configure redisson to connect to someHost.someDomain
  6. failure during configuration.

Redis version

Redisson version

Trying to migrate from 3.5.0 to the latest version

Redisson configuration

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:40 (17 by maintainers)

github_iconTop GitHub Comments

2reactions
steveyeggecommented, Oct 5, 2020

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.

2reactions
pditommasocommented, Jan 3, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DNS resolver library doesn't seem to be working reliably
The failure happened after a DNS reply packet has arrived. I think your DNS server has 5 second timeout, if it can't resolve...
Read more >
Understand and troubleshoot partial DNS failure - Amazon AWS
In this case, some clients might experience partial DNS failures, if the resolver tries to resolve the domain using the wrong name server....
Read more >
Query policies — Knot Resolver 5.5.3 documentation
Forward cache-miss queries to specified IP addresses (without encryption), DNSSEC validate received answers and cache them. Target IP addresses are expected to ...
Read more >
DNS Tests - Datadog Docs
DNS tests allow you to proactively monitor the resolvability and lookup times of your DNS records using any nameserver. If resolution is unexpectedly...
Read more >
cannot resolve domain if not defined in /etc/hosts - sssd ...
The DNS query that goes past is for the plain fedora14-i686. Something has changed in the DNS resolver so that it does not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found