RFR: 8269616: serviceability/dcmd/framework/VMVersionTest.java fails with Address already in use error

Kevin Walls kevinw at openjdk.java.net
Thu Jul 22 16:40:57 UTC 2021


On Fri, 2 Jul 2021 21:23:39 GMT, Alex Menkov <amenkov at openjdk.org> wrote:

> SocketIOPipe/IOPipe classes can select listening port by 2 ways:
> 1. caller specifies "-transport.address=dynamic" argument creating ArgumentHandler,
> and calls Binder.prepareForPipeConnection (actually see nsk.share.jpda.DebugeeBinder.prepareForPipeConnection()) before start listening.
> In the case prepareForPipeConnection creates socket and this socket later is used by IOPipe.
> 2. just start IOPipe listening.
> Then port is selected by calling nsk.share.jpda.DebugeeArgumentHandler.getTransportPort() which use findFreePort() method:
> 
>     ServerSocket ss;
>     try {
>         ss = new ServerSocket(0);
>         return String.valueOf(ss.getLocalPort());
>     }finally {
>         ss.close();
>     }
> 
> This method is known to be error prone (sometimes causes "address in use" error).
> 
> The fix adds "-transport.address=dynamic" argument so IOPipe use 1st method.

Marked as reviewed by kevinw (Committer).

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

PR: https://git.openjdk.java.net/jdk/pull/4676


More information about the serviceability-dev mailing list