8241786: 3 DatagramChannel tests and 2 MulticastSocket tests fail due to "SocketException: No buffer space available"

Alan Bateman Alan.Bateman at oracle.com
Wed Apr 1 19:50:31 UTC 2020



On 01/04/2020 18:42, Daniel Fuchs wrote:
> Hi,
>
> Please find below a fix for:
>
> 8241786: 3 DatagramChannel tests and 2 MulticastSocket tests
>          fail due to "SocketException: No buffer space available"
> https://bugs.openjdk.java.net/browse/JDK-8241786
>
> webrev:
> http://cr.openjdk.java.net/~dfuchs/webrev_8241786/webrev.01/
>
> The real fix is in these three files:
>
> DefaultInterface.java (macOS): is modified to prefer interfaces
>     that have non link local addresses
> NetworkConfiguration.java (test lib): is modified to skip
>     interfaces that have only link-local addresses (whether IPv4
>     or IPv6) for multicasting.
> MulticastSocket/SetOutgoingIf.java: this test does its own thing,
>     and is modified similarly to NetworkConfiguration
>
> Additional cleanup:
>
> The other tests are just modified to add diagnostic and use 
> try-with-resources whenever possible, and also use /othervm to avoid 
> some undesirable side effects (like not seeing any trace):
>
> MulticastSocket/SetLoopbackMode.java
> MulticastSocket/SetLoopbackModeIPv4.java
> DatagramChannel/AdaptorMulticasting.java
> DatagramChannel/MulticastSendReceiveTests.java
> DatagramChannel/Promiscuous.java
The change to java.net.DefaultInterface to workaround bad configurations 
on macOS looks good. Hopefully existing usages of the 1-arg joinGroup 
will migrate to the 2-arg variant and avoid needing the JDK to choose on 
multi-homed systems.

DefaultInterface might be better in a test infra class (in java/net) to 
avoid duplicate it in several tests.

The updates to the DatagramChannel tests look okay but I think we should 
change the new trace messages added to AdaptorMulticasting to be 
consistent with the existing trace, e.g. the test cycles through the 
families and interfaces and prints output like this following before 
each run:

Test family=INET, multicast group=/225.4.5.6, interface=en0

The changes in the patch duplicate a subset of this in a different 
format. It might be simpler to just not duplicate it but print just 
print the name of the sub-tests, whatever is easiest.

NetworkConfiguration looks okay although I could imagine the comment 
added at L101-103 not being clearer for future maintainers. I think 
we'll need to do a cleanup of this test class at some point.

-Alan




More information about the nio-dev mailing list