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

David Holmes david.holmes at oracle.com
Wed Nov 6 17:43:42 PST 2013

On 7/11/2013 12:04 AM, 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;
> - copy one class jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java to
> hotspot repository;
> - 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).

The issue about keeping the two versions of the testlibrary in sync 
and/or moving to a shared location has been raised a number of times and 
is beyond the scope of the current required fix. I would suggest simply 
adding the necessary utility class to 


> 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