jmx-dev RFR: 8328619: sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.java failed with BindException: Address already in use

Kevin Walls kevinw at openjdk.org
Mon Mar 25 22:42:21 UTC 2024


On Mon, 25 Mar 2024 19:00:37 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> Test uses  jdk.test.lib.Utils.getFreePort() when launching a new Java command.
>> Looks like it already recognises "java.rmi.server.ExportException: Port already in use: " and retries, but there is a long-standing typo in the check.
>> 
>> e.g. 
>> 
>> test output:
>> Error: Exception thrown by the agent: java.rmi.server.ExportException: Port already in use: 37049; nested exception is: 
>> 	java.net.BindException: Address already in use
>> 	
>> Test checks for:
>>         !output.getOutput().contains("Exception thrown by the agent : java.rmi.server.ExportException: Port already in use")
>> 		
>> Oops, we have an extra space in there.  A day-one typo from JDK-7195249.
>> 
>> While here, try to clarify the while loop which recognises this port failure.  Also add something to clarify which test(s) failed, and correct a comment in test2 of AbstractFilePermissionTest.java
>
> test/jdk/sun/management/jmxremote/bootstrap/AbstractFilePermissionTest.java line 144:
> 
>> 142: 
>> 143:         if (doTest() != 0) {
>> 144:             System.out.println("FAILURE");
> 
> Would be better to print out which test failed and include the error #.

Maybe very marginally useful. I'll add it.  8-)

It's the exit code of the JVM process, being zero or not zero, and the output already printed before the "FAILURE" note that will be the guide as to what went wrong.

If it's the port failure, you'll see the retries then the eventual FAILURE, so that will be clear.

If the JVM failed to startup, it's more the output than the exit code that we want.

I really wanted the FAILURE printed because it tests two things, and when you see this test for the first time, it may not be obvious which of the tests is the actual failure - particularly as test2 is expected to cause an error and a non-zero exit code.  So it says "1 failure", and you can stare at two things that look like failures. 8-)

Maybe very marginally useful. I'll add it.  8-)

It's the exit code of the JVM process, being zero or not zero, and the output already printed before the "FAILURE" note will be the guide as to what went wrong.  (If it's the port failure, you'll see the retries then the eventual FAILURE, so that will be clear.)

If the JVM failed to startup, it's more the text output than the exit code that we want.

I really wanted the FAILURE printed because it tests two things, and when you see this test for the first time, it may not be obvious which of the tests is the actual failure - particularly as test2 is expected to cause an error and a non-zero exit code.  So it says "1 failure", and you can stare at two things that look like failures. 8-)

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/18470#discussion_r1538323593


More information about the jmx-dev mailing list