JDK-8219585 : [TESTBUG] sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java passes trivially when it shouldn't
  • Type: Bug
  • Component: core-svc
  • Sub-Component: javax.management
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2019-02-22
  • Updated: 2019-04-05
  • Resolved: 2019-03-14
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.
JDK 13
13 b13Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
The test has this comment:

 * NOTE:
 *    This test requires at least a setup similar to the following in
 *    /etc/hosts file (or the windows equivalent). I.e. it expects it to
 *    be multi-homed and not both being the loop-back interface.
 *    For example:
 *    ----->8-------- /etc/hosts ----------->8---
 *    127.0.0.1   localhost
 *    192.168.0.1 localhost
 *    ----->8-------- /etc/hosts ----------->8---

However, when one configures the /etc/hosts file like the above the test still fails trivially with:

Ignoring manual test since no more than one IPs are configured for 'localhost'

As it turns out JDK-8145982 changed the original test by filtering out loopback interfaces from the interface list. The original logic used InetAddress.getAllByName("localhost") which included loopback addresses such as 127.0.0.1. The logic post  JDK-8145982 does no longer.

As a result the condition in the test's main method is wrong:

        List<InetAddress> addrs = getAddressesForLocalHost();
        if (addrs.size() < 2) {
            System.out.println("Ignoring manual test since no more than one IPs are configured for 'localhost'");
            return;
        }

The condition should be addrs.size() < 1 rather than 2.

The test needs at least two separate ip:port pairs to be able to bind to in order to not trivially pass. For example loop back address and the IP of the host should be sufficient.
Comments
During review it was discovered that this extra setting for /etc/hosts wasn't needed. Hence the push of the update test should run automatically on more test hosts. A couple of other stability improvements were incorporated as well.
14-03-2019

Review thread: http://mail.openjdk.java.net/pipermail/serviceability-dev/2019-February/027188.html
22-02-2019