-
Bug
-
Resolution: Fixed
-
P3
-
16
-
Windows 10 21H1
Minecraft 1.17.1, Bundled Java 16 (issue persists on AdoptOpenJDK HotSpot 16)
-
b09
-
windows_10
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8282517 | 18.0.2 | Aleksej Efimov | P3 | Resolved | Fixed | b01 |
JDK-8282269 | 18.0.1 | Aleksej Efimov | P3 | Resolved | Fixed | b09 |
JDK-8282430 | 17.0.3 | Aleksej Efimov | P3 | Resolved | Fixed | b04 |
Minecraft is using JNDI to resolve SRV entries from DNS when connecting to server (code below).
We have recently received a report about this functionality not working (https://bugs.mojang.com/browse/MC-232009) and it seems that following steps are required to reproduce:
· User is on Windows
· IPv6 stack enabled, but no connectivity
· At least one DNSv6 server is configured
The original report mentions this happening only with non-default ports. In fact it’s due to that specific server configuration (redirect pointing to the same host, but different port)
Simplified code:
Hashtable<String, String> env = new Hashtable<>();
env.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory");
env.put("java.naming.provider.url", "dns:");
env.put("com.sun.jndi.dns.timeout.retries", "1");
DirContext context = new InitialDirContext(env);
Attributes attributes = context.getAttributes("_minecraft._tcp." + host, new String[]{"SRV"});
Attribute srvAttribute = attributes.get("srv");
Problem:
SRV resolver is always throwing java.io.UncheckedIOException: java.net.SocketException: Network is unreachable: connect, even if there are also valid IPv4 DNS servers configured.
Analysis:
· JDK internals changed in 15 (
· Datagram socket started throwing UncheckedIOException on connection failure (
· During DNS query (https://github.com/openjdk/jdk/blob/master/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsClient.java#L171-L319) method is supposed to check all servers and ignore failed ones (see doNotRetry variable), but only handles few exception types and not the one thrown from `doUdpQuery` call on line 214.
- backported by
-
JDK-8282269 JNDI DNS provider fails to resolve SRV entries when IPV6 stack is enabled
- Resolved
-
JDK-8282430 JNDI DNS provider fails to resolve SRV entries when IPV6 stack is enabled
- Resolved
-
JDK-8282517 JNDI DNS provider fails to resolve SRV entries when IPV6 stack is enabled
- Resolved
- duplicates
-
JDK-8272997 JDNI fails to resolve SRV entries when IPV6 stack is enabled
- Closed
- links to
-
Commit openjdk/jdk17u-dev/fc57ee6d
-
Commit openjdk/jdk18u/65d11651
-
Commit openjdk/jdk/4c169495
-
Review openjdk/jdk17u-dev/172
-
Review openjdk/jdk17u-dev/176
-
Review openjdk/jdk18u/25
-
Review openjdk/jdk18u/29
-
Review openjdk/jdk/7353