OpenJDK test : handling of "Address already in use"

Baesken, Matthias matthias.baesken at
Thu Dec 30 08:29:52 UTC 2021

Hello, I have a question regarding the test .

The test

seems to handle already cases where "Address already in use" is found in the output (see line 120 ).

However in our nightly test,  the   fails with this output :

LingeredApp stdout: [];
LingeredApp stderr: []
LingeredApp exitValue = 0
[debugd] Attaching to process ID 372 and starting RMI services, please wait...
[debugd] Error attaching to process or starting server: sun.jvm.hotspot.debugger.DebuggerException: java.rmi.server.ExportException: Port already in use: 39399; nested exception is:
[debugd] Address already in use
[debugd] at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.setupDebugger(
java.lang.RuntimeException: Expected message "RMI connector is bound to port 39399" is not found in the output.
  at SADebugDTest.testWithPid(
  at SADebugDTest.runTests(
  at SADebugDTest.main(
  at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(
  at java.base/java.lang.reflect.Method.invoke(
  at com.sun.javatest.regtest.agent.MainWrapper$
  at java.base/

JavaTest Message: Test threw exception: java.lang.RuntimeException: Expected message "RMI connector is bound to port 39399" is not found in the output.
JavaTest Message: shutting down test

Looks like  the  ADDRESS_ALREADY_IN_USE   string is checked below;  however later in the coding  portInUse  is not checked but  the RuntimeException  "Expected message . . ."  is thrown :

                Process debugd = startProcess("debugd", pb, null,
                        l -> {
                            if (!useRmiPort && l.contains(GOLDEN)) {
                                testResult = true;
                            } else if (useRmiPort && l.contains(RMI_CONNECTOR_IS_BOUND + finalRmiPort)) {
                                testResult = true;
                            } else if (l.contains(ADDRESS_ALREADY_IN_USE)) {
                                portInUse = true;
                            return (l.contains(GOLDEN) || portInUse);
                        }, 20, TimeUnit.SECONDS);

                // If we are here, this means we have received the golden line and the test has passed
                // The debugd remains running, we have to kill it

                if (!testResult) {
                    throw new RuntimeException("Expected message \"" +
                            RMI_CONNECTOR_IS_BOUND + rmiPort + "\" is not found in the output.");

            } while (portInUse); // Repeat the test if the port is already in use

Is this really intended ?  from the comments in the test I had the impression that in case of   "port in use"   / "address already in use"   the test should be repeated ?
Otherwise if this is intended, should we flag the test  with  @key  intermittent  ?

Thanks and best regards, Matthias

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the serviceability-dev mailing list