Hi Severin,

Did you manage to make the test pass locally?

This test has had a long history of failing, and I've come
to suspect that it might be flawed.

First - it has /timeout=5. I believe that's much too short.
It immediately failed the first time I ran it locally on my machine.

Then it uses well known ports. That's bad. There's no guarantee
that these ports will be free.

Then - it only use addresses configured for "localhost".

Can there ever be more than one such address? If there is more
than one, I suspect the test will fail: I believe the subprocess
started by the test would need the additional
   -Djava.rmi.server.hostname=<adddress>
on the command line.
And even with that - it might still fail if those two addresses
can't be bound simultaneously on the same port.

Then why are loopback addresses filtered out? Because of two
things I guess:

   - if several loopback are defined, I'm not sure you can
     bind them on the same port (and it might be difficult to
     figure that out)

   - if you bind to the loopback address, then you most probably
     need to start the subprocess with
      -Djava.rmi.server.hostname=<loopback-adddress>

If we don't see this test failing, I suspect this is because
it is either never selected, or always passes trivially.
If we start selecting it - or have a configuration where it
doesn't trivially pass, I suspect it will fail.

best regards,

-- daniel




On 22/02/2019 15:04, Severin Gehwolf wrote:
Hi!

Bug: https://bugs.openjdk.java.net/browse/JDK-8219585

Could somebody please review this trivial testbug. For a config like
[1] the logic prior JDK-8145982 returned this list for
getAddressesForLocalHost():

[localhost/127.0.0.1, localhost/192.168.1.18, localhost/0:0:0:0:0:0:0:1]

Post JDK-8145982, getAddressesForLocalHost() returns:

[localhost/192.168.1.18]

The fix is trivial. Just adjust the condition for as to when the test
should actually trivially pass:

diff --git 
a/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java 
b/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java
--- a/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java
+++ b/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java
@@ -176,8 +176,8 @@
      }
public static void main(String[] args) {
-        List<InetAddress> addrs = getAddressesForLocalHost();
-        if (addrs.size() < 2) {
+        List<InetAddress> addrs = getNonLoopbackAddressesForLocalHost();
+        if (addrs.size() < 1) {
              System.out.println("Ignoring manual test since no more than one IPs 
are configured for 'localhost'");
              return;
          }
@@ -186,7 +186,7 @@
          System.out.println("All tests PASSED.");
      }
- private static List<InetAddress> getAddressesForLocalHost() {
+    private static List<InetAddress> getNonLoopbackAddressesForLocalHost() {
try {
              return NetworkInterface.networkInterfaces()


Testing: Manual testing on local setup. jdk/submit (currently running)

Thanks,
Severin


[1] $ grep localhost /etc/hosts | grep -v '::'
127.0.0.1    localhost localhost.localdomain localhost4 localhost4.localdomain4
192.168.1.18 localhost


Reply via email to