Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StackOverflowError during DnsResolution #10246

Closed
kireet opened this issue May 4, 2020 · 4 comments · Fixed by #10337
Closed

StackOverflowError during DnsResolution #10246

kireet opened this issue May 4, 2020 · 4 comments · Fixed by #10337
Milestone

Comments

@kireet
Copy link

kireet commented May 4, 2020

Expected behavior

The DNS resolution should succeed.

Actual behavior

A stack overflow error occurs:

java.lang.StackOverflowError: null
        at java.lang.String.equalsIgnoreCase(String.java:1109) ~[?:1.8.0_212]
        at java.net.InetSocketAddress$InetSocketAddressHolder.equals(InetSocketAddress.java:121) ~[?:1.8.0_212]
        at java.net.InetSocketAddress.equals(InetSocketAddress.java:407) ~[?:1.8.0_212]
        at io.netty.resolver.dns.NameServerComparator.compare(NameServerComparator.java:47) ~[netty-all-4.1.43.Final.jar:4.1.43.Final]
        at io.netty.resolver.dns.NameServerComparator.compare(NameServerComparator.java:35) ~[netty-all-4.1.43.Final.jar:4.1.43.Final]
        at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355) ~[?:1.8.0_212]
        at java.util.TimSort.sort(TimSort.java:220) ~[?:1.8.0_212]
        at java.util.Arrays.sort(Arrays.java:1512) ~[?:1.8.0_212]
        at java.util.ArrayList.sort(ArrayList.java:1462) ~[?:1.8.0_212]
        at java.util.Collections.sort(Collections.java:175) ~[?:1.8.0_212]
        at io.netty.resolver.dns.DefaultAuthoritativeDnsServerCache$1.sortEntries(DefaultAuthoritativeDnsServerCache.java:56) ~[netty-all-4.1.43.Final.jar:4.1.43.Final]
        at io.netty.resolver.dns.Cache$Entries.add(Cache.java:216) ~[netty-all-4.1.43.Final.jar:4.1.43.Final]
        at io.netty.resolver.dns.Cache.cache(Cache.java:133) ~[netty-all-4.1.43.Final.jar:4.1.43.Final]
        at io.netty.resolver.dns.DefaultAuthoritativeDnsServerCache.cache(DefaultAuthoritativeDnsServerCache.java:110) ~[netty-all-4.1.43.Final.jar:4.1.43.Final]
        at io.netty.resolver.dns.DnsResolveContext$4.cache(DnsResolveContext.java:470) ~[netty-all-4.1.43.Final.jar:4.1.43.Final]
        at io.netty.resolver.dns.DnsResolveContext$4.cache(DnsResolveContext.java:470) ~[netty-all-4.1.43.Final.jar:4.1.43.Final]
        at io.netty.resolver.dns.DnsResolveContext$4.cache(DnsResolveContext.java:470) ~[netty-all-4.1.43.Final.jar:4.1.43.Final]
        at io.netty.resolver.dns.DnsResolveContext$4.cache(DnsResolveContext.java:470) ~[netty-all-4.1.43.Final.jar:4.1.43.Final]
....

Steps to reproduce

unfortunately i am not able to provide reproduction steps.

Minimal yet complete reproducer code (or URL to code)

Netty version

4.1.43.Final

JVM version (e.g. java -version)

1.8.0_212-b10

OS version (e.g. uname -a)

Linux 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

@kireet
Copy link
Author

kireet commented May 4, 2020

The repeating DnsResolveContext$4.cache was confusing for me. I don't see how this line could call itself.

@normanmaurer
Copy link
Member

@kireet please update to the latest netty version to ensure this problem still exists. Also please provide a more detailed stack trace.

@kireet
Copy link
Author

kireet commented Jun 2, 2020

hello, the problem still occurs with 4.1.50:

java.lang.StackOverflowError: null
        at java.lang.String.equalsIgnoreCase(String.java:1109) ~[?:1.8.0_212]
        at java.net.InetSocketAddress$InetSocketAddressHolder.equals(InetSocketAddress.java:121) ~[?:1.8.0_212]
        at java.net.InetSocketAddress.equals(InetSocketAddress.java:407) ~[?:1.8.0_212]
        at io.netty.resolver.dns.NameServerComparator.compare(NameServerComparator.java:47) ~[netty-all-4.1.50.Final.jar:4.1.50.Final]
        at io.netty.resolver.dns.NameServerComparator.compare(NameServerComparator.java:35) ~[netty-all-4.1.50.Final.jar:4.1.50.Final]
        at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355) ~[?:1.8.0_212]
        at java.util.TimSort.sort(TimSort.java:220) ~[?:1.8.0_212]
        at java.util.Arrays.sort(Arrays.java:1512) ~[?:1.8.0_212]
        at java.util.ArrayList.sort(ArrayList.java:1462) ~[?:1.8.0_212]
        at java.util.Collections.sort(Collections.java:175) ~[?:1.8.0_212]
        at io.netty.resolver.dns.DefaultAuthoritativeDnsServerCache$1.sortEntries(DefaultAuthoritativeDnsServerCache.java:54) ~[netty-all-4.1.50.Final.jar:4.1.50.Final]
        at io.netty.resolver.dns.Cache$Entries.add(Cache.java:216) ~[netty-all-4.1.50.Final.jar:4.1.50.Final]
        at io.netty.resolver.dns.Cache.cache(Cache.java:133) ~[netty-all-4.1.50.Final.jar:4.1.50.Final]
        at io.netty.resolver.dns.DefaultAuthoritativeDnsServerCache.cache(DefaultAuthoritativeDnsServerCache.java:108) ~[netty-all-4.1.50.Final.jar:4.1.50.Final]
        at io.netty.resolver.dns.DnsResolveContext$4.cache(DnsResolveContext.java:509) ~[netty-all-4.1.50.Final.jar:4.1.50.Final]
        at io.netty.resolver.dns.DnsResolveContext$4.cache(DnsResolveContext.java:509) ~[netty-all-4.1.50.Final.jar:4.1.50.Final]
        at io.netty.resolver.dns.DnsResolveContext$4.cache(DnsResolveContext.java:509) ~[netty-all-4.1.50.Final.jar:4.1.50.Final]
        at io.netty.resolver.dns.DnsResolveContext$4.cache(DnsResolveContext.java:509) ~[netty-all-4.1.50.Final.jar:4.1.50.Final]

Unfortunately, the bottom of the stack was lost as the stack trace depth was too large (it's line 509 all the way down). I'll try to set the java option so full stack traces are always printed.

But I am not sure how line 509 keeps calling itself directly repeatedly?

@normanmaurer
Copy link
Member

@kireet PTAL #10337

normanmaurer added a commit that referenced this issue Jun 2, 2020
…ervers

Motivation:

There is a possibility to end up with a StackOverflowError when trying to resolve authorative nameservers because of incorrect wrapping the AuthoritativeDnsServerCache.

Modifications:

Ensure we don't end up with an overflow due wrapping

Result:

Fixes #10246
normanmaurer added a commit that referenced this issue Jun 4, 2020
#10337)


Motivation:

There is a possibility to end up with a StackOverflowError when trying to resolve authorative nameservers because of incorrect wrapping the AuthoritativeDnsServerCache.

Modifications:

Ensure we don't end up with an overflow due wrapping

Result:

Fixes #10246
normanmaurer added a commit that referenced this issue Jun 4, 2020
#10337)


Motivation:

There is a possibility to end up with a StackOverflowError when trying to resolve authorative nameservers because of incorrect wrapping the AuthoritativeDnsServerCache.

Modifications:

Ensure we don't end up with an overflow due wrapping

Result:

Fixes #10246
ihanyong pushed a commit to ihanyong/netty that referenced this issue Jul 31, 2020
netty#10337)


Motivation:

There is a possibility to end up with a StackOverflowError when trying to resolve authorative nameservers because of incorrect wrapping the AuthoritativeDnsServerCache.

Modifications:

Ensure we don't end up with an overflow due wrapping

Result:

Fixes netty#10246
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants