RFR for JDK-7195249 Some jtreg tests use hard coded ports

Yekaterina Kantserova yekaterina.kantserova at oracle.com
Thu Nov 7 07:14:11 PST 2013

Hi Taras,

see my comments in-lined.

On 11/06/2013 03:04 PM, taras ledkov wrote:
> Hi Everyone
> I am working on bug https://bugs.openjdk.java.net/browse/JDK-7195249.
> Based on my colleagues' research,
> Root cause:
> hotspot/test/runtime/6294277/SourceDebugExtension.java
> jdk/test/sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.java
> jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java
> jdk/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.sh 
> jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java
> fails intermittently because of use of fixed ports. These ports could 
> be busy at some configurations.
> Suggested fix:
> 1. My recommendation would be to convert the only shell test 
> (SSLConfigFilePermissionTest.sh) into
> Java based test and re-use the dynamic port allocation 
> solutionjdk/test/lib/testlibrary/jdk/testlibrary/Utils.getFreePort() 
> to address the issue for JDK tests. Staffan Larsen recommends to use 
> this solution instead of 
> java/rmi/testlibrary/TestLibrary.getUnusedRandomPort().
> 2. For hotspot tests I cannot find appropriate test utils (witch 
> provide getFreePort() functionality). There are several options:
> - copy whole library jdk/test/lib/testlibrary/jdk/testlibrary/ to 
> hotspot repository;

There is already testlibrary in the hotspot part: 
hotspot/test/testlibrary. The most classes from jdk/test/lib/testlibrary 
are already in there (package com.oracle.java.testlibrary).
I've added Utils, TestThread, ProcessThread and XRun a while ago but has 
not yet port them to the hotspot part.

> - copy one class jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java 
> to hotspot repository;
Sounds like a good solution right now. I'll try to port the rest in the 
nearest future.

> - copy one method from class 
> jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java 
> (Utils.getFreePort()) to hotspot repository;
> - move the library jdk/test/lib/testlibrary/jdk/testlibrary/ to a 
> place that can be shared between hotspot & jdk tests (if such place 
> exists).
Sounds like an even better solution but there is no such place as far as 
I know. But discussions are ongoing on how it can be achieved.

> 3. SourceDebugExtension test uses jtreg tag @run with hard coded port 
> in jvm options. The test must be converted to test with java based 
> test launcher and test application (e.g. like the test 
> LocalManagementTest.java).
> Please let me know any comments or suggestions.
> Thank you


More information about the serviceability-dev mailing list