JDK-8278229 : com/sun/jndi/dns/ConfigTests/PortUnreachable.java and Timeout.java fails with javax.naming.CommunicationException
  • Type: Bug
  • Component: core-libs
  • Sub-Component: javax.naming
  • Affected Version: 17,18,19,21
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: os_x
  • CPU: aarch64
  • Submitted: 2021-12-03
  • Updated: 2024-09-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
The following tests failed in the JDK18 CI:

com/sun/jndi/dns/ConfigTests/PortUnreachable.java
com/sun/jndi/dns/ConfigTests/Timeout.java

Here's a snippet from the log file:

#section:main
----------messages:(5/359)----------
command: main -Djdk.net.usePlainDatagramSocketImpl=false PortUnreachable
reason: User specified action: run main/othervm -Djdk.net.usePlainDatagramSocketImpl=false PortUnreachable 
Mode: othervm [/othervm specified]
Additional options from @modules: --add-modules java.base --add-exports java.base/sun.security.util=ALL-UNNAMED
elapsed time (seconds): 15.223
----------configuration:(4/111)----------
Boot Layer
  add modules: java.base                   
  add exports: java.base/sun.security.util ALL-UNNAMED

----------System.out:(2/74)----------
Skip local DNS Server creation 
Bug 7164518 can cause this failure on mac
----------System.err:(30/2348)----------
javax.naming.CommunicationException: DNS error [Root exception is java.net.SocketTimeoutException: Receive timed out]; remaining name ''
	at jdk.naming.dns/com.sun.jndi.dns.DnsClient.query(DnsClient.java:316)
	at jdk.naming.dns/com.sun.jndi.dns.Resolver.query(Resolver.java:81)
	at jdk.naming.dns/com.sun.jndi.dns.DnsContext.c_getAttributes(DnsContext.java:434)
	at java.naming/com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(ComponentDirContext.java:235)
	at java.naming/com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:141)
	at java.naming/com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:129)
	at java.naming/javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:171)
	at java.naming/javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:166)
	at PortUnreachable.runTest(PortUnreachable.java:76)
	at TestBase.launch(TestBase.java:82)
	at TestBase.run(TestBase.java:50)
	at PortUnreachable.main(PortUnreachable.java:60)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:577)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.net.SocketTimeoutException: Receive timed out
	at java.base/sun.nio.ch.DatagramChannelImpl.trustedBlockingReceive(DatagramChannelImpl.java:703)
	at java.base/sun.nio.ch.DatagramChannelImpl.blockingReceive(DatagramChannelImpl.java:633)
	at java.base/sun.nio.ch.DatagramSocketAdaptor.receive(DatagramSocketAdaptor.java:240)
	at java.base/java.net.DatagramSocket.receive(DatagramSocket.java:701)
	at jdk.naming.dns/com.sun.jndi.dns.DnsClient.doUdpQuery(DnsClient.java:425)
	at jdk.naming.dns/com.sun.jndi.dns.DnsClient.query(DnsClient.java:214)
	... 15 more

JavaTest Message: Test threw exception: javax.naming.CommunicationException: DNS error [Root exception is java.net.SocketTimeoutException: Receive timed out]; remaining name ''
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: javax.naming.CommunicationException: DNS error [Root exception is java.net.SocketTimeoutException: Receive timed out]; remaining name ''        Timeout
----------System.out:(1/32)----------
Skip local DNS Server creation 
----------System.err:(34/2489)----------
javax.naming.CommunicationException: DNS error [Root exception is java.net.SocketException: Network is unreachable]; remaining name ''
	at jdk.naming.dns/com.sun.jndi.dns.DnsClient.query(DnsClient.java:316)
	at jdk.naming.dns/com.sun.jndi.dns.Resolver.query(Resolver.java:81)
	at jdk.naming.dns/com.sun.jndi.dns.DnsContext.c_getAttributes(DnsContext.java:434)
	at java.naming/com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(ComponentDirContext.java:235)
	at java.naming/com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:141)
	at java.naming/com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:129)
	at java.naming/javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:171)
	at java.naming/javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:166)
	at Timeout.runTest(Timeout.java:78)
	at TestBase.launch(TestBase.java:82)
	at TestBase.run(TestBase.java:50)
	at Timeout.main(Timeout.java:61)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:333)
	at java.base/java.lang.Thread.run(Thread.java:842)
Caused by: java.net.SocketException: Network is unreachable
	at java.base/sun.nio.ch.DatagramChannelImpl.receive0(Native Method)
----------rerun:(39/7355)*----------




com/sun/jndi/dns/ConfigTests/Timeout.java



Comments
The semantics of the test is to send a DNS query over UDP to a non existent server, and this will generate a PortUnreachable exception. But the generation of an ICMP destination unreachable is not an absolute, as per the RFC "If, in the destination host, the IP module cannot deliver the datagram because the indicated protocol module or process port is not active, the destination host **may** send a destination unreachable message to the source host." It is possible that, as has been seen with other UDP based test scenario on this particular host, the kernel doesn’t generate the ICMP dest unreachable, and just drops the datagram. I have a UDP joke ... But you might not get it !! (ref: https://requestmetrics.com/web-performance/http3-is-fast) Hence the timeouts within the DnsClient. javax.naming.CommunicationException: DNS error [Root exception is java.net.SocketTimeoutException: Receive timed out]; remaining name '' at jdk.naming.dns/com.sun.jndi.dns.DnsClient.query(DnsClient.java:316) at jdk.naming.dns/com.sun.jndi.dns.Resolver.query(Resolver.java:81) at jdk.naming.dns/com.sun.jndi.dns.DnsContext.c_getAttributes(DnsContext.java:434) at java.naming/com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(ComponentDirContext.java:235) at java.naming/com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:141) at java.naming/com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:129) at java.naming/javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:171) at java.naming/javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:166) at PortUnreachable.runTest(PortUnreachable.java:76) at TestBase.launch(TestBase.java:82) at TestBase.run(TestBase.java:50) at PortUnreachable.main(PortUnreachable.java:60) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:577) at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.net.SocketTimeoutException: Receive timed out at java.base/sun.nio.ch.DatagramChannelImpl.trustedBlockingReceive(DatagramChannelImpl.java:703) at java.base/sun.nio.ch.DatagramChannelImpl.blockingReceive(DatagramChannelImpl.java:633) at java.base/sun.nio.ch.DatagramSocketAdaptor.receive(DatagramSocketAdaptor.java:240) at java.base/java.net.DatagramSocket.receive(DatagramSocket.java:701) at jdk.naming.dns/com.sun.jndi.dns.DnsClient.doUdpQuery(DnsClient.java:425) at jdk.naming.dns/com.sun.jndi.dns.DnsClient.query(DnsClient.java:214) I have looked through the kernel parameters to see if there is any ICMP config that might hint at this “optimisation”. Does this happen if it is not a loopback address? Yes, I have run the test using localHost instead of loopback and it is consistent failure on this host. Could it be a firewall configuration or some other security setting that disables ICMP DST Unreachable? There are a number of DOS attacks associated with ICMP. I’ve looked through the kernel parameters, and only see net.inet.icmp.drop_redirect: 1 But this should have no influence on icmp dst unreachable ! Maybe there is a conversation to be had with Apple support on this
18-12-2021

Here's a log file snippet from the jdk-19+3-63-tier2 CI sighting: com/sun/jndi/dns/ConfigTests/PortUnreachable.java #section:main ----------messages:(5/359)---------- command: main -Djdk.net.usePlainDatagramSocketImpl=false PortUnreachable reason: User specified action: run main/othervm -Djdk.net.usePlainDatagramSocketImpl=false PortUnreachable Mode: othervm [/othervm specified] Additional options from @modules: --add-modules java.base --add-exports java.base/sun.security.util=ALL-UNNAMED elapsed time (seconds): 15.181 ----------configuration:(4/111)---------- Boot Layer add modules: java.base add exports: java.base/sun.security.util ALL-UNNAMED ----------System.out:(2/74)---------- Skip local DNS Server creation Bug 7164518 can cause this failure on mac ----------System.err:(30/2348)---------- javax.naming.CommunicationException: DNS error [Root exception is java.net.SocketTimeoutException: Receive timed out]; remaining name '' at jdk.naming.dns/com.sun.jndi.dns.DnsClient.query(DnsClient.java:316) at jdk.naming.dns/com.sun.jndi.dns.Resolver.query(Resolver.java:81) at jdk.naming.dns/com.sun.jndi.dns.DnsContext.c_getAttributes(DnsContext.java:434) at java.naming/com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(ComponentDirContext.java:235) at java.naming/com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:141) at java.naming/com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:129) at java.naming/javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:171) at java.naming/javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:166) at PortUnreachable.runTest(PortUnreachable.java:76) at TestBase.launch(TestBase.java:82) at TestBase.run(TestBase.java:50) at PortUnreachable.main(PortUnreachable.java:60) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:577) at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.net.SocketTimeoutException: Receive timed out at java.base/sun.nio.ch.DatagramChannelImpl.trustedBlockingReceive(DatagramChannelImpl.java:703) at java.base/sun.nio.ch.DatagramChannelImpl.blockingReceive(DatagramChannelImpl.java:633) at java.base/sun.nio.ch.DatagramSocketAdaptor.receive(DatagramSocketAdaptor.java:240) at java.base/java.net.DatagramSocket.receive(DatagramSocket.java:701) at jdk.naming.dns/com.sun.jndi.dns.DnsClient.doUdpQuery(DnsClient.java:425) at jdk.naming.dns/com.sun.jndi.dns.DnsClient.query(DnsClient.java:214) ... 15 more JavaTest Message: Test threw exception: javax.naming.CommunicationException: DNS error [Root exception is java.net.SocketTimeoutException: Receive timed out]; remaining name '' JavaTest Message: shutting down test STATUS:Failed.`main' threw exception: javax.naming.CommunicationException: DNS error [Root exception is java.net.SocketTimeoutException: Receive timed out]; remaining name '' ----------rerun:(39/7313)*---------- cd /System/Volumes/Data/mesos/work_dir/slaves/
16-12-2021

Looks to be on the same machine all the time.
08-12-2021