RFR: 8253940: com/sun/jdi/JdwpAttachTest.java failed with "RuntimeException: ERROR: LingeredApp.startApp was able to attach"
Chris Plummer
cjplummer at openjdk.java.net
Fri Feb 19 20:53:40 UTC 2021
On Fri, 19 Feb 2021 20:10:14 GMT, Alex Menkov <amenkov at openjdk.org> wrote:
> Failures related to "no route to host" and "cannot bind to address" errors are covered by https://git.openjdk.java.net/jdk/pull/2633
>
> This change fixes failures with listening on IPv6 loopback and attaching to "localhost" (the test connects to some other process which listens on the same port on IPv4 loopback and as a result gets "handshake failed - received >< - expected >JDWP-Handshake<" error)
test/jdk/com/sun/jdi/JdwpAttachTest.java line 88:
> 86:
> 87: // by using "localhost" or empty hostname
> 88: // we should be able to attach to both IPv4 and IPv6 addresses (127.0.0.1 & ::1).
As long as you're touching this comment, start it with "By" and put more of the comment on the first line.
Also, the comment is a bit misleading now. You can attach to both, but you only try the one that is preferred.
test/jdk/com/sun/jdi/JdwpAttachTest.java line 180:
> 178: // loopback address.
> 179: // The method checks if the address is safe to test with current network config.
> 180: private static boolean addressIfSafeToConnectToLocalhost(InetAddress addr) {
Do you really mean to name it "addressIfSafe..." rather than "addressIsSafe..."?
test/jdk/com/sun/jdi/JdwpAttachTest.java line 178:
> 176: // Attach to localhost tries to connect to both IPv4 and IPv6 loopback addresses.
> 177: // But sometimes it causes interference with other processes which can listen on the same port but different
> 178: // loopback address.
Move a few words from the end of the 2nd line of the comment down to the 3rd.
test/jdk/com/sun/jdi/JdwpAttachTest.java line 183:
> 181: boolean ipv6 = Boolean.parseBoolean(System.getProperty("java.net.preferIPv6Addresses"));
> 182: return ipv6 == (addr instanceof Inet6Address);
> 183: }
In the CR you said:
> But JDI framework respects "java.net.preferIPv6Addresses" system property (which by default is false), so connecting to empty host tries IPv4 addresses 1st and tries IPv6 addresses only if connect to IPv4 failed.
Are you referring to the JDI implementation, or the JDI test framework. In any case, I had trouble locating this anywhere in the source.
Also, "preferv6" doesn't mean that's what it ends up using. It just tries v6 first before deferring to v4 if v6 fails (or the opposite if it doesn't prefer v6). I don't think you are capturing that part of the logic. What happens if preferv6 is true but the connect to a v6 port fails. Should the test try to connect to the v4 in that case?
-------------
PR: https://git.openjdk.java.net/jdk/pull/2654
More information about the serviceability-dev
mailing list