> Can I please get a review of this test only change which proposes to fix the > recent intermittent failures in `RmiBootstrapTest` reported in > https://bugs.openjdk.org/browse/JDK-8030616? > > The test has been intermittently failing with `cannot find a free port after > 10 tries`. The tests uses the `jdk.test.lib.Utils.getFreePort()` utility > method to get a free port to use in the tests. That port is then used to > create and bind a JMX connector server. The issue resides in the fact that > the `getFreePort` utility uses loopback address to identify a free port, > whereas the JMX connector server uses that identified port to bind to a > non-loopback address - there's logic in `sun.rmi.transport.tcp.TCPEndpoint` > line 117 which calls `InetAddress.getLocalHost()` which can and does return a > non-loopback address. This effectively means that the port that was > identified as free (on loopback) may not really be free on (some other > address) and a subsequent attempt to bind against it by the connector server > will end up with a `BindException`. > > Data collected in failures on the CI system has shown that this is indeed the > case and the port that was chosen (for loopback) as free was already used by > another process on a different address. The test additionally has logic to > attempt retries upto a maximum of 10 times to find a new free port on such > `BindException`. Turns out the next free port (on loopback) returned by > `jdk.test.lib.Utils.getFreePort()` is incremental and it so happens that the > systems where this failed had a process listening on a range of 10 to 12 > ports, so these too ended up with `BindException` when the JMX connector > server used that port for a different address. > > The commit here makes sure that the JMX connector server in the test is now > configured to loopback address as the address to bind to. That way the test > uses the correct address (loopback) on which the port was free. > > The commit also has a change to the javadoc of the test utility > `jdk.test.lib.Utils.getFreePort()` to clarify that it returns a free port on > loopback address. This now matches what the implementation of that method > does. > > Multiple test runs after this change hasn't yet run into the failure.
Jaikiran Pai has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision: - Merge latest from master branch - remove unintentionally committed file - 8030616: sun/management/jmxremote/bootstrap/RmiBootstrapTest fails intermittently with cannot find a free port ------------- Changes: - all: https://git.openjdk.org/jdk/pull/10322/files - new: https://git.openjdk.org/jdk/pull/10322/files/ddfb8c95..01267c65 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=10322&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10322&range=00-01 Stats: 66155 lines in 2020 files changed: 37805 ins; 19685 del; 8665 mod Patch: https://git.openjdk.org/jdk/pull/10322.diff Fetch: git fetch https://git.openjdk.org/jdk pull/10322/head:pull/10322 PR: https://git.openjdk.org/jdk/pull/10322