[jdk8u-dev] Integrated: 8223145: Replace wildcard address with loopback or local host in tests - part 1

SendaoYan syan at openjdk.org
Thu Jan 15 11:31:44 UTC 2026


On Wed, 22 Oct 2025 08:37:45 GMT, SendaoYan <syan at openjdk.org> wrote:

> Hi, all
> 
> We observed the test java/net/Socket/GetLocalAddress.java intermittently fails "java.net.SocketException: Invalid argument or cannot assign requested address" very often. So I want to backport JDK-8223145 to jdk8u-dev to fix this issue.
> 
> Testing:
> 
> - [x] Test all the touch files locally on linux-x64, except sun/net/www/httptest/TestHttpServer.java and lib/testlibrary/jdk/testlibrary/net/URIBuilder.java which use as test library.
> - [x] Test all the jtreg tests by jenkins.
> 
> There are 3 types of files cause backport uncleanly.
> 
> 1. Different context cause should replace '127.0.0.1' as 'loopback' manually.
> 
> jdk/test/com/sun/net/httpserver/bugs/B6361557.java
> jdk/test/java/net/Socket/UrgentDataTest.java
> jdk/test/sun/net/www/http/HttpURLConnection/PostOnDelete.java
> 
> 2. Different context cause deal with copyright year manually.
> jdk/test/java/net/Socket/TestAfterClose.java
> jdk/test/java/net/ResponseCache/ResponseCacheTest.java
> jdk/test/sun/net/www/protocol/http/B8012625.java
> 
> 
> 3. Test was added after jdk8+, so it's not needed deal with jdk8u-dev
> java/net/SocketOption/OptionsTest.java
> java/net/URLPermission/nstest/LookupTest.java
> sun/net/www/http/HttpURLConnection/NTLMAuthWithSM.java
> 
> 4. The test library located difference, so we need to adopt in jdk8u-dev: replace '@library /test/lib' as '@library /lib/testlibrary', and replace 'import jdk.test.lib.net.URIBuilder;' as 'import jdk.testlibrary.net.URIBuilder;'.
> java/net/ResponseCache/ResponseCacheTest.java
> java/net/HttpURLConnection/UnmodifiableMaps.java
> sun/net/www/protocol/https/HttpsURLConnection/CookieHandlerTest.java
> sun/net/www/http/KeepAliveStream/KeepAliveStreamClose.java
> java/net/URL/GetContent.java

This pull request has now been integrated.

Changeset: dc19effc
Author:    SendaoYan <syan at openjdk.org>
URL:       https://git.openjdk.org/jdk8u-dev/commit/dc19effcf6720e1b46b22336b718e7d080ff0022
Stats:     191 lines in 21 files changed: 132 ins; 1 del; 58 mod

8223145: Replace wildcard address with loopback or local host in tests - part 1

Replaces binding to wildacard with alternative less susceptible to intermittent failure in some intermittently failing tests.

Reviewed-by: phh
Backport-of: 7d4520c109f408a7dbcdcc424dfef121e3eeaaa7

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

PR: https://git.openjdk.org/jdk8u-dev/pull/707


More information about the jdk8u-dev mailing list