Lutz Neugebauer created SUREFIRE-2220: -----------------------------------------
Summary: SurefireForkChannel.getForkNodeConnectionString returning invalid URI String if localHost resolves to IPv6 address literal Key: SUREFIRE-2220 URL: https://issues.apache.org/jira/browse/SUREFIRE-2220 Project: Maven Surefire Issue Type: Bug Components: process forking Affects Versions: 3.2.2 Reporter: Lutz Neugebauer [SurefireForkChannel.getForkNodeConnectionString|https://github.com/apache/maven-surefire/blob/2d7675397e884b18d59a596c004e73982368ee7c/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/SurefireForkChannel.java#L114] returns invalid URI string if localhost is an IPv6 address literal: {code:java} public String getForkNodeConnectionString() { return "tcp://" + localHost + ":" + localPort + (isBlank(sessionId) ? "" : "?sessionId=" + sessionId); } {code} localHost is initialized from [InetSocketAddress.getHostString()|https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/net/InetSocketAddress.html#getHostString()] at [SurefireForkChannel.SurefireForkChannel()|https://github.com/apache/maven-surefire/blob/2d7675397e884b18d59a596c004e73982368ee7c/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/SurefireForkChannel.java#L100] which may return "... the String form of the address if it doesn't have a hostname (it was created using a literal)." If an IPv6 address is returned, then the URI computed is something like {code:java} tcp://0:0:0:0:0:0:0:1:34398?sessionId=... {code} instead of required format (cf. [URI.URI()|https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/net/URI.html#%3Cinit%3E(java.lang.String]) {code:java} tcp://[0:0:0:0:0:0:0:1]:34398?sessionId=... {code} At my end the incorrect URI seems to cause hanging build, probably when it is consumed at [SurefireMasterProcessChannelProcessorFactory.connect()|https://github.com/apache/maven-surefire/blob/2d7675397e884b18d59a596c004e73982368ee7c/surefire-booter/src/main/java/org/apache/maven/surefire/booter/spi/SurefireMasterProcessChannelProcessorFactory.java#L74]. -- This message was sent by Atlassian Jira (v8.20.10#820010)