JDK-8280091 : Bypass execution of tests with -Djava.net.preferIPv4Stack=true property setting in IPv6 only environment
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 18
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2022-01-17
  • Updated: 2022-01-18
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.
Other
tbdUnresolved
Related Reports
Blocks :  
Relates :  
Relates :  
Relates :  
Description
Tests such as 
java/net/Socket/UrgentDataTest.java
java/net/NetworkInterface/Test.java
java/net/NetworkInterface/IPv4Only.java

have test runs with system property -Djava.net.preferIPv4Stack=true which results in failures in IPv6 only environments
Comments
In the case of java/net/NetworkInterface/IPv4Only.java it seems that IPSupport.hasIPv4() has returned true. The implementation of IPSupport.hasIPv4() should probably be revisited. Typically it might be revisited to return false in cases where no network interface supporting IPv4 is found. java.net.SocketException: No network interfaces configured at java.base/java.net.NetworkInterface.getNetworkInterfaces(NetworkInterface.java:357) at IPv4Only.main(IPv4Only.java:40) I have logged JDK-8280121 to take care of this.
18-01-2022

I wonder if we should explore using the jtreg @requires tag, meaning a property to indicate if there is IPv4 support and another if there is IPv6 support. If feasible then it might probably a more flexible way to have test selection be done based on the configuration of the test machine.
18-01-2022