JDK-8262195 : Harden tests that use the HostsFileNameService (jdk.net.hosts.file property)
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux,os_x,windows
  • Submitted: 2021-02-23
  • Updated: 2024-05-28
  • Resolved: 2021-03-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17
17 b12Fixed
Related Reports
Duplicate :  
Relates :  
Sub Tasks
JDK-8262196 :  
Description
Intermittent failures have been observed across java.net that are related to use of System.setproperty("jdk.net.hosts.file") to configure the use of the HostsFileNameService. This is causing issues as it is possible for certain JVM tools to access InetAddress and initialise it's static members (such as nameService and impl) during start-up resulting in a Name Service configuration being already set to the default PlatformNameService by the the time a test run is commenced.

These intermittent failures can be resolved by setting the relevant system property (jdk.net.hosts.file) in the run tag of the jtreg test arguments. This provides certainty that the correct system properties will be set by the time the test is run.  

The following tests are concerned with this issue:
java/net/Inet4Address/textToNumericFormat.java
java/net/InetAddress/InternalNameServiceWithNoHostsFileTest.java
java/net/InetAddress/InternalNameServiceWithHostsFileTest.java
java/net/InetAddress/InternalNameServiceTest.java
java/net/URLPermission/nstest/LookupTest.java
sun/net/InetAddress/nameservice/simple/DefaultCaching.java
sun/net/InetAddress/nameservice/simple/CacheTest.java
Comments
commit https://github.com/openjdk/jdk/commit/8bc8542e3f1be9e4c153057c3ada45585c5dabdc Author: Conor Cleary <ccleary@openjdk.org> Date: Mon Mar 1 10:18:12 2021 +0000
25-04-2024

Changeset: 8bc8542e Author: Conor Cleary <ccleary@openjdk.org> Committer: Aleksei Efimov <aefimov@openjdk.org> Date: 2021-03-01 10:18:12 +0000 URL: https://git.openjdk.java.net/jdk/commit/8bc8542e
01-03-2021